ConverterUtil { public static HDWorkload convertScriptToHdWorkload(Script script) { String name = "TestPlan for " + script.getName(); name += " (id_" + script.getId() + ")"; HDWorkload hdWorkload = new HDWorkload(); hdWorkload.setTankHttpClientClass(new TankConfig().getAgentConfig().getTankClientClassDefault()); hdWorkload.setDescription(name); hdWorkload.setName(name); HDTestPlan tp = new HDTestPlan(); hdWorkload.getPlans().add(tp); tp.setTestPlanName("Main"); tp.setUserPercentage(100); HDScriptGroup hdScriptGroup = new HDScriptGroup(); tp.getGroup().add(hdScriptGroup); hdScriptGroup.setLoop(1); hdScriptGroup.setName("Group-1"); hdScriptGroup.setDescription("autoGen"); HDScript testGroup = new HDScript(); hdScriptGroup.getGroupSteps().add(testGroup); testGroup.setName(script.getName()); testGroup.setLoop(1); testGroup.getUseCase().addAll(convertScript(script.getScriptSteps(), new StepCounter())); return hdWorkload; }  static HDWorkload convertScriptToHdWorkload(Script script); static HDWorkload convertWorkload(Workload workload, BaseJob job); static String getWorkloadXML(HDWorkload hdWorkload); static boolean isAssignment(RequestData data); static List<Header> getPostData(Set<RequestData> postData); static List<ResponseData> getResponseData(Set<RequestData> responseData); static List<Header> getResponseHeaders(Set<RequestData> responseHeaders, Set<RequestData> responseCookies); static List<Header> getRequestHeaders(Set<RequestData> headers, Set<RequestData> cookies); static boolean includedHeader(String header);  }
@Test public void testConvertScriptToHdWorkload_1() throws Exception { Script script = new Script(); script.setSteps(new LinkedList()); script.setName(""); HDWorkload result = ConverterUtil.convertScriptToHdWorkload(script); assertNotNull(result); assertEquals("TestPlan for (id_0)", result.getName()); assertEquals("TestPlan for (id_0)", result.getDescription()); assertNull(result.getVariables()); }