@Test public void testToXml() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Service testService = new Service("SomeTestService", "SomeTestPath"); testService.setLauncher("simple"); List<String> argsList = Arrays.asList("SomeTestArg", "MPF.DETECTION_TEST_REQUEST"); testService.setArgs(argsList); NodeManager testNode1 = new NodeManager("somehost1"); testNode1.add(testService); NodeManager testNode2 = new NodeManager("somehost2"); testNode2.add(testService); NodeManagers nodeManagers = new NodeManagers(); nodeManagers.add(testNode1); nodeManagers.add(testNode2); NodeManagers.toXml(nodeManagers, outputStream); String content = outputStream.toString(); Assert.assertFalse("XML should not be empty.", content.isEmpty()); Assert.assertFalse("XML should not contain \"" + SERVICE_REFERENCE + "\".", content.contains(SERVICE_REFERENCE)); outputStream.close(); }
public static void toXml(NodeManagers managers, OutputStream outputStream) { XStream xStream = new XStream(); xStream.processAnnotations(NodeManagers.class); xStream.processAnnotations(NodeManager.class); xStream.processAnnotations(Service.class); xStream.processAnnotations(EnvironmentVariable.class); xStream.setMode(XStream.NO_REFERENCES); xStream.toXML(managers, outputStream); }
NodeManagers { public static void toXml(NodeManagers managers, OutputStream outputStream) { XStream xStream = new XStream(); xStream.processAnnotations(NodeManagers.class); xStream.processAnnotations(NodeManager.class); xStream.processAnnotations(Service.class); xStream.processAnnotations(EnvironmentVariable.class); xStream.setMode(XStream.NO_REFERENCES); xStream.toXML(managers, outputStream); } }
NodeManagers { public static void toXml(NodeManagers managers, OutputStream outputStream) { XStream xStream = new XStream(); xStream.processAnnotations(NodeManagers.class); xStream.processAnnotations(NodeManager.class); xStream.processAnnotations(Service.class); xStream.processAnnotations(EnvironmentVariable.class); xStream.setMode(XStream.NO_REFERENCES); xStream.toXML(managers, outputStream); }  }
NodeManagers { public static void toXml(NodeManagers managers, OutputStream outputStream) { XStream xStream = new XStream(); xStream.processAnnotations(NodeManagers.class); xStream.processAnnotations(NodeManager.class); xStream.processAnnotations(Service.class); xStream.processAnnotations(EnvironmentVariable.class); xStream.setMode(XStream.NO_REFERENCES); xStream.toXML(managers, outputStream); }  static NodeManagers fromXml(InputStream inputStream); static void toXml(NodeManagers managers, OutputStream outputStream); List<NodeManager> getAll(); void setAll(List<NodeManager> nodeManagers); void add(NodeManager node); }
NodeManagers { public static void toXml(NodeManagers managers, OutputStream outputStream) { XStream xStream = new XStream(); xStream.processAnnotations(NodeManagers.class); xStream.processAnnotations(NodeManager.class); xStream.processAnnotations(Service.class); xStream.processAnnotations(EnvironmentVariable.class); xStream.setMode(XStream.NO_REFERENCES); xStream.toXML(managers, outputStream); }  static NodeManagers fromXml(InputStream inputStream); static void toXml(NodeManagers managers, OutputStream outputStream); List<NodeManager> getAll(); void setAll(List<NodeManager> nodeManagers); void add(NodeManager node);  }