Author: richard.opalka(a)jboss.com
Date: 2011-02-04 04:56:48 -0500 (Fri, 04 Feb 2011)
New Revision: 13667
Added:
common/trunk/src/main/java/org/jboss/wsf/test/DeployerJBoss6.java
Removed:
common/trunk/src/main/java/org/jboss/wsf/test/TestDeployer.java
common/trunk/src/main/java/org/jboss/wsf/test/TestDeployerJBoss.java
Modified:
common/trunk/pom.xml
common/trunk/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java
common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
Log:
[JBWS-3207] introducing remote Deployer SPI interface - providing default implementation
for AS6 + refactoring
Modified: common/trunk/pom.xml
===================================================================
--- common/trunk/pom.xml 2011-02-04 09:53:42 UTC (rev 13666)
+++ common/trunk/pom.xml 2011-02-04 09:56:48 UTC (rev 13667)
@@ -15,7 +15,7 @@
<parent>
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-parent</artifactId>
- <version>1.0.9.GA</version>
+ <version>1.0.10-SNAPSHOT</version>
</parent>
<!-- Source Control Management -->
Modified: common/trunk/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java 2011-02-04
09:53:42 UTC (rev 13666)
+++ common/trunk/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java 2011-02-04
09:56:48 UTC (rev 13667)
@@ -21,6 +21,7 @@
*/
package org.jboss.wsf.framework;
+import org.jboss.wsf.spi.deployer.Deployer;
import org.jboss.wsf.framework.deployment.DefaultDeploymentAspectManagerFactory;
import org.jboss.wsf.framework.deployment.DefaultDeploymentModelFactory;
import org.jboss.wsf.framework.deployment.DefaultLifecycleHandlerFactory;
@@ -42,6 +43,7 @@
import org.jboss.wsf.spi.management.JMSEndpointResolver;
import org.jboss.wsf.spi.serviceref.ServiceRefHandlerFactory;
import org.jboss.wsf.spi.util.ServiceLoader;
+import org.jboss.wsf.test.DeployerJBoss6;
/**
* @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
@@ -62,7 +64,7 @@
{
returnType = loadService(spiType, DefaultDeploymentAspectManagerFactory.class);
}
- if (DeploymentModelFactory.class.equals(spiType))
+ else if (DeploymentModelFactory.class.equals(spiType))
{
returnType = loadService(spiType, DefaultDeploymentModelFactory.class);
}
@@ -90,6 +92,10 @@
{
returnType = loadService(spiType, DefaultEndpointRegistryFactory.class);
}
+ else if (Deployer.class.equals(spiType))
+ {
+ returnType = loadService(spiType, DeployerJBoss6.class);
+ }
else if (JMSEndpointResolver.class.equals(spiType))
{
returnType = loadService(spiType, DefaultJMSEndpointResolver.class);
Added: common/trunk/src/main/java/org/jboss/wsf/test/DeployerJBoss6.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/DeployerJBoss6.java
(rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/test/DeployerJBoss6.java 2011-02-04 09:56:48
UTC (rev 13667)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.wsf.test;
+
+import java.net.URL;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import org.jboss.wsf.spi.deployer.Deployer;
+
+/**
+ * A JBossWS test helper that deals with test deployment/undeployment, etc.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class DeployerJBoss6 implements Deployer
+{
+
+ private static final String MAIN_DEPLOYER =
"jboss.system:service=MainDeployer";
+
+ private MBeanServerConnection server;
+
+ public DeployerJBoss6()
+ {
+ this.server = JBossWSTestHelper.getServer();
+ }
+
+ public void deploy(final URL url) throws Exception
+ {
+ invokeMainDeployer("deploy", url);
+ }
+
+ public void undeploy(final URL url) throws Exception
+ {
+ invokeMainDeployer("undeploy", url);
+ }
+
+ private void invokeMainDeployer(final String methodName, final URL url) throws
Exception
+ {
+ server.invoke(new ObjectName(MAIN_DEPLOYER), methodName, new Object[]
+ {url}, new String[]
+ {"java.net.URL"});
+ }
+
+}
Modified: common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2011-02-04
09:53:42 UTC (rev 13666)
+++ common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2011-02-04
09:56:48 UTC (rev 13667)
@@ -40,6 +40,10 @@
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.wsf.common.ObjectNameFactory;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployer.Deployer;
+import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
/**
* A JBossWS test helper that deals with test deployment/undeployment, etc.
@@ -54,6 +58,7 @@
private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY =
"test.archive.directory";
private static final String SYSPROP_TEST_RESOURCES_DIRECTORY =
"test.resources.directory";
private static final boolean DEPLOY_PROCESS_ENABLED =
!Boolean.getBoolean("test.disable.deployment");
+ private static final Deployer DEPLOYER;
private static MBeanServerConnection server;
private static String integrationTarget;
@@ -62,6 +67,12 @@
private static String implVersion;
private static String testArchiveDir;
private static String testResourcesDir;
+
+ static
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ DEPLOYER = spiProvider.getSPI(Deployer.class);
+ }
/** Deploy the given archive
*/
@@ -70,7 +81,7 @@
if ( DEPLOY_PROCESS_ENABLED )
{
URL archiveURL = getArchiveFile(archive).toURI().toURL();
- getDeployer().deploy(archiveURL);
+ DEPLOYER.deploy(archiveURL);
}
}
@@ -81,7 +92,7 @@
if ( DEPLOY_PROCESS_ENABLED )
{
URL archiveURL = getArchiveFile(archive).toURI().toURL();
- getDeployer().undeploy(archiveURL);
+ DEPLOYER.undeploy(archiveURL);
}
}
@@ -221,11 +232,6 @@
return server;
}
- private static TestDeployer getDeployer()
- {
- return new TestDeployerJBoss(getServer());
- }
-
public static String getIntegrationTarget()
{
if (integrationTarget == null)
Deleted: common/trunk/src/main/java/org/jboss/wsf/test/TestDeployer.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/TestDeployer.java 2011-02-04 09:53:42
UTC (rev 13666)
+++ common/trunk/src/main/java/org/jboss/wsf/test/TestDeployer.java 2011-02-04 09:56:48
UTC (rev 13667)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.wsf.test;
-
-import java.net.URL;
-
-/**
- * WS test deployer
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 16-May-2006
- */
-public interface TestDeployer
-{
- /** Deploy the given archive
- */
- void deploy(URL archive) throws Exception;
-
- /** Undeploy the given archive
- */
- void undeploy(URL archive) throws Exception;
-}
Deleted: common/trunk/src/main/java/org/jboss/wsf/test/TestDeployerJBoss.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/TestDeployerJBoss.java 2011-02-04
09:53:42 UTC (rev 13666)
+++ common/trunk/src/main/java/org/jboss/wsf/test/TestDeployerJBoss.java 2011-02-04
09:56:48 UTC (rev 13667)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.wsf.test;
-
-import java.io.Serializable;
-import java.net.URL;
-import java.security.Principal;
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-
-import org.jboss.wsf.spi.invocation.SecurityAdaptor;
-import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-
-/**
- * A JBossWS test helper that deals with test deployment/undeployment, etc.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-Oct-2004
- */
-public class TestDeployerJBoss implements TestDeployer
-{
- private static final String MAIN_DEPLOYER =
"jboss.system:service=MainDeployer";
-
- private MBeanServerConnection server;
- private String username;
- private String password;
-
- public TestDeployerJBoss(MBeanServerConnection server)
- {
- this.server = server;
-
- username = System.getProperty("jmx.authentication.username");
- if ("${jmx.authentication.username}".equals(username))
- username = null;
-
- password = System.getProperty("jmx.authentication.password");
- if ("${jmx.authentication.password}".equals(password))
- password = null;
- }
-
- public void deploy(URL url) throws Exception
- {
- invokeMainDeployer("deploy", url);
- }
-
- public void undeploy(URL url) throws Exception
- {
- invokeMainDeployer("undeploy", url);
- }
-
- private void invokeMainDeployer(String methodName, URL url) throws Exception
- {
- Principal prevUsername = null;
- Object prevPassword = null;
-
- SecurityAdaptor securityAdaptor = null;
- if (username != null || password != null)
- {
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- securityAdaptor =
spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
-
- prevUsername = securityAdaptor.getPrincipal();
- prevPassword = securityAdaptor.getCredential();
- securityAdaptor.setPrincipal(new SimplePrincipal(username));
- securityAdaptor.setCredential(password);
- }
-
- try
- {
- server.invoke(new ObjectName(MAIN_DEPLOYER), methodName, new Object[] { url },
new String[] { "java.net.URL" });
- }
- finally
- {
- if (username != null || password != null)
- {
- securityAdaptor.setPrincipal(prevUsername);
- securityAdaptor.setCredential(prevPassword);
- }
- }
- }
-
- @SuppressWarnings("serial")
- public static class SimplePrincipal implements Principal, Serializable
- {
- private String name;
-
- public SimplePrincipal(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
- }
-}