public void testBuild1() throws InvalidConfigurationException, FileNotFoundException { PTestPlan plan = PTestPlanBuilder.build(new FileInputStream("src/test/resources/plan/jms-sample-plan.xml")); String recoveredPlanXml = PTestPlanBuilder.export(plan); System.out.println(recoveredPlanXml); ExecutorService testPlanExecutorService = Executors.newCachedThreadPool(); PTestPlanExecutor executor = new PTestPlanExecutor(plan, "id", 500000, 300000, 64); testPlanExecutorService.execute(executor); try { Thread.sleep(100000); } catch (Exception e) { e.printStackTrace(); } }
@Test public void testBuild() throws InvalidConfigurationException { PTestPlan plan = new PTestPlan(); plan.setCreatedBy("mnxfst"); plan.setCreationDate(new Date()); plan.setDescription("test description"); plan.setName("my-test-plan"); PTestPlanConfigurationOption options = new PTestPlanConfigurationOption(); options.setId("id-1"); options.addOption("test-1", "value-1"); options.addOption("test-2", "value-2"); plan.addGlobalCfgOption(options); options = new PTestPlanConfigurationOption(); options.setId("id-2"); options.addOption("test-3", "value-3"); options.addOption("test-4", "value-4"); plan.addGlobalCfgOption(options); PTestPlanActivitySettings activityOpt = new PTestPlanActivitySettings(); activityOpt.addConfigOption("set-1", "val-1"); activityOpt.addConfigOption("set-2", "val-2"); activityOpt.setClazz("test-class"); activityOpt.setDescription("test class description"); activityOpt.addExportVariable("testInternal", "junitSampleVar"); plan.addActivityConfigOption(activityOpt); String xml = PTestPlanBuilder.export(plan); Assert.assertNotNull("The result must not be null", xml); Assert.assertFalse("The result must not be empty", xml.isEmpty()); PTestPlan recoveredPlan = PTestPlanBuilder.build(new ByteArrayInputStream(xml.getBytes())); String recoveredPlanXml = PTestPlanBuilder.export(recoveredPlan); Assert.assertEquals( "The original xml and the xml of the recovered plan must be equal", xml, recoveredPlanXml); // TODO write a sufficient equals method System.out.println(recoveredPlanXml); }