Examples of StructureModificationChecker


Examples of org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker

      VirtualFile originalRoot = createDeploymentRoot("/synch/war", "simple.war");
      VFSDeploymentUnit deploymentUnit = assertDeploy(originalRoot);
      try
      {
         VirtualFile tempRoot = deploymentUnit.getRoot();
         StructureModificationChecker checker = createStructureModificationChecker();
         assertFalse(checker.hasStructureBeenModified(originalRoot));

         // add new file
         URI rootURI = VFSUtils.getRealURL(originalRoot).toURI();
         File rootFile = new File(rootURI);
         File newFile = newFile(rootFile, "newfile.txt");
         try
         {
            assertNull(tempRoot.getChild("newfile.txt"));                       
            assertFalse(checker.hasStructureBeenModified(originalRoot));
            assertNotNull(tempRoot.getChild("newfile.txt"));

            // try deleting this one now
            assertTrue(newFile.delete());
            assertFalse(checker.hasStructureBeenModified(originalRoot));
            assertNull(tempRoot.getChild("newfile.txt"));
         }
         finally
         {
            if (newFile.exists())
               assertTrue(newFile.delete());
         }

         // update some file
         File updateFile = new File(rootFile, "test.jsp");
         assertTrue(updateFile.exists());
         assertTrue(updateFile.setLastModified(System.currentTimeMillis() + 1500l));
         @SuppressWarnings("deprecation")
         VirtualFile testJsp = tempRoot.findChild("test.jsp");
         long tempTimestamp = testJsp.getLastModified();
         // Platform dependent precision for last modified, let's wait a minimum of 1 sec
         Thread.sleep(1500l);
         assertFalse(checker.hasStructureBeenModified(originalRoot));
         long lastModified = testJsp.getLastModified();
         long diff = lastModified - tempTimestamp;
         assertTrue("Last modified diff is not bigger then 0, diff: " + diff, diff > 0);

         // update something outside recurse filter
         VirtualFile someProps = originalRoot.getChild("WEB-INF/classes/some.properties");
         assertNotNull(someProps);
         updateFile = new File(VFSUtils.getRealURL(someProps).toURI());
         assertTrue(updateFile.exists());
         assertTrue(updateFile.setLastModified(System.currentTimeMillis() + 1500l));
         @SuppressWarnings("deprecation")
         VirtualFile tempProps = tempRoot.findChild("WEB-INF/classes/some.properties");
         tempTimestamp = tempProps.getLastModified();
         // Platform dependent precision for last modified, let's wait a minimum of 1 sec
         Thread.sleep(1500l);
         assertFalse(checker.hasStructureBeenModified(originalRoot));
         assertEquals(tempTimestamp, tempProps.getLastModified());

         // add new file into WEB-INF
         VirtualFile webInfo = originalRoot.getChild("WEB-INF");
         File webInfFile = new File(VFSUtils.getCompatibleURI(webInfo));
         File newWebInfFile = newFile(webInfFile, "newfile.txt");
         try
         {
            assertNull(tempRoot.getChild("WEB-INF/newfile.txt"));
            assertFalse(checker.hasStructureBeenModified(originalRoot));
            assertNotNull(tempRoot.getChild("WEB-INF/newfile.txt"));
            assertFalse(checker.hasStructureBeenModified(originalRoot));

            // try deleting this one now
            assertTrue(newWebInfFile.delete());
            assertFalse(checker.hasStructureBeenModified(originalRoot));
            assertNull(tempRoot.getChild("WEB-INF/newfile.txt"));
         }
         finally
         {
            if (newWebInfFile.exists())
               assertTrue(newWebInfFile.delete());
         }

         // check we don't update for nothing
         @SuppressWarnings("deprecation")
         VirtualFile xhtml = tempRoot.findChild("test.xhtml");
         long xhtmlTimestamp = xhtml.getLastModified();
         // Platform dependent precision for last modified, let's wait a minimum of 1 sec
         Thread.sleep(1500l);
         assertFalse(checker.hasStructureBeenModified(originalRoot));
         assertEquals(xhtmlTimestamp, xhtml.getLastModified());
      }
      finally
      {
         undeploy(deploymentUnit);
View Full Code Here

Examples of org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker

   {
      VFSDeploymentUnit deploymentUnit = assertDeploy("/synch/ear", "simple.ear");
      try
      {
         VirtualFile root = deploymentUnit.getRoot();
         StructureModificationChecker checker = createStructureModificationChecker();
         assertFalse(checker.hasStructureBeenModified(root));
      }
      finally
      {
         undeploy(deploymentUnit);
      }
View Full Code Here

Examples of org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker

   protected abstract VirtualFileFilter createFilter();

   public void testDoBasicTest() throws Exception
   {
      AssembledDirectory ear = createBasicEar();
      StructureModificationChecker checker = createStructureModificationChecker();

      VFSDeploymentUnit deploymentUnit = assertDeploy(ear);
      try
      {
         testStructureModified(ear, checker, deploymentUnit);
View Full Code Here

Examples of org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker

   public void testInitialEmptyDir() throws Exception
   {
      AssembledDirectory top = createAssembledDirectory("top.jar", "top.jar");
      AssembledDirectory metainf = top.mkdir("META-INF");
      StructureModificationChecker checker = createStructureModificationChecker();

      VFSDeploymentUnit vdu = assertDeploy(top);
      try
      {
         VirtualFile root = vdu.getRoot();
         assertFalse(checker.hasStructureBeenModified(root));

         URL url = getResource("/scanning/smoke/META-INF/jboss-scanning.xml");
         assertNotNull(url);
         metainf.addChild(VFS.createNewRoot(url));
         assertTrue(checker.hasStructureBeenModified(root));
      }
      finally
      {
         undeploy(vdu);
      }
View Full Code Here

Examples of org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker

   public void testMultipleChanges() throws Exception
   {
      AssembledDirectory top = createAssembledDirectory("top.jar", "top.jar");
      AssembledDirectory metainf = top.mkdir("META-INF");
      StructureModificationChecker checker = createStructureModificationChecker();

      VFSDeploymentUnit vdu = assertDeploy(top);
      try
      {
         VirtualFile root = vdu.getRoot();
         assertFalse(checker.hasStructureBeenModified(root));

         URL url1 = getResource("/scanning/smoke/META-INF/jboss-scanning.xml");
         assertNotNull(url1);
         metainf.addChild(VFS.createNewRoot(url1));
         URL url2 = getResource("/dependency/module/META-INF/jboss-dependency.xml");
         assertNotNull(url2);
         metainf.addChild(VFS.createNewRoot(url2));

         assertTrue(checker.hasStructureBeenModified(root));
         assertFalse(checker.hasStructureBeenModified(root));

         File f1 = new File(url1.toURI());
         assertTrue(f1.setLastModified(System.currentTimeMillis() + 1500l));
         File f2 = new File(url2.toURI());
         assertTrue(f2.setLastModified(System.currentTimeMillis() + 1500l));

         assertTrue(checker.hasStructureBeenModified(root));
         assertFalse(checker.hasStructureBeenModified(root));        
      }
      finally
      {
         undeploy(vdu);
      }
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.