/**
   * Creates the impl model from blank wsdl.
   *
   * @param paramModel the param model
   * @param interfaceProject the interface project
   * @param monitor the monitor
   * @return the sOA impl project
   * @throws Exception the exception
   */
  public static SOAImplProject createImplModelFromBlankWsdl(
      ServiceFromWsdlParamModel paramModel,
      SOAIntfProject interfaceProject,
      IProgressMonitor monitor)
      throws Exception {
    // Creates the SOA related metadata
    SOAImplMetadata implMetadata =
        SOAImplMetadata.create(paramModel, interfaceProject.getMetadata());
    ProgressUtil.progressOneStep(monitor);

    SOAProjectEclipseMetadata eclipseMetadata =
        SOAProjectEclipseMetadata.create(
            implMetadata.getServiceImplProjectName(), paramModel.getWorkspaceRootDirectory());
    ProgressUtil.progressOneStep(monitor);

    SOAImplProject implProject = SOAImplProject.create(implMetadata, eclipseMetadata);
    ProgressUtil.progressOneStep(monitor);

    final ISOAOrganizationProvider orgProvider =
        GlobalRepositorySystem.instanceOf()
            .getActiveRepositorySystem()
            .getActiveOrganizationProvider();
    Set<String> requiredLibraries = paramModel.getImplLibs();
    requiredLibraries.addAll(orgProvider.getDefaultDependencies(SupportedProjectType.IMPL));
    implProject.setRequiredLibraries(requiredLibraries);
    // adding the service project now
    Set<String> requiredProjects = paramModel.getImplProjects();
    requiredProjects.add(interfaceProject.getEclipseMetadata().getProjectName());
    implProject.setRequiredProjects(requiredProjects);
    ProgressUtil.progressOneStep(monitor);
    return implProject;
  }
  /**
   * Creates the impl project from blank wsdl.
   *
   * @param implProject the impl project
   * @param intfProject the intf project
   * @param monitor the monitor
   * @throws Exception the exception
   */
  public static void createImplProjectFromBlankWsdl(
      SOAImplProject implProject, SOAIntfProject intfProject, IProgressMonitor monitor)
      throws Exception {
    IProject project = SOAResourceCreator.createProject(implProject.getEclipseMetadata(), monitor);
    ProgressUtil.progressOneStep(monitor);

    SOAResourceCreator.createFolders(project, implProject, monitor);
    ProgressUtil.progressOneStep(monitor);

    SOAResourceCreator.createPropertiesFile(implProject);
    ProgressUtil.progressOneStep(monitor);

    BuildSystemConfigurer.performRepositorySpecificTasks(implProject, monitor);
    ProgressUtil.progressOneStep(monitor);

    BuildSystemConfigurer.configure(implProject, monitor);
    ProgressUtil.progressOneStep(monitor);

    BuildSystemCodeGen.generateServiceConfigXml(implProject);
    ProgressUtil.progressOneStep(monitor);
  }
  // @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);
  }