Package org.jboss.forge.addon.resource

Examples of org.jboss.forge.addon.resource.DirectoryResource


   @Test(timeout = 10000)
   public void testChangeDirEmpty() throws TimeoutException
   {
      File tempDir = OperatingSystemUtils.createTempDir();
      DirectoryResource tempResource = resourceFactory.create(tempDir).reify(DirectoryResource.class);
      tempDir.deleteOnExit();

      Shell shell = shellTest.getShell();
      shell.setCurrentResource(tempResource);
      Result changeDirResult = shellTest.execute("cd", 10, TimeUnit.SECONDS);
View Full Code Here


   @Test
   public void testListDirCommand() throws TimeoutException
   {
      File tempDir = OperatingSystemUtils.createTempDir();
      DirectoryResource tempResource = resourceFactory.create(tempDir).reify(DirectoryResource.class);
      DirectoryResource childDirectory = tempResource.getChildDirectory("child");
      childDirectory.mkdir();
      childDirectory.deleteOnExit();
      tempDir.deleteOnExit();

      Shell shell = shellTest.getShell();
      shell.setCurrentResource(tempResource);
      shellTest.execute("ls", 10, TimeUnit.SECONDS);
      Assert.assertThat(shellTest.getStdOut(), containsString("child"));
      childDirectory.delete();
      tempDir.delete();
   }
View Full Code Here

   @Test
   public void testListAllDirCommand() throws TimeoutException
   {
      File tempDir = OperatingSystemUtils.createTempDir();
      DirectoryResource tempResource = resourceFactory.create(tempDir).reify(DirectoryResource.class);
      DirectoryResource childDirectory = tempResource.getChildDirectory("child");
      childDirectory.mkdir();
      FileResource<?> afile = tempResource.getChild(".afile").reify(FileResource.class);
      afile.createNewFile();
      afile.deleteOnExit();
      childDirectory.deleteOnExit();
      tempDir.deleteOnExit();

      Shell shell = shellTest.getShell();
      shell.setCurrentResource(tempResource);

      shellTest.execute("ls", 10, TimeUnit.SECONDS);
      Assert.assertNotNull(shellTest.getStdOut());
      Assert.assertThat(shellTest.getStdOut(), not(containsString(".afile")));

      shellTest.execute("ls -a", 10, TimeUnit.SECONDS);
      Assert.assertThat(shellTest.getStdOut(), containsString("child"));
      Assert.assertThat(shellTest.getStdOut(), containsString(".afile"));

      shellTest.execute("ls --all", 10, TimeUnit.SECONDS);
      Assert.assertNotNull(shellTest.getStdOut());
      Assert.assertThat(shellTest.getStdOut(), containsString("child"));
      Assert.assertThat(shellTest.getStdOut(), containsString(".afile"));

      afile.delete();
      childDirectory.delete();
      tempDir.delete();
   }
View Full Code Here

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      String beanName = named.getValue();
      String beanPackage = targetPackage.getValue();
      DirectoryResource targetDir = targetLocation.getValue();
      UIContext uiContext = context.getUIContext();
      Project project = getSelectedProject(uiContext);
      JavaResource javaResource;
      if (project == null)
      {
View Full Code Here

   @Test
   public void testDefaultResourceDirectory() throws Exception
   {
      ResourcesFacet facet = project.getFacet(ResourcesFacet.class);
      DirectoryResource expected = project.getRootDirectory().getChildDirectory(
               "src" + File.separator + "main" + File.separator + "resources");
      Assert.assertEquals(expected.getFullyQualifiedName(), facet.getResourceDirectory().getFullyQualifiedName());
   }
View Full Code Here

   @Test
   public void testDefaultTestResourceDirectory() throws Exception
   {
      ResourcesFacet facet = project.getFacet(ResourcesFacet.class);
      DirectoryResource expected = project.getRootDirectory().getChildDirectory(
               "src" + File.separator + "test" + File.separator + "resources");
      Assert.assertEquals(expected.getFullyQualifiedName(), facet.getTestResourceDirectory().getFullyQualifiedName());
   }
View Full Code Here

      MavenModelResource pom = project.getRootDirectory().getChild("pom.xml").reify(MavenModelResource.class);

      pom.setContents("<project><modelVersion>4.0.0</modelVersion><groupId>com.test</groupId><artifactId>testme</artifactId><version>1.0</version><build><resources><resource><directory>foo</directory></resource></resources></build></project>");

      ResourcesFacet facet = project.getFacet(ResourcesFacet.class);
      DirectoryResource expected = project.getRootDirectory().getChildDirectory(
               "foo");
      Assert.assertEquals(expected.getFullyQualifiedName(), facet.getResourceDirectory().getFullyQualifiedName());
   }
View Full Code Here

      pom.setContents("<project><modelVersion>4.0.0</modelVersion><groupId>com.test</groupId><artifactId>testme</artifactId><version>1.0</version><build><resources><resource><directory>${project.basedir}"
               + File.separator + "foo</directory></resource></resources></build></project>");

      ResourcesFacet facet = project.getFacet(ResourcesFacet.class);
      DirectoryResource expected = project.getRootDirectory().getChildDirectory(
               "foo");
      Assert.assertEquals(expected.getFullyQualifiedName(), facet.getResourceDirectory().getFullyQualifiedName());
   }
View Full Code Here

      MavenModelResource pom = project.getRootDirectory().getChild("pom.xml").reify(MavenModelResource.class);

      pom.setContents("<project><modelVersion>4.0.0</modelVersion><groupId>com.test</groupId><artifactId>testme</artifactId><version>1.0</version><build><testResources><testResource><directory>foo</directory></testResource></testResources></build></project>");

      ResourcesFacet facet = project.getFacet(ResourcesFacet.class);
      DirectoryResource expected = project.getRootDirectory().getChildDirectory(
               "foo");
      Assert.assertEquals(expected.getFullyQualifiedName(), facet.getTestResourceDirectory().getFullyQualifiedName());
   }
View Full Code Here

      pom.setContents("<project><modelVersion>4.0.0</modelVersion><groupId>com.test</groupId><artifactId>testme</artifactId><version>1.0</version><build><testResources><testResource><directory>${project.basedir}"
               + File.separator + "foo</directory></testResource></testResources></build></project>");

      ResourcesFacet facet = project.getFacet(ResourcesFacet.class);
      DirectoryResource expected = project.getRootDirectory().getChildDirectory(
               "foo");
      Assert.assertEquals(expected.getFullyQualifiedName(), facet.getTestResourceDirectory().getFullyQualifiedName());
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.resource.DirectoryResource

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.