Package org.jboss.forge.project

Examples of org.jboss.forge.project.Project


   }

   private void completeJavaPaths(final PluginCommandCompleterState state, final OptionMetadata option,
            final Map<OptionMetadata, Object> valueMap, final ResourceFilter filter)
   {
      Project project = shell.getCurrentProject();
      if ((project != null) && project.hasFacet(JavaSourceFacet.class))
      {
         ArrayList<String> results = new ArrayList<String>();
         String[] values;

         if (valueMap.isEmpty())
         {
            values = new String[] { "" };
         }
         else if (valueMap.get(option) instanceof String[])
         {
            values = (String[]) valueMap.get(option);
         }
         else if (valueMap.get(option) == null)
         {
            values = new String[] { "" };
         }
         else
         {
            values = new String[] { String.valueOf(valueMap.get(option)) };
         }

         String val = values[values.length - 1];
         for (Resource<?> r : new JavaPathspecParser(project.getFacet(JavaSourceFacet.class), val + "*")
                  .resolve(filter))
         {
            // Add result to the results list, and append a '.' if the
            // resource has children.
            String name = ("~".equals(val) ? "~." : "") + r.getName()
View Full Code Here


      out.println();
      out.println("Type " + out.renderColor(ShellColor.BOLD, "'list-commands'") + " for a list of available " +
               "commands in the current Resource context.");

      out.println();
      Project currentProject = shell.getCurrentProject();
      if (currentProject != null)
      {
         out.println("Currently operating on the Project located at ["
                  + currentProject.getProjectRoot().getFullyQualifiedName() + "]");
      }
      else
      {
         out.println("You are not working on a project. Type " + out.renderColor(ShellColor.BOLD, "'help new-project'")
                  + " to get started.");
View Full Code Here

   @Override
   public Project createProject(final DirectoryResource dir)
   {
      Resource<?> pom = dir.getChild("pom.xml");

      Project result = null;
      if (pom.exists())
      {
         result = new ProjectImpl(factory, dir);
         Facet facet = new MavenCoreFacetImpl(container, writer);
         facet.setProject(result);
         result.registerFacet(facet);
      }
      return result;
   }
View Full Code Here

   {
      getShell().setCurrentResource(createTempFolder());
      queueInputLines("");
      getShell().execute("new-project --named test --topLevelPackage com.test");

      Project project = getProject();
      tempFolder = project.getProjectRoot();
      tempFolders.add(tempFolder);
      return project;
   }
View Full Code Here

   {
      getShell().setCurrentResource(createTempFolder());
      queueInputLines("");
      getShell().execute("new-project --named test --topLevelPackage com.test");

      Project project = getProject();
      tempFolder = project.getProjectRoot();
      tempFolders.add(tempFolder);
      return project;
   }
View Full Code Here

   @Inject
   private Shell shell;

   public void updateConfigLocation(@Observes final PackagingChanged event)
   {
      Project project = event.getProject();
      if (project.hasFacet(CDIFacetImpl.class))
      {
         PackagingType oldType = event.getOldPackagingType();
         PackagingType newType = event.getNewPackagingType();
         shell.printlnVerbose("Packaging type change detected; moving beans.xml " +
                  "from [" + oldType + "] to [" + newType + "]");
View Full Code Here

   }

   @Test
   public void configureContainer() throws Exception
   {
      Project project = initializeJavaProject();

      MavenCoreFacet coreFacet = project.getFacet(MavenCoreFacet.class);

      List<Profile> profiles = coreFacet.getPOM().getProfiles();
      assertThat(profiles.size(), is(0));

      queueInputLines("JBOSS_AS_MANAGED_6", "", "", "", "", "", "", "");
      getShell().execute("arquillian setup");

      queueInputLines("arquillian-jbossas-managed-6", "2", "8000", "");
      getShell().execute("arquillian configure-container");

      ResourceFacet facet = project.getFacet(ResourceFacet.class);
      FileResource<?> arquillianXML = facet.getTestResource("arquillian.xml");

      assertThat(arquillianXML, is(notNullValue()));
      assertThat(arquillianXML.exists(), is(true));
View Full Code Here

   }

   @Test
   public void configureContainerMultipleTimes() throws Exception
   {
      Project project = initializeJavaProject();

      MavenCoreFacet coreFacet = project.getFacet(MavenCoreFacet.class);

      List<Profile> profiles = coreFacet.getPOM().getProfiles();
      assertThat(profiles.size(), is(0));

      queueInputLines("JBOSS_AS_MANAGED_6", "", "", "", "", "", "", "");
      getShell().execute("arquillian setup");

      queueInputLines("arquillian-jbossas-managed-6", "2", "8000", "");
      getShell().execute("arquillian configure-container");

      queueInputLines("arquillian-jbossas-managed-6", "2", "8000", "");
      getShell().execute("arquillian configure-container");

      ResourceFacet facet = project.getFacet(ResourceFacet.class);
      FileResource<?> arquillianXML = facet.getTestResource("arquillian.xml");

      assertThat(arquillianXML, is(notNullValue()));
      assertThat(arquillianXML.exists(), is(true));
View Full Code Here

   }

   @Test
   public void createArquillianXmlOnSetup() throws Exception
   {
      Project project = initializeJavaProject();

      queueInputLines("JBOSS_AS_MANAGED_6", "", "", "", "", "", "", "");
      getShell().execute("arquillian setup");

      ResourceFacet facet = project.getFacet(ResourceFacet.class);
      FileResource<?> arquillianXML = facet.getTestResource("arquillian.xml");

      assertThat(arquillianXML, is(notNullValue()));
      assertThat(arquillianXML.exists(), is(true));
   }
View Full Code Here

      testJUnitTestGenerationUsing("arquillian setup --containerName GLASSFISH_EMBEDDED_3.1 --testFramework JUnit");
   }

   private void testJUnitTestGenerationUsing(String arquillianSetupCommand) throws Exception
   {
      final Project project = initializeJavaProject();
      final MavenCoreFacet mavenCoreFacet = project.getFacet(MavenCoreFacet.class);

      queueInputLines("", "", "", "", "", "");
      getShell().execute("java new-class --named Bean --package com.test");
      getShell().execute(arquillianSetupCommand);
      getShell().execute("arquillian create-test --class com.test.Bean");

      assertThat(mavenCoreFacet.getPOM().getDependencies(), hasItem(new DependencyMatcher("junit")));
      assertThat(mavenCoreFacet.getPOM().getDependencies(), hasItem(new DependencyMatcher("arquillian-junit-container")));

      final JavaSource<?> testClass = project.getFacet(JavaSourceFacet.class)
                                             .getTestJavaResource("com.test.BeanTest")
                                             .getJavaSource();
      assertTrue("@RunWith custom runner should be used", testClass.getAnnotation(RunWith.class).getClassValue().equals(Arquillian.class));

      getShell().execute("build --profile arquillian-glassfish-embedded-3.1");
View Full Code Here

TOP

Related Classes of org.jboss.forge.project.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.