/* * Assert EmployerType and dependent types are added to the wsdl */ public void validateProjectArtifacts(String eBoxServiceName) throws IOException, CoreException { IProject project = WorkspaceUtil.getProject(eBoxServiceName); Assert.assertTrue( "TypeDepencies.xml didnot get generated", project .getFile( "meta-src" + File.separator + "META-INF" + File.separator + eBoxServiceName + File.separator + "TypeDependencies.xml") .exists()); String sb = ServiceCreationFromExistingTypesTest1.readContentsFromIFile( project.getFile( "meta-src" + File.separator + "META-INF" + File.separator + "soa" + File.separator + "services" + File.separator + "wsdl" + File.separator + eBoxServiceName + File.separator + eBoxServiceName + ".wsdl")); Assert.assertTrue( "WSDL file is not inlined with imported type - EmployerType", sb.indexOf("EmployerType") > -1); }
/* * Assert pom.xml has library dependency - HardwareTypeLibrary */ public void validateBuildArtifacts(String eBoxServiceName) throws CoreException, IOException { IProject project = WorkspaceUtil.getProject(eBoxServiceName); Assert.assertTrue( "Project.xml doesnot contain library dependency SOA21TestTL2", ServiceCreationFromExistingTypesTest1.readContentsFromIFile(project.getFile("pom.xml")) .indexOf("SOA21TestTL2") > -1); }
// @Ignore("failig due to 756 JIRA") @Test public void testCreateServiceFrmNewWsdl() throws IOException, CoreException { String eBoxServiceName = ServicesUtil.getAdminName(TypeLibSetUp.SVC_NAME2); System.out.println(" --- eBox Service name : " + eBoxServiceName); TypeLibSetUp.setupSvc(eBoxServiceName); try { /* * final ServiceFromTemplateWsdlParamModel model = new * ServiceFromTemplateWsdlParamModel(); final String servicePkg = * "com.ebayopensource.turmeric.services"; model * .setTargetNamespace(SOAServiceConstants * .DEFAULT_SERVICE_NAMESPACE); * model.setServiceName(EBoxTypeLibSetUp.SVC_NAME2); model * .setServiceInterface(servicePkg + "." + model.getServiceName()); * model.setWorkspaceRootDirectory(EBoxTypeLibSetUp.SVC_LOCATION); * model.setServiceImpl("com.ebayopensource.turmeric.services." + * EBoxTypeLibSetUp.SVC_NAME2 + "Impl"); * model.setServiceVersion("1.0.0"); * model.setImplName(EBoxTypeLibSetUp.SVC_NAME2 + "Impl"); model * .setWSDLSourceType * (SOAProjectConstants.InterfaceWsdlSourceType.NEW); * SimpleTestUtil.setAutoBuilding(true); * ServiceCreator.createServiceFromBlankWSDL(model, ProgressUtil * .getDefaultMonitor(null)); * * WorkspaceUtil.getProject(EBoxTypeLibSetUp.SVC_NAME2).build( * IncrementalProjectBuilder.FULL_BUILD, * ProgressUtil.getDefaultMonitor(null)); * * WorkspaceUtil.getProject(EBoxTypeLibSetUp.SVC_NAME2 + "Impl") * .build(IncrementalProjectBuilder.FULL_BUILD, * ProgressUtil.getDefaultMonitor(null)); */ // TypeLibSetUp.setup(); Assert.assertTrue( TypeLibSetUp.TYPELIBRARY_NAME2 + " -- TypeLibrary Creation failed", TLUtil.createTypeLibrary( TypeLibSetUp.TYPELIBRARY_NAME2, "1.0.0", "COMMON", TypeLibSetUp.TYPELIB_LOCATION)); TLUtil.createType( "EmployerType", TypeLibSetUp.TYPELIBRARY_NAME2, TypeLibSetUp.TYPELIBRARY_NAME2, SOAXSDTemplateSubType.SIMPLE, TstConstants.TEMPLATE_SIMPLE_TYPE, TstConstants.XSD_STRING); ServiceFromBlankWsdlTest.createServiceFromBlankWsdl(eBoxServiceName, TypeLibSetUp.SVC_NAME2); // Code to simulate Import action String typeNS = TLUtil.getTargetNamespace(TLUtil.functionDomain); WorkspaceUtil.refresh(); SOAGlobalRegistryAdapter.getInstance().getGlobalRegistry(); SOAGlobalRegistryAdapter.getInstance().invalidateRegistry(); LibraryType type = SOAGlobalRegistryAdapter.getInstance() .getGlobalRegistry() .getType( new QName( "http://www.ebayopensource.org/turmeric/blogs/v1/types", "EmployerType")); Assert.assertTrue( "Import type in WSDL failed", TLUtil.importAction( "WSDL", eBoxServiceName, TypeLibSetUp.SVC_NAME2 + ".wsdl", "EmployerType", typeNS)); // Build Projects SimpleTestUtil.setAutoBuilding(true); WorkspaceUtil.getProject(eBoxServiceName) .build(IncrementalProjectBuilder.FULL_BUILD, ProgressUtil.getDefaultMonitor(null)); WorkspaceUtil.getProject(eBoxServiceName + "Impl") .build(IncrementalProjectBuilder.FULL_BUILD, ProgressUtil.getDefaultMonitor(null)); Assert.assertTrue("Service Creation with Import action passed", true); } catch (Exception e) { e.printStackTrace(); Assert.assertTrue("Service Creation with Import action failed", false); } validateProjectArtifacts(eBoxServiceName); validateBuildArtifacts(eBoxServiceName); }