HistoryKey implements Serializable { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("HistoryKey"); sb.append("{type='").append(type).append('\''); sb.append(", mBean=").append(mBean); sb.append(", secondary='").append(secondary).append('\''); sb.append(", path='").append(path).append('\''); sb.append(", target='").append(target).append('\''); sb.append('}'); return sb.toString(); } HistoryKey(JmxReadRequest pJmxRequest);   HistoryKey(JmxWriteRequest pJmxReq);   HistoryKey(JmxExecRequest pJmxReq);  HistoryKey(String pMBean, String pOperation, String pTarget);  HistoryKey(String pMBean, String pAttribute, String pPath, String pTarget); boolean isMBeanPattern(); boolean matches(HistoryKey pKey); @Override @SuppressWarnings("PMD.IfStmtsMustUseBraces") boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void readRequestForAll() throws MalformedObjectNameException { JmxReadRequest req = new JmxRequestBuilder(READ,"test:type=blub") .build(); HistoryKey key = new HistoryKey(req); assertTrue(key.toString().contains("attribute")); assertTrue(key.toString().contains("(all)")); assertTrue(key.toString().contains("test:type=blub")); }
@Test public void writeRequest() throws MalformedObjectNameException { JmxWriteRequest req = new JmxRequestBuilder(WRITE,"test:type=blub") .attribute("bla") .build(); HistoryKey key = new HistoryKey(req); assertTrue(key.toString().contains("attribute")); assertTrue(key.toString().contains("bla")); assertTrue(key.toString().contains("test:type=blub")); }
@Test public void execRequest() throws MalformedObjectNameException { JmxExecRequest req = new JmxRequestBuilder(EXEC,"test:type=blub") .operation("exec") .arguments("eins","zwei") .build(); HistoryKey key = new HistoryKey(req); assertTrue(key.toString().contains("operation")); assertTrue(key.toString().contains("exec")); assertTrue(key.toString().contains("test:type=blub")); key = new HistoryKey("test:type=blub","exec","targetUrl"); assertTrue(key.toString().contains("targetUrl")); }