Author: borges
Date: 2012-01-12 07:09:19 -0500 (Thu, 12 Jan 2012)
New Revision: 12013
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/Deployer.java
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/AddressSettingsDeployer.java
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/FileDeploymentManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/XMLDeployerTest.java
Log:
Use URI instead of URL: URL.(equals|hashCode) require internet access.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/Deployer.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/Deployer.java 2012-01-12
12:08:26 UTC (rev 12012)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/Deployer.java 2012-01-12
12:09:19 UTC (rev 12013)
@@ -13,7 +13,7 @@
package org.hornetq.core.deployers;
-import java.net.URL;
+import java.net.URI;
import org.hornetq.core.server.HornetQComponent;
@@ -33,24 +33,22 @@
/**
* Deploy the URL for the first time
- *
- * @param url The resource todeploy
+ * @param uri The resource todeploy
* @throws Exception .
*/
- void deploy(URL url) throws Exception;
+ void deploy(URI uri) throws Exception;
/**
* Redeploys a URL if changed
- *
- * @param url The resource to redeploy
+ * @param uri The resource to redeploy
* @throws Exception .
*/
- void redeploy(URL url) throws Exception;
+ void redeploy(URI uri) throws Exception;
/**
* Undeploys a resource that has been removed
- * @param url The Resource that was deleted
+ * @param uri The Resource that was deleted
* @throws Exception .
*/
- void undeploy(URL url) throws Exception;
+ void undeploy(URI uri) throws Exception;
}
\ No newline at end of file
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/AddressSettingsDeployer.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/AddressSettingsDeployer.java 2012-01-12
12:08:26 UTC (rev 12012)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/AddressSettingsDeployer.java 2012-01-12
12:09:19 UTC (rev 12013)
@@ -29,7 +29,7 @@
private static final Logger log = Logger.getLogger(AddressSettingsDeployer.class);
private final HierarchicalRepository<AddressSettings>
addressSettingsRepository;
-
+
private final FileConfigurationParser parser = new FileConfigurationParser();
public AddressSettingsDeployer(final DeploymentManager deploymentManager,
@@ -41,7 +41,7 @@
/**
* the names of the elements to deploy
- * @return the names of the elements todeploy
+ * @return the names of the elements to deploy
*/
@Override
public String[] getElementTagName()
@@ -63,7 +63,7 @@
@Override
public void deploy(final Node node) throws Exception
{
-
+
Pair<String, AddressSettings> setting = parser.parseAddressSettings(node);
addressSettingsRepository.addMatch(setting.getA(), setting.getB());
@@ -76,7 +76,7 @@
}
/**
- * undeploys an element
+ * Undeploys an element.
* @param node the element to undeploy
* @throws Exception .
*/
@@ -89,7 +89,7 @@
}
/**
- * the key attribute for theelement, usually 'name' but can be overridden
+ * the key attribute for the element, usually 'name' but can be overridden
* @return the key attribute
*/
@Override
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/FileDeploymentManager.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/FileDeploymentManager.java 2012-01-12
12:08:26 UTC (rev 12012)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/FileDeploymentManager.java 2012-01-12
12:09:19 UTC (rev 12013)
@@ -16,6 +16,9 @@
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
@@ -43,7 +46,7 @@
private final List<Deployer> deployers = new ArrayList<Deployer>();
- private final Map<Pair<URL, Deployer>, DeployInfo> deployed = new
HashMap<Pair<URL, Deployer>, DeployInfo>();
+ private final Map<Pair<URI, Deployer>, DeployInfo> deployed = new
HashMap<Pair<URI, Deployer>, DeployInfo>();
private ScheduledExecutorService scheduler;
@@ -122,28 +125,29 @@
while (urls.hasMoreElements())
{
- URL url = urls.nextElement();
+ URI uri = urls.nextElement().toURI();
- FileDeploymentManager.log.debug("Got url " + url);
+ FileDeploymentManager.log.debug("Got URI " + uri);
try
{
- FileDeploymentManager.log.debug("Deploying " + url + "
for " + deployer.getClass().getSimpleName());
- deployer.deploy(url);
+ FileDeploymentManager.log.debug("Deploying " + uri + "
for " + deployer.getClass().getSimpleName());
+ deployer.deploy(uri);
}
catch (Exception e)
{
- FileDeploymentManager.log.error("Error deploying " + url,
e);
+ FileDeploymentManager.log.error("Error deploying " + uri,
e);
}
- Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url,
deployer);
+ Pair<URI, Deployer> pair = new Pair<URI, Deployer>(uri,
deployer);
- deployed.put(pair, new DeployInfo(deployer,
getFileFromURL(url).lastModified()));
+ deployed.put(pair, new DeployInfo(deployer,
getFileFromURI(uri).lastModified()));
}
}
}
}
+ @Override
public synchronized void unregisterDeployer(final Deployer deployer) throws Exception
{
if (deployers.remove(deployer))
@@ -154,9 +158,9 @@
Enumeration<URL> urls =
Thread.currentThread().getContextClassLoader().getResources(filename);
while (urls.hasMoreElements())
{
- URL url = urls.nextElement();
+ URI url = urls.nextElement().toURI();
- Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url,
deployer);
+ Pair<URI, Deployer> pair = new Pair<URI, Deployer>(url,
deployer);
deployed.remove(pair);
}
@@ -164,9 +168,9 @@
}
}
- private File getFileFromURL(final URL url) throws UnsupportedEncodingException
+ private File getFileFromURI(final URI uri) throws MalformedURLException,
UnsupportedEncodingException
{
- return new File(URLDecoder.decode(url.getFile(), "UTF-8"));
+ return new File(URLDecoder.decode(uri.toURL().getFile(), "UTF-8"));
}
/**
@@ -192,62 +196,74 @@
while (urls.hasMoreElements())
{
URL url = urls.nextElement();
+ URI uri;
+ try
+ {
+ uri = url.toURI();
+ } catch (URISyntaxException e) {
+ log.error("Error deploying " + url + ": " +
e.getMessage(), e);
+ continue;
+ }
- Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url,
deployer);
+ Pair<URI, Deployer> pair = new Pair<URI, Deployer>(uri,
deployer);
DeployInfo info = deployed.get(pair);
- long newLastModified = getFileFromURL(url).lastModified();
+ long newLastModified = getFileFromURI(uri).lastModified();
if (info == null)
{
try
{
- deployer.deploy(url);
+ deployer.deploy(uri);
- deployed.put(pair, new DeployInfo(deployer,
getFileFromURL(url).lastModified()));
+ deployed.put(pair, new DeployInfo(deployer,
getFileFromURI(uri).lastModified()));
}
catch (Exception e)
{
- FileDeploymentManager.log.error("Error deploying " +
url, e);
+ FileDeploymentManager.log.error("Error deploying " +
uri, e);
}
}
else if (newLastModified > info.lastModified)
{
try
{
- deployer.redeploy(url);
+ deployer.redeploy(uri);
- deployed.put(pair, new DeployInfo(deployer,
getFileFromURL(url).lastModified()));
+ deployed.put(pair, new DeployInfo(deployer,
getFileFromURI(uri).lastModified()));
}
catch (Exception e)
{
- FileDeploymentManager.log.error("Error redeploying " +
url, e);
+ FileDeploymentManager.log.error("Error redeploying " +
uri, e);
}
}
}
}
}
- List<Pair<URL, Deployer>> toRemove = new ArrayList<Pair<URL,
Deployer>>();
- for (Map.Entry<Pair<URL, Deployer>, DeployInfo> entry :
deployed.entrySet())
+ List<Pair<URI, Deployer>> toRemove = new ArrayList<Pair<URI,
Deployer>>();
+ for (Map.Entry<Pair<URI, Deployer>, DeployInfo> entry :
deployed.entrySet())
{
- Pair<URL, Deployer> pair = entry.getKey();
- if (!fileExists(pair.getA()))
+ Pair<URI, Deployer> pair = entry.getKey();
+ try
{
- try
+ if (!fileExists(pair.getA()))
{
Deployer deployer = entry.getValue().deployer;
FileDeploymentManager.log.debug("Undeploying " + deployer +
" with url " + pair.getA());
deployer.undeploy(pair.getA());
toRemove.add(pair);
}
- catch (Exception e)
- {
- FileDeploymentManager.log.error("Error undeploying " +
pair.getA(), e);
- }
}
+ catch (URISyntaxException e)
+ {
+ FileDeploymentManager.log.error("Error undeploying " +
pair.getA() + ": " + e.getMessage(), e);
+ }
+ catch (Exception e)
+ {
+ FileDeploymentManager.log.error("Error undeploying " +
pair.getA(), e);
+ }
}
- for (Pair<URL, Deployer> pair : toRemove)
+ for (Pair<URI, Deployer> pair : toRemove)
{
deployed.remove(pair);
}
@@ -263,7 +279,7 @@
return deployers;
}
- public synchronized Map<Pair<URL, Deployer>, DeployInfo> getDeployed()
+ public synchronized Map<Pair<URI, Deployer>, DeployInfo> getDeployed()
{
return deployed;
}
@@ -271,22 +287,25 @@
// Private -------------------------------------------------------
/**
- * Checks if the URL is among the current thread context class loader's
resources.
- *
- * We do not check that the corresponding file exists using File.exists() directly as
it would fail
- * in the case the resource is loaded from inside an EAR file (see
https://jira.jboss.org/jira/browse/HORNETQ-122)
+ * Checks if the URI is among the current thread context class loader's
resources.
+ * <p>
+ * We do not check that the corresponding file exists using File.exists() directly as
it would
+ * fail in the case the resource is loaded from inside an EAR file (see
+ *
https://jira.jboss.org/jira/browse/HORNETQ-122)
+ * @throws URISyntaxException
*/
- private boolean fileExists(final URL resourceURL)
+ private boolean fileExists(final URI resourceURI) throws URISyntaxException
{
try
{
- File f = getFileFromURL(resourceURL); // this was the orginal line, which doesnt
work for File-URLs with white
- // spaces: File f = new File(resourceURL.getPath());
+ File f = getFileFromURI(resourceURI); // this was the original line, which
doesn't work for
+ // File-URLs with white spaces: File f =
new
+ // File(resourceURL.getPath());
Enumeration<URL> resources =
Thread.currentThread().getContextClassLoader().getResources(f.getName());
while (resources.hasMoreElements())
{
- URL url = resources.nextElement();
- if (url.equals(resourceURL))
+ URI url = resources.nextElement().toURI();
+ if (url.equals(resourceURI))
{
return true;
}
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java 2012-01-12
12:08:26 UTC (rev 12012)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java 2012-01-12
12:09:19 UTC (rev 12013)
@@ -15,7 +15,7 @@
import java.io.InputStreamReader;
import java.io.Reader;
-import java.net.URL;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -40,7 +40,7 @@
protected static final String NAME_ATTR = "name";
- private final Map<URL, Map<String, Node>> configuration = new
HashMap<URL, Map<String, Node>>();
+ private final Map<URI, Map<String, Node>> configuration = new
HashMap<URI, Map<String, Node>>();
private final DeploymentManager deploymentManager;
@@ -60,7 +60,7 @@
* @param name the name of the element
* @param e .
*/
- public synchronized void addToConfiguration(final URL url, final String name, final
Node e)
+ public synchronized void addToConfiguration(final URI url, final String name, final
Node e)
{
Map<String, Node> map = configuration.get(url);
if (map == null)
@@ -77,7 +77,8 @@
* @param url The resource to redeploy
* @throws Exception .
*/
- public synchronized void redeploy(final URL url) throws Exception
+ @Override
+ public synchronized void redeploy(final URI url) throws Exception
{
Element e = getRootElement(url);
List<String> added = new ArrayList<String>();
@@ -129,26 +130,27 @@
/**
* Undeploys a resource that has been removed
- * @param url The Resource that was deleted
+ * @param uri The Resource that was deleted
* @throws Exception .
*/
- public synchronized void undeploy(final URL url) throws Exception
+ @Override
+ public synchronized void undeploy(final URI uri) throws Exception
{
- Set<String> keys = configuration.get(url).keySet();
+ Set<String> keys = configuration.get(uri).keySet();
for (String key : keys)
{
- undeploy(configuration.get(url).get(key));
+ undeploy(configuration.get(uri).get(key));
}
- configuration.remove(url);
+ configuration.remove(uri);
}
/**
* Deploy the URL for the first time
- *
- * @param url The resource todeploy
+ * @param url The resource to deploy
* @throws Exception .
*/
- public synchronized void deploy(final URL url) throws Exception
+ @Override
+ public synchronized void deploy(final URI url) throws Exception
{
Element e = getRootElement(url);
@@ -271,7 +273,7 @@
public abstract void deploy(final Node node) throws Exception;
/**
- * Validate the DOM
+ * Validate the DOM
*/
public abstract void validate(final Node rootNode) throws Exception;
@@ -282,15 +284,15 @@
*/
public abstract void undeploy(final Node node) throws Exception;
- protected Element getRootElement(final URL url) throws Exception
+ protected Element getRootElement(final URI url) throws Exception
{
- Reader reader = new InputStreamReader(url.openStream());
+ Reader reader = new InputStreamReader(url.toURL().openStream());
String xml = org.hornetq.utils.XMLUtil.readerToString(reader);
xml = org.hornetq.utils.XMLUtil.replaceSystemProps(xml);
return org.hornetq.utils.XMLUtil.stringToElement(xml);
}
- private boolean hasNodeChanged(final URL url, final Node child, final String name)
+ private boolean hasNodeChanged(final URI url, final Node child, final String name)
{
String newTextContent = child.getTextContent();
String origTextContent = configuration.get(url).get(name).getTextContent();
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java 2012-01-12
12:08:26 UTC (rev 12012)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java 2012-01-12
12:09:19 UTC (rev 12013)
@@ -13,7 +13,7 @@
package org.hornetq.tests.integration.jms.server;
-import java.net.URL;
+import java.net.URI;
import javax.jms.Queue;
import javax.jms.Topic;
@@ -24,7 +24,6 @@
import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.deployers.impl.FileDeploymentManager;
import org.hornetq.core.logging.Logger;
@@ -161,7 +160,7 @@
JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager);
String conf = "hornetq-jms-for-JMSServerDeployerTest.xml";
- URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);
+ URI confURL =
Thread.currentThread().getContextClassLoader().getResource(conf).toURI();
String[] connectionFactoryBindings = new String[] {
"/fullConfigurationConnectionFactory",
"/acme/fullConfigurationConnectionFactory",
@@ -240,13 +239,13 @@
Assert.assertEquals("fullConfigurationTopic", topic.getTopicName());
}
}
-
+
public void testDeployFullConfiguration2() throws Exception
{
JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager);
String conf = "hornetq-jms-for-JMSServerDeployerTest2.xml";
- URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);
+ URI confURL =
Thread.currentThread().getContextClassLoader().getResource(conf).toURI();
String[] connectionFactoryBindings = new String[] {
"/fullConfigurationConnectionFactory",
"/acme/fullConfigurationConnectionFactory",
@@ -338,7 +337,7 @@
config = createBasicConfig();
config.getConnectorConfigurations().put("netty",
new
TransportConfiguration(NettyConnectorFactory.class.getName()));
-
+
DiscoveryGroupConfiguration dcg = new
DiscoveryGroupConfiguration("mygroup", "172.16.8.10",
"243.7.7.7", 12345,
5432, 5432);
Modified:
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java
===================================================================
---
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java 2012-01-12
12:08:26 UTC (rev 12012)
+++
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java 2012-01-12
12:09:19 UTC (rev 12013)
@@ -14,7 +14,7 @@
package org.hornetq.tests.unit.core.deployers.impl;
import java.io.File;
-import java.net.URL;
+import java.net.URI;
import junit.framework.Assert;
@@ -25,9 +25,9 @@
import org.hornetq.tests.util.UnitTestCase;
/**
- *
+ *
* A FileDeploymentManagerTest
- *
+ *
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*
*/
@@ -84,12 +84,12 @@
fdm.start();
try
{
- URL expected = file.toURI().toURL();
- URL deployedUrl = deployer.deployedUrl;
+ URI expected = file.toURI();
+ URI deployedUrl = deployer.deployedUri;
Assert.assertTrue(expected.toString().equalsIgnoreCase(deployedUrl.toString()));
- deployer.deployedUrl = null;
+ deployer.deployedUri = null;
fdm.start();
- Assert.assertNull(deployer.deployedUrl);
+ Assert.assertNull(deployer.deployedUri);
fdm.stop();
}
@@ -123,12 +123,12 @@
try
{
fdm.registerDeployer(deployer);
- URL expected = file.toURI().toURL();
- URL deployedUrl = deployer.deployedUrl;
+ URI expected = file.toURI();
+ URI deployedUrl = deployer.deployedUri;
Assert.assertTrue(expected.toString().equalsIgnoreCase(deployedUrl.toString()));
- deployer.deployedUrl = null;
+ deployer.deployedUri = null;
fdm.start();
- Assert.assertNull(deployer.deployedUrl);
+ Assert.assertNull(deployer.deployedUri);
fdm.stop();
}
finally
@@ -170,13 +170,13 @@
FakeDeployer deployer4 = new FakeDeployer(filename3); // Can have multiple
deployers on the same file
try
{
- URL url1 = file1.toURI().toURL();
+ URI url1 = file1.toURI();
deployer1.deploy(url1);
- URL url2 = file2.toURI().toURL();
+ URI url2 = file2.toURI();
deployer2.deploy(url2);
- URL url3 = file3.toURI().toURL();
+ URI url3 = file3.toURI();
deployer3.deploy(url3);
deployer4.deploy(url3);
@@ -193,10 +193,10 @@
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);
+ Assert.assertEquals(file1.toURI(), deployer1.deployedUri);
+ Assert.assertEquals(file2.toURI(), deployer2.deployedUri);
+ Assert.assertEquals(file3.toURI(), deployer3.deployedUri);
+ Assert.assertEquals(file3.toURI(), deployer4.deployedUri);
// Registering same again should do nothing
fdm.registerDeployer(deployer1);
@@ -265,11 +265,11 @@
FakeDeployer deployer = new FakeDeployer(filename);
try
{
- URL url = file.toURI().toURL();
+ URI url = file.toURI();
deployer.deploy(url);
fdm.registerDeployer(deployer);
- Assert.assertEquals(file.toURI().toURL(), deployer.deployedUrl);
+ Assert.assertEquals(file.toURI(), deployer.deployedUri);
// Touch the file
file.setLastModified(oldLastModified + 1000);
@@ -280,18 +280,18 @@
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;
+ URI expected = file.toURI();
+ URI deployedUrl = deployer.deployedUri;
Assert.assertTrue(expected.toString().equalsIgnoreCase(deployedUrl.toString()));
- Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url, deployer);
+ Pair<URI, Deployer> pair = new Pair<URI, Deployer>(url, deployer);
Assert.assertEquals(oldLastModified + 1000,
fdm.getDeployed().get(pair).lastModified);
- deployer.reDeployedUrl = null;
+ deployer.reDeployedUri = null;
// Scanning again should not redeploy
fdm.run();
Assert.assertEquals(oldLastModified + 1000,
fdm.getDeployed().get(pair).lastModified);
- Assert.assertNull(deployer.reDeployedUrl);
+ Assert.assertNull(deployer.reDeployedUri);
}
finally
{
@@ -319,22 +319,22 @@
FakeDeployer deployer = new FakeDeployer(filename);
try
{
- URL url = file.toURI().toURL();
- deployer.deploy(url);
+ URI uri = file.toURI();
+ deployer.deploy(uri);
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;
+ Assert.assertEquals(file.toURI(), deployer.deployedUri);
+ deployer.deployedUri = null;
file.delete();
// This should cause undeployment
- deployer.undeploy(url);
- Assert.assertEquals(file.toURI().toURL(), deployer.unDeployedUrl);
+ deployer.undeploy(uri);
+ Assert.assertEquals(file.toURI(), deployer.unDeployedUri);
fdm.run();
@@ -346,7 +346,7 @@
file.createNewFile();
- deployer.deploy(url);
+ deployer.deploy(uri);
fdm.run();
@@ -354,7 +354,7 @@
Assert.assertTrue(fdm.getDeployers().contains(deployer));
Assert.assertEquals(1, fdm.getDeployed().size());
- Assert.assertEquals(file.toURI().toURL(), deployer.deployedUrl);
+ Assert.assertEquals(file.toURI(), deployer.deployedUri);
}
finally
{
@@ -365,11 +365,11 @@
class FakeDeployer implements Deployer
{
- URL deployedUrl;
+ URI deployedUri;
- URL unDeployedUrl;
+ URI unDeployedUri;
- URL reDeployedUrl;
+ URI reDeployedUri;
boolean started;
@@ -385,31 +385,37 @@
return new String[] { file };
}
- public void deploy(final URL url) throws Exception
+ @Override
+ public void deploy(final URI url) throws Exception
{
- deployedUrl = url;
+ deployedUri = url;
}
- public void redeploy(final URL url) throws Exception
+ @Override
+ public void redeploy(final URI url) throws Exception
{
- reDeployedUrl = url;
+ reDeployedUri = url;
}
- public void undeploy(final URL url) throws Exception
+ @Override
+ public void undeploy(final URI url) throws Exception
{
- unDeployedUrl = url;
+ unDeployedUri = url;
}
+ @Override
public void start() throws Exception
{
started = true;
}
+ @Override
public void stop() throws Exception
{
started = false;
}
+ @Override
public boolean isStarted()
{
return started;
Modified:
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/XMLDeployerTest.java
===================================================================
---
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/XMLDeployerTest.java 2012-01-12
12:08:26 UTC (rev 12012)
+++
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/XMLDeployerTest.java 2012-01-12
12:09:19 UTC (rev 12013)
@@ -13,7 +13,7 @@
package org.hornetq.tests.unit.core.deployers.impl;
-import java.net.URL;
+import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
@@ -55,13 +55,13 @@
+ " <test
name=\"test6\">content6</test>\n"
+ "</configuration>";
- private URL url;
+ private URI url;
@Override
protected void setUp() throws Exception
{
super.setUp();
- url = new URL("http://localhost");
+ url = new URI("http://localhost");
}
public void testDeploy() throws Exception
@@ -248,7 +248,7 @@
}
@Override
- protected Element getRootElement(final URL url)
+ protected Element getRootElement(final URI url)
{
return element;
}