@Test public void getNames() { Client c = new Client(HTTP_ADDRESS, HTTP_PORT, adam.getLoginName(), adamsPass); try { // Login c.connect(); Object result = c.invoke(testServiceClass.getName(), "getMeasureNames", true); assertTrue(result instanceof String[]); String[] resultArray = (String[]) result; for (String measureName : resultArray) System.out.println("Result of asking for all measures: " + measureName); result = c.invoke(testServiceClass.getName(), "getNodes"); assertTrue(result instanceof String[]); resultArray = (String[]) result; for (String node : resultArray) System.out.println("Result of asking for all nodes: " + node); result = c.invoke(testServiceClass.getName(), "getServices"); assertTrue(result instanceof String[]); resultArray = (String[]) result; for (String service : resultArray) System.out.println("Result of asking for all monitored service names: " + service); if (resultArray.length != 0) { String serviceName = resultArray[0]; System.out.println("Calling getModels with service: " + serviceName); result = c.invoke(testServiceClass.getName(), "getModels", serviceName, true); assertTrue(result instanceof String[]); resultArray = (String[]) result; for (String service : resultArray) System.out.println("Result of asking for all models: " + service); } else System.out.println("Result of asking for all monitored service names: none!"); } catch (Exception e) { e.printStackTrace(); fail("Exception: " + e); } try { // Logout c.disconnect(); } catch (Exception e) { e.printStackTrace(); fail("Exception: " + e); } }
@Test public void getMeasuresAndModels() { Client c = new Client(HTTP_ADDRESS, HTTP_PORT, adam.getLoginName(), adamsPass); try { // Login c.connect(); Object result = c.invoke(testServiceClass.getName(), "getNodes"); String[] resultArray = (String[]) result; if (resultArray.length != 0) { String knownNode = ((String[]) result)[0]; System.out.println("Calling Node Success Model with node " + knownNode); result = c.invoke( testServiceClass.getName(), "visualizeNodeSuccessModel", knownNode, true, true); assertTrue(result instanceof String); System.out.println("Visualizing Node Success Model Result:\n" + result); } else System.out.println("No monitored nodes, no node success model visualization possible!"); result = c.invoke( testServiceClass.getName(), "visualizeServiceSuccessModel", "Chat Service Success Model", true, true); assertTrue(result instanceof String); System.out.println("Visualizing Chat Service Success Model Result:\n" + result); } catch (Exception e) { e.printStackTrace(); fail("Exception: " + e); } try { // Logout c.disconnect(); } catch (Exception e) { e.printStackTrace(); fail("Exception: " + e); } }