Author: dennyxu
Date: 2010-03-24 03:14:38 -0400 (Wed, 24 Mar 2010)
New Revision: 21000
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.classpath
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.project
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.settings/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.settings/org.eclipse.jdt.core.prefs
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/bin/
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/src/
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/src/org/jboss/tools/esb/project/core/test/ESBProjectDeploymentTest.java
Log:
JBIDE-5572: add unit tests for ESB, related to user customized ESB runtime classpath
container
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-03-23
23:18:39 UTC (rev 20999)
+++ trunk/esb/tests/org.jboss.tools.esb.project.core.test/META-INF/MANIFEST.MF 2010-03-24
07:14:38 UTC (rev 21000)
@@ -14,4 +14,10 @@
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"
+ org.eclipse.jdt.launching;bundle-version="3.5.0",
+ org.eclipse.wst.common.frameworks;bundle-version="1.1.300",
+ org.jboss.tools.esb.project.ui;bundle-version="1.0.0",
+ org.eclipse.jst.common.frameworks;bundle-version="1.1.300",
+ org.eclipse.core.commands;bundle-version="3.5.0",
+ org.eclipse.jst.j2ee;bundle-version="1.1.300",
+ org.jboss.ide.eclipse.as.classpath.core;bundle-version="2.1.0"
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.classpath
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.classpath
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.classpath 2010-03-24
07:14:38 UTC (rev 21000)
@@ -0,0 +1,6 @@
+<?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/JavaSE-1.6"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.project
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.project
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.project 2010-03-24
07:14:38 UTC (rev 21000)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>esbTestProject_2</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/projects/esbTestProject_2/.settings/org.eclipse.jdt.core.prefs 2010-03-24
07:14:38 UTC (rev 21000)
@@ -0,0 +1,12 @@
+#Thu Mar 18 14:11:02 CST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Modified:
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 2010-03-23
23:18:39 UTC (rev 20999)
+++
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectDeploymentTest.java 2010-03-24
07:14:38 UTC (rev 21000)
@@ -1,11 +1,11 @@
package org.jboss.tools.esb.project.core.test;
import java.io.File;
-import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import junit.framework.TestCase;
@@ -14,10 +14,17 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
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;
@@ -43,6 +50,12 @@
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.esb.core.ESBProjectConstant;
+import org.jboss.tools.esb.core.facet.IJBossESBFacetDataModelProperties;
+import org.jboss.tools.esb.core.facet.JBossClassPathCommand;
+import org.jboss.tools.esb.core.facet.JBossESBFacetDataModelProvider;
+import org.jboss.tools.esb.core.runtime.JBossESBRuntime;
+import org.jboss.tools.esb.core.runtime.JBossRuntimeClassPathInitializer;
+import org.jboss.tools.esb.core.runtime.JBossRuntimeManager;
public class ESBProjectDeploymentTest extends TestCase {
public static final IVMInstall VM_INSTALL = JavaRuntime
@@ -63,6 +76,10 @@
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 userCustomizedESBRuntime = "UserCustomizedESBRuntime";
+
+ private JBossRuntimeManager jrm = JBossRuntimeManager.getInstance();
static String BUNDLE = "org.jboss.tools.esb.project.core.test";
IProject project;
@@ -71,17 +88,31 @@
private IRuntime currentRuntime;
private IServer currentServer;
+ private JBossESBRuntime jer;
+
@Override
protected void setUp() throws Exception {
super.setUp();
soap50_runtime = createRuntime(IJBossToolingConstants.EAP_50,
SERVER_SOAP50_HOME, "default");
+
+ jer = new JBossESBRuntime();
+ jer.setName(userCustomizedESBRuntime);
+ jer.setConfiguration("default");
+ jer.setDefault(true);
+ jer.setHomeDir(SERVER_SOAP50_HOME);
+ jer.setVersion("4.7");
+ jrm.addRuntime(jer);
+ jrm.save();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
+
+ jrm.removeRuntime(jer);
+ jrm.save();
soap50_runtime.delete();
if (project != null) {
project.delete(true, null);
@@ -131,7 +162,41 @@
}
}
+
+ public void testUserCustomizedESBRuntime() throws Exception{
+// project = createESBProject("esbTestProject_2");
+ TestProjectProvider provider = new TestProjectProvider(BUNDLE,
+ "/projects/esbTestProject_2" , "esbTestProject_2", true);
+ project = provider.getProject();
+ IDataModel model = DataModelFactory.createDataModel(new
JBossESBFacetDataModelProvider());
+ model.setBooleanProperty(IJBossESBFacetDataModelProperties.RUNTIME_IS_SERVER_SUPPLIED,
false);
+ model.setStringProperty(IJBossESBFacetDataModelProperties.RUNTIME_ID, jer.getName());
+ model.setStringProperty(IJBossESBFacetDataModelProperties.RUNTIME_HOME,
jer.getHomeDir());
+ model.setStringProperty(IJBossESBFacetDataModelProperties.ESB_CONTENT_FOLDER,
"esbcontent");
+
+ JBossClassPathCommand jcc = new JBossClassPathCommand(project, model);
+ IStatus status = jcc.executeOverride(null);
+
+ assertEquals("Failed to add User Customized ESB runtime classpath
container.", IStatus.OK, status.getSeverity());
+
+ IJavaProject jproject = JavaCore.create(project);
+
+ JBossRuntimeClassPathInitializer initializer = new JBossRuntimeClassPathInitializer();
+ IPath path = new
Path("org.jboss.esb.runtime.classpath/UserCustomizedESBRuntime");
+ initializer.initialize(path, jproject);
+
+ IClasspathEntry[] entry = initializer.getEntries(path);//jproject.getRawClasspath();
+ List<String> jars = new ArrayList<String>();
+
+ for(IClasspathEntry ent :entry){
+ jars.add(ent.getPath().lastSegment());
+ }
+
+ assertEquals("unalbe to read User customized ESB runtime, jbossesb-rosetta.jar is
not in classpath.", true, jars.contains("jbossesb-rosetta.jar"));
+
+ }
+
public void testSOAP50Deployment() throws Exception {
testESBDeployment(IJBossToolingConstants.EAP_50,
IJBossToolingConstants.SERVER_EAP_50, SERVER_SOAP50_HOME);