Author: dennyxu
Date: 2010-02-01 02:50:20 -0500 (Mon, 01 Feb 2010)
New Revision: 20041
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.classpath
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.project
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.jdt.core.prefs
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.wst.common.component
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.jboss.tools.esb.project.core.prefs
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/build/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/build/classes/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/esbcontent/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/esbcontent/META-INF/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/esbcontent/META-INF/jboss-esb.xml
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/esbcontent/jbm-queue-service.xml
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/src/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbp1/esbcontent/jbm-queue-service.xml
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectDeploymentTest.java
Removed:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbp1/src/jbm-queue-service.xml
Modified:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/META-INF/MANIFEST.MF
Log:
JBIDE-5572:Add unit tests for ESB
Modified: trunk/esb/tests/org.jboss.tools.esb.project.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.project.core.test/META-INF/MANIFEST.MF 2010-01-31
23:05:57 UTC (rev 20040)
+++ trunk/esb/tests/org.jboss.tools.esb.project.core.test/META-INF/MANIFEST.MF 2010-02-01
07:50:20 UTC (rev 20041)
@@ -5,3 +5,13 @@
Bundle-Version: 1.0.0
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.junit;bundle-version="3.8.2",
+ org.jboss.tools.esb.project.core;bundle-version="1.0.0",
+ org.eclipse.wst.common.project.facet.core;bundle-version="1.4.0",
+ org.eclipse.wst.server.core;bundle-version="1.1.101",
+ org.eclipse.core.resources;bundle-version="3.5.0",
+ org.eclipse.core.runtime;bundle-version="3.5.0",
+ org.jboss.tools.common.test;bundle-version="2.0.0",
+ org.eclipse.jdt.core;bundle-version="3.5.0",
+ org.jboss.ide.eclipse.as.core;bundle-version="1.0.0",
+ org.eclipse.jdt.launching;bundle-version="3.5.0"
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.classpath
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.classpath
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.classpath 2010-02-01
07:50:20 UTC (rev 20041)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_14">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.java"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.jboss.esb.runtime.classpath/server.supplied"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.project
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.project
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.project 2010-02-01
07:50:20 UTC (rev 20041)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>esbTestProject</name>
+ <comment></comment>
+ <projects>
+ <project>esbTestProject</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.jdt.core.prefs 2010-02-01
07:50:20 UTC (rev 20041)
@@ -0,0 +1,7 @@
+#Fri Jan 15 00:13:10 CST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.wst.common.component
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.wst.common.component
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.wst.common.component 2010-02-01
07:50:20 UTC (rev 20041)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="esbTestProject">
+ <wb-resource deploy-path="/"
source-path="/esbcontent"/>
+ <dependent-module deploy-path="/"
handle="module:/org.jboss.ide.eclipse.as.wtp.core.vcf.outputFolders/">
+ <dependency-type>consumes</dependency-type>
+ </dependent-module>
+ <property name="java-output-path"
value="build/classes"/>
+ </wb-module>
+</project-modules>
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.wst.common.project.facet.core.xml
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.eclipse.wst.common.project.facet.core.xml 2010-02-01
07:50:20 UTC (rev 20041)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <fixed facet="jst.java"/>
+ <fixed facet="jst.jboss.esb"/>
+ <installed facet="jst.java" version="6.0"/>
+ <installed facet="jst.jboss.esb" version="4.7"/>
+</faceted-project>
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.jboss.tools.esb.project.core.prefs
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.jboss.tools.esb.project.core.prefs
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/.settings/org.jboss.tools.esb.project.core.prefs 2010-02-01
07:50:20 UTC (rev 20041)
@@ -0,0 +1,3 @@
+#Fri Jan 15 00:13:10 CST 2010
+eclipse.preferences.version=1
+jboss.esb.project.project.version=2.0
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/esbcontent/META-INF/jboss-esb.xml
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/esbcontent/META-INF/jboss-esb.xml
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/esbcontent/META-INF/jboss-esb.xml 2010-02-01
07:50:20 UTC (rev 20041)
@@ -0,0 +1,3 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb
xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc...
parameterReloadSecs="5">
+</jbossesb>
\ No newline at end of file
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/esbcontent/jbm-queue-service.xml
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/esbcontent/jbm-queue-service.xml
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject/esbcontent/jbm-queue-service.xml 2010-02-01
07:50:20 UTC (rev 20041)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+
name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_Request_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends
optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+
name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_Request_gw"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends
optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Copied:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbp1/esbcontent/jbm-queue-service.xml
(from rev 19705,
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbp1/src/jbm-queue-service.xml)
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbp1/esbcontent/jbm-queue-service.xml
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbp1/esbcontent/jbm-queue-service.xml 2010-02-01
07:50:20 UTC (rev 20041)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+
name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_Request_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends
optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+
name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_Request_gw"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends
optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Deleted:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbp1/src/jbm-queue-service.xml
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbp1/src/jbm-queue-service.xml 2010-01-31
23:05:57 UTC (rev 20040)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbp1/src/jbm-queue-service.xml 2010-02-01
07:50:20 UTC (rev 20041)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
- <mbean code="org.jboss.jms.server.destination.QueueService"
-
name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_Request_esb"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends
optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
- <mbean code="org.jboss.jms.server.destination.QueueService"
-
name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_Request_gw"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends
optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
-</server>
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectDeploymentTest.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectDeploymentTest.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectDeploymentTest.java 2010-02-01
07:50:20 UTC (rev 20041)
@@ -0,0 +1,269 @@
+package org.jboss.tools.esb.project.core.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleType;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.internal.ModuleFactory;
+import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
+import org.eclipse.wst.server.core.internal.ServerPlugin;
+import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServer;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.tools.common.test.util.TestProjectProvider;
+import org.jboss.tools.esb.core.ESBProjectConstant;
+
+public class ESBProjectDeploymentTest extends TestCase {
+ public static final IVMInstall VM_INSTALL = JavaRuntime
+ .getDefaultVMInstall();
+
+ public static final String JBOSS_AS_42_HOME = System.getProperty(
+ "jbosstools.test.jboss.home.4.2",
+ "/home/fugang/jboss-all/jboss-soa-p.5.0.0/jboss-as");
+ public static final String JBOSS_AS_50_HOME = System.getProperty(
+ "jbosstools.test.jboss.home.5.0",
+ "/home/fugang/jboss-all/jboss-soa-p.5.0.0/jboss-as");
+ public static final String JBOSS_AS_51_HOME = System.getProperty(
+ "jbosstools.test.jboss.home.5.1",
+ "/home/fugang/jboss-all/jboss-5.1.0.GA");
+ public static final String SERVER_SOAP43_HOME = System.getProperty(
+ "jbosstools.test.soap.home.4.3",
+ "/home/fugang/jboss-all/jboss-soa-p.5.0.0") + "//jboss-as";
+ public static final String SERVER_SOAP50_HOME = System.getProperty(
+ "jbosstools.test.soap.home.5.0",
+ "/home/fugang/jboss-all/jboss-soa-p.5.0.0") + "//jboss-as";
+
+ static String BUNDLE = "org.jboss.tools.esb.project.core.test";
+ IProject project;
+
+ private IRuntime soap50_runtime;
+ private IRuntime currentRuntime;
+ private IServer currentServer;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ soap50_runtime = createRuntime(IJBossToolingConstants.EAP_50,
+ SERVER_SOAP50_HOME, "default");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ soap50_runtime.delete();
+ if (project != null) {
+ project.delete(true, null);
+ }
+
+ if (currentRuntime != null) {
+ currentRuntime.delete();
+ currentServer.delete();
+ }
+ }
+
+ public IProject createESBProject(String prjName) throws CoreException {
+ TestProjectProvider provider = new TestProjectProvider(BUNDLE,
+ "/projects/" + prjName, prjName, true);
+ IProject prj = provider.getProject();
+ IFacetedProject ifp = ProjectFacetsManager.create(prj);
+
+ org.eclipse.wst.common.project.facet.core.runtime.IRuntime fruntime = RuntimeManager
+ .getRuntime(IJBossToolingConstants.EAP_50);
+ ifp.addTargetedRuntime(fruntime, null);
+ ifp.setPrimaryRuntime(fruntime, null);
+ prj.build(IncrementalProjectBuilder.FULL_BUILD, null);
+
+ return prj;
+ }
+
+ public void testCheckModuleFactoryByESBFacet() throws CoreException {
+ project = createESBProject("esbTestProject");
+
+ Map<String, ModuleFactory> mpESBFactories = getAllAvailableESBModuleFactories();
+
+ IProjectFacet facets = ProjectFacetsManager
+ .getProjectFacet(ESBProjectConstant.ESB_PROJECT_FACET);
+ for (IProjectFacetVersion fv : facets.getVersions()) {
+ String version = fv.getVersionString();
+ ModuleFactory factory = mpESBFactories.get(version);
+ assertNotNull("There is no module factory for ESB " + version,
+ factory);
+
+ IModule[] modules = factory.getModules();
+
+ IModuleResource[] res = factory.getDelegate(null)
+ .getModuleDelegate(modules[0]).members();
+ assertEquals(
+ "Deployment logic is not correct for ESB"+ fv.getVersionString()+",
some artifacts were lost",
+ 3, res.length);
+ }
+
+ }
+
+ public void testSOAP50Deployment() throws Exception {
+ testESBDeployment(IJBossToolingConstants.EAP_50,
+ IJBossToolingConstants.SERVER_EAP_50, SERVER_SOAP50_HOME);
+ }
+
+ public void testSOAP43Deployment() throws Exception {
+ testESBDeployment(IJBossToolingConstants.EAP_43,
+ IJBossToolingConstants.SERVER_EAP_43, SERVER_SOAP43_HOME);
+ }
+
+ public void testJBossServer50Deployment() throws Exception {
+ testESBDeployment(IJBossToolingConstants.AS_50,
+ IJBossToolingConstants.SERVER_AS_50, JBOSS_AS_50_HOME);
+ }
+
+ public void testJbossServer51Deployment() throws Exception {
+ testESBDeployment(IJBossToolingConstants.AS_51,
+ IJBossToolingConstants.SERVER_AS_51, JBOSS_AS_51_HOME);
+ }
+
+ public void testJbossServer42Deployment() throws Exception {
+ testESBDeployment(IJBossToolingConstants.AS_42,
+ IJBossToolingConstants.SERVER_AS_42, JBOSS_AS_42_HOME);
+ }
+
+ private void testESBDeployment(String runtimeId, String serverid,
+ String serverHome) throws Exception {
+ File archive = null;
+ try {
+ createServer(runtimeId, serverid, serverHome, "default");
+ project = createESBProject("esbTestProject");
+ publishESBProject();
+
+ // check deployment result
+ IPath serverPath = new Path(serverHome);
+ serverPath.append("server").append("default").append("deploy");
+ serverPath.append("esbTestProject.esb");
+ archive = serverPath.toFile();
+ assertTrue("Deploy failed, nothing was deployed to server", archive
+ .exists());
+
+ if (archive.isDirectory()) {
+ serverPath.append("META-INF");
+ assertTrue(
+ "generated a wrong ESB archive, no META-INF in the archive",
+ serverPath.toFile().exists());
+
+ serverPath.removeLastSegments(1);
+ serverPath
+ .append("org\\jboss\\soa\\esb\\samples\\quickstart\\helloworld");
+ serverPath.append("MyJMSListenerAction.class");
+ assertTrue("no class was pick up into the archive", serverPath
+ .toFile().exists());
+ }
+ else{
+ ZipFile azip = new ZipFile(archive);
+ ZipEntry entry = azip.getEntry("META-INF");
+ assertNotNull("generated a wrong ESB archive, no META-INF in the archive",
entry);
+ entry = azip.getEntry("org");
+ assertNotNull("there is no class in the esb archive", entry);
+
+ }
+ } finally {
+ if (archive != null) {
+ archive.delete();
+ }
+ }
+ }
+
+ protected void publishESBProject() throws CoreException {
+ IModule[] modules = ServerUtil.getModules(currentServer.getServerType()
+ .getRuntimeType().getModuleTypes());
+ IServerWorkingCopy serverWC = currentServer.createWorkingCopy();
+ serverWC.modifyModules(modules, null, null);
+ serverWC.save(true, null).publish(0, null);
+ currentServer.publish(IServer.PUBLISH_FULL, null);
+
+ }
+
+
+ private Map<String, ModuleFactory> getAllAvailableESBModuleFactories() {
+ Map<String, ModuleFactory> mpFactory = new HashMap<String,
ModuleFactory>();
+ for (ModuleFactory factory : ServerPlugin.getModuleFactories()) {
+ for (IModuleType type : factory.getModuleTypes()) {
+ if (type.getId().equals(ESBProjectConstant.ESB_PROJECT_FACET)) {
+ mpFactory.put(type.getVersion(), factory);
+ }
+ }
+ }
+
+ return mpFactory;
+ }
+
+ private IRuntime createRuntime(String runtimeId, String homeDir,
+ String config) throws CoreException {
+ IRuntimeType[] runtimeTypes = ServerUtil.getRuntimeTypes(null, null,
+ runtimeId);
+ assertEquals("expects only one runtime type", runtimeTypes.length, 1);
+ IRuntimeType runtimeType = runtimeTypes[0];
+ IRuntimeWorkingCopy runtimeWC = runtimeType.createRuntime(null,
+ new NullProgressMonitor());
+ runtimeWC.setName(runtimeId);
+ runtimeWC.setLocation(new Path(homeDir));
+ ((RuntimeWorkingCopy) runtimeWC).setAttribute(
+ IJBossServerRuntime.PROPERTY_VM_ID, VM_INSTALL.getId());
+ ((RuntimeWorkingCopy) runtimeWC).setAttribute(
+ IJBossServerRuntime.PROPERTY_VM_TYPE_ID, VM_INSTALL
+ .getVMInstallType().getId());
+ ((RuntimeWorkingCopy) runtimeWC).setAttribute(
+ IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, config);
+ IRuntime savedRuntime = runtimeWC.save(true, new NullProgressMonitor());
+ return savedRuntime;
+ }
+
+ protected void createServer(String runtimeID, String serverID,
+ String location, String configuration) throws CoreException {
+ // if file doesnt exist, abort immediately.
+ assertTrue(new Path(location).toFile().exists());
+
+ currentRuntime = createRuntime(runtimeID, location, configuration);
+ IServerType serverType = ServerCore.findServerType(serverID);
+ IServerWorkingCopy serverWC = serverType.createServer(null, null,
+ new NullProgressMonitor());
+ serverWC.setRuntime(currentRuntime);
+ serverWC.setName(serverID);
+ serverWC.setServerConfiguration(null);
+ IPath path = new Path(location).append("server").append("default")
+ .append("deploy");
+ ((ServerWorkingCopy) serverWC).setAttribute(
+ DeployableServer.DEPLOY_DIRECTORY, path.toOSString());
+ currentServer = serverWC.save(true, new NullProgressMonitor());
+
+ }
+
+}