Package org.jboss.forge.addon.resource

Examples of org.jboss.forge.addon.resource.DirectoryResource.deleteOnExit()


   public Project createTempProject(BuildSystem buildSystem, Iterable<Class<? extends ProjectFacet>> facetTypes)
   {
      File rootDirectory = OperatingSystemUtils.createTempDir();
      DirectoryResource addonDir = resourceFactory.create(DirectoryResource.class, rootDirectory);
      DirectoryResource projectDir = addonDir.createTempResource();
      projectDir.deleteOnExit();
      Project project = createProject(projectDir, buildSystem, facetTypes);
      return project;
   }

   @Override
View Full Code Here


      DirectoryResource currentResource = resourceFactory.create(DirectoryResource.class, tempDir);
      Shell shell = test.getShell();
      shell.setCurrentResource(currentResource);
      DirectoryResource child = currentResource.getChildDirectory("Forge 2 Escape");
      child.mkdir();
      child.deleteOnExit();
      Result result = test.execute("cd Forge\\ 2\\ Escape", 10, TimeUnit.SECONDS);
      Assert.assertThat(result.getMessage(), CoreMatchers.nullValue());
      Assert.assertEquals(shell.getCurrentResource(), child);
      currentResource.delete(true);
   }
View Full Code Here

   @Test(timeout = 10000)
   public void testTransactionTrackChanges() throws Exception
   {
      test.clearScreen();
      DirectoryResource tempDir = factory.create(OperatingSystemUtils.createTempDir()).reify(DirectoryResource.class);
      tempDir.deleteOnExit();

      test.getShell().setCurrentResource(tempDir);
      Assert.assertFalse(test.execute("track-changes", SHELL_TIMEOUT, TimeUnit.SECONDS) instanceof Failed);
      test.waitForStdOutValue("Resource change tracking is ON.", SHELL_TIMEOUT, TimeUnit.SECONDS);
View Full Code Here

   @Test(timeout = 10000)
   public void testTransactionTrackChangesExistingTransaction() throws Exception
   {
      test.clearScreen();
      DirectoryResource tempDir = factory.create(OperatingSystemUtils.createTempDir()).reify(DirectoryResource.class);
      tempDir.deleteOnExit();

      test.getShell().setCurrentResource(tempDir);
      Assert.assertFalse(test.execute("transaction-start", SHELL_TIMEOUT, TimeUnit.SECONDS) instanceof Failed);
      Assert.assertFalse(test.execute("track-changes", SHELL_TIMEOUT, TimeUnit.SECONDS) instanceof Failed);
View Full Code Here

   @Test(timeout = 10000)
   public void testTransactionTrackChangesManualTransaction() throws Exception
   {
      test.clearScreen();
      DirectoryResource tempDir = factory.create(OperatingSystemUtils.createTempDir()).reify(DirectoryResource.class);
      tempDir.deleteOnExit();

      test.getShell().setCurrentResource(tempDir);
      Assert.assertFalse(test.execute("track-changes", SHELL_TIMEOUT, TimeUnit.SECONDS) instanceof Failed);
      Assert.assertFalse(test.execute("transaction-start", SHELL_TIMEOUT, TimeUnit.SECONDS) instanceof Failed);
View Full Code Here

   @Test(timeout = 10000)
   public void testTransactionTrackChangesOff() throws Exception
   {
      DirectoryResource tempDir = factory.create(OperatingSystemUtils.createTempDir()).reify(DirectoryResource.class);
      tempDir.deleteOnExit();

      final AtomicBoolean flag = new AtomicBoolean(false);
      factory.addTransactionListener(new ResourceTransactionListener()
      {
         @Override
View Full Code Here

   {
      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);
      Result changeDirResult = shellTest.execute("cd child", 10, TimeUnit.SECONDS);
View Full Code Here

   {
      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);
View Full Code Here

      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);
View Full Code Here

   @Test
   public void testRunScriptSingleLine() throws Exception
   {
      DirectoryResource temp = (DirectoryResource) resourceFactory.create(OperatingSystemUtils.createTempDir());
      temp.deleteOnExit();
      shellTest.getShell().setCurrentResource(temp);

      FileResource<?> script = (FileResource<?>) temp.getChild("script.fsh");
      script.setContents("touch foo.txt");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.