Package org.hornetq.core.deployers.impl

Examples of org.hornetq.core.deployers.impl.FileDeploymentManager


      // Create the hard-wired components

      if (configuration.isFileDeploymentEnabled())
      {
         deploymentManager = new FileDeploymentManager(configuration.getFileDeployerScanPeriod());
      }

      callPreActiveCallbacks();

      // startReplication();
View Full Code Here


      // Create the hard-wired components

      if (configuration.isFileDeploymentEnabled())
      {
         deploymentManager = new FileDeploymentManager(configuration.getFileDeployerScanPeriod());
      }

      callPreActiveCallbacks();

      // startReplication();
View Full Code Here

         }
      }

      started = true;

      deploymentManager = new FileDeploymentManager(server.getConfiguration().getFileDeployerScanPeriod());

      server.registerActivateCallback(this);

      server.start();
View Full Code Here

      }
   }

   private void testStartStop1(final String filename) throws Exception
   {
      FileDeploymentManager fdm = new FileDeploymentManager(Long.MAX_VALUE);

      FileDeploymentManagerTest.log.debug("Filename is " + filename);

      File file = new File("tests/tmpfiles/" + filename);

      FileDeploymentManagerTest.log.debug(file.getAbsoluteFile());

      System.out.println("========file name: " + file.getAbsolutePath());

      file.createNewFile();

      FakeDeployer deployer = new FakeDeployer(filename);

      fdm.registerDeployer(deployer);

      fdm.unregisterDeployer(deployer);

      fdm.registerDeployer(deployer);

      fdm.start();
      try
      {
         URL expected = file.toURI().toURL();
         URL deployedUrl = deployer.deployedUrl;
         Assert.assertTrue(expected.toString().equalsIgnoreCase(deployedUrl.toString()));
         deployer.deployedUrl = null;
         fdm.start();
         Assert.assertNull(deployer.deployedUrl);
         fdm.stop();

      }
      finally
      {
         file.delete();
View Full Code Here

      }
   }

   private void testStartStop2(final String filename) throws Exception
   {
      FileDeploymentManager fdm = new FileDeploymentManager(Long.MAX_VALUE);

      FileDeploymentManagerTest.log.debug("Filename is " + filename);

      File file = new File("tests/tmpfiles/" + filename);

      FileDeploymentManagerTest.log.debug(file.getAbsoluteFile());

      file.createNewFile();

      FakeDeployer deployer = new FakeDeployer(filename);

      fdm.start();

      try
      {
         fdm.registerDeployer(deployer);
         URL expected = file.toURI().toURL();
         URL deployedUrl = deployer.deployedUrl;
         Assert.assertTrue(expected.toString().equalsIgnoreCase(deployedUrl.toString()));
         deployer.deployedUrl = null;
         fdm.start();
         Assert.assertNull(deployer.deployedUrl);
         fdm.stop();
      }
      finally
      {
         file.delete();
      }
View Full Code Here

      }
   }

   public void testRegisterUnregister() throws Exception
   {
      FileDeploymentManager fdm = new FileDeploymentManager(Long.MAX_VALUE);

      fdm.start();

      String filename1 = "fdm_test_file.xml1";
      String filename2 = "fdm_test_file.xml2";
      String filename3 = "fdm_test_file.xml3";

      File file1 = new File("tests/tmpfiles/" + filename1);
      File file2 = new File("tests/tmpfiles/" + filename2);
      File file3 = new File("tests/tmpfiles/" + filename3);

      file1.createNewFile();
      file2.createNewFile();
      file3.createNewFile();

      FakeDeployer deployer1 = new FakeDeployer(filename1);
      FakeDeployer deployer2 = new FakeDeployer(filename2);
      FakeDeployer deployer3 = new FakeDeployer(filename3);
      FakeDeployer deployer4 = new FakeDeployer(filename3); // Can have multiple deployers on the same file
      try
      {
         URL url1 = file1.toURI().toURL();
         deployer1.deploy(url1);

         URL url2 = file2.toURI().toURL();
         deployer2.deploy(url2);

         URL url3 = file3.toURI().toURL();
         deployer3.deploy(url3);

         deployer4.deploy(url3);

         fdm.registerDeployer(deployer1);
         fdm.registerDeployer(deployer2);
         fdm.registerDeployer(deployer3);
         fdm.registerDeployer(deployer4);

         Assert.assertEquals(4, fdm.getDeployers().size());
         Assert.assertTrue(fdm.getDeployers().contains(deployer1));
         Assert.assertTrue(fdm.getDeployers().contains(deployer2));
         Assert.assertTrue(fdm.getDeployers().contains(deployer3));
         Assert.assertTrue(fdm.getDeployers().contains(deployer4));
         Assert.assertEquals(4, fdm.getDeployed().size());

         Assert.assertEquals(file1.toURI().toURL(), deployer1.deployedUrl);
         Assert.assertEquals(file2.toURI().toURL(), deployer2.deployedUrl);
         Assert.assertEquals(file3.toURI().toURL(), deployer3.deployedUrl);
         Assert.assertEquals(file3.toURI().toURL(), deployer4.deployedUrl);
         // Registering same again should do nothing

         fdm.registerDeployer(deployer1);

         Assert.assertEquals(4, fdm.getDeployers().size());
         Assert.assertTrue(fdm.getDeployers().contains(deployer1));
         Assert.assertTrue(fdm.getDeployers().contains(deployer2));
         Assert.assertTrue(fdm.getDeployers().contains(deployer3));
         Assert.assertTrue(fdm.getDeployers().contains(deployer4));
         Assert.assertEquals(4, fdm.getDeployed().size());

         fdm.unregisterDeployer(deployer1);

         Assert.assertEquals(3, fdm.getDeployers().size());
         Assert.assertTrue(fdm.getDeployers().contains(deployer2));
         Assert.assertTrue(fdm.getDeployers().contains(deployer3));
         Assert.assertTrue(fdm.getDeployers().contains(deployer4));
         Assert.assertEquals(3, fdm.getDeployed().size());

         fdm.unregisterDeployer(deployer2);
         fdm.unregisterDeployer(deployer3);

         Assert.assertEquals(1, fdm.getDeployers().size());
         Assert.assertTrue(fdm.getDeployers().contains(deployer4));
         Assert.assertEquals(1, fdm.getDeployed().size());

         fdm.unregisterDeployer(deployer4);

         Assert.assertEquals(0, fdm.getDeployers().size());
         Assert.assertEquals(0, fdm.getDeployed().size());

         // Now unregister again - should do nothing

         fdm.unregisterDeployer(deployer1);

         Assert.assertEquals(0, fdm.getDeployers().size());
         Assert.assertEquals(0, fdm.getDeployed().size());
      }
      finally
      {
         file1.delete();
         file2.delete();
         file3.delete();
      }

      fdm.stop();
   }
View Full Code Here

      fdm.stop();
   }

   public void testRedeploy() throws Exception
   {
      FileDeploymentManager fdm = new FileDeploymentManager(Long.MAX_VALUE);

      fdm.start();

      String filename = "fdm_test_file.xml1";

      File file = new File("tests/tmpfiles/" + filename);

      file.createNewFile();
      long oldLastModified = file.lastModified();

      FakeDeployer deployer = new FakeDeployer(filename);
      try
      {
         URL url = file.toURI().toURL();
         deployer.deploy(url);

         fdm.registerDeployer(deployer);
         Assert.assertEquals(file.toURI().toURL(), deployer.deployedUrl);
         // Touch the file
         file.setLastModified(oldLastModified + 1000);

         deployer.redeploy(url);

         fdm.run();

         Assert.assertEquals(1, fdm.getDeployers().size());
         Assert.assertTrue(fdm.getDeployers().contains(deployer));
         Assert.assertEquals(1, fdm.getDeployed().size());
         URL expected = file.toURI().toURL();
         URL deployedUrl = deployer.deployedUrl;
         Assert.assertTrue(expected.toString().equalsIgnoreCase(deployedUrl.toString()));
         Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url, deployer);
         Assert.assertEquals(oldLastModified + 1000, fdm.getDeployed().get(pair).lastModified);
         deployer.reDeployedUrl = null;
         // Scanning again should not redeploy

         fdm.run();

         Assert.assertEquals(oldLastModified + 1000, fdm.getDeployed().get(pair).lastModified);
         Assert.assertNull(deployer.reDeployedUrl);
      }
      finally
      {
         file.delete();
         fdm.stop();
      }
   }
View Full Code Here

      }
   }

   public void testUndeployAndDeployAgain() throws Exception
   {
      FileDeploymentManager fdm = new FileDeploymentManager(Long.MAX_VALUE);

      fdm.start();

      String filename = "fdm_test_file.xml1";

      File file = new File("tests/tmpfiles/" + filename);

      file.createNewFile();

      FakeDeployer deployer = new FakeDeployer(filename);
      try
      {
         URL url = file.toURI().toURL();
         deployer.deploy(url);

         fdm.registerDeployer(deployer);

         Assert.assertEquals(1, fdm.getDeployers().size());
         Assert.assertTrue(fdm.getDeployers().contains(deployer));
         Assert.assertEquals(1, fdm.getDeployed().size());
         Assert.assertEquals(file.toURI().toURL(), deployer.deployedUrl);
         deployer.deployedUrl = null;
         file.delete();

         // This should cause undeployment

         deployer.undeploy(url);
         Assert.assertEquals(file.toURI().toURL(), deployer.unDeployedUrl);

         fdm.run();

         Assert.assertEquals(1, fdm.getDeployers().size());
         Assert.assertTrue(fdm.getDeployers().contains(deployer));
         Assert.assertEquals(0, fdm.getDeployed().size());

         // Recreate file and it should be redeployed

         file.createNewFile();

         deployer.deploy(url);

         fdm.run();

         Assert.assertEquals(1, fdm.getDeployers().size());
         Assert.assertTrue(fdm.getDeployers().contains(deployer));
         Assert.assertEquals(1, fdm.getDeployed().size());

         Assert.assertEquals(file.toURI().toURL(), deployer.deployedUrl);
      }
      finally
      {
         file.delete();
         fdm.stop();
      }
   }
View Full Code Here

   protected void setUp() throws Exception
   {
      super.setUp();

      server = createServer(true);
      DeploymentManager deploymentManager = new FileDeploymentManager(500);
      deployer = new QueueDeployer(deploymentManager, server);
      server.start();
   }
View Full Code Here

         if (!contextSet)
            context = new InitialContext();
         registry = new JndiBindingRegistry(context);
      }

      deploymentManager = new FileDeploymentManager(server.getConfiguration().getFileDeployerScanPeriod());

      server.registerActivateCallback(this);

      server.start();
View Full Code Here

TOP

Related Classes of org.hornetq.core.deployers.impl.FileDeploymentManager

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.