Migrating to JBoss5

This commit is contained in:
Konstantin Krivopustov 2009-01-19 13:03:18 +00:00
parent 3a905658d6
commit b5a48628ee
10 changed files with 74 additions and 108 deletions

View File

@ -25,9 +25,7 @@
<target name="install-lib">
<!-- jboss -->
<ext:install-jboss version="${jboss.version}" toDir="${jboss.dir}"/>
<!-- test libs -->
<ext:install-lib name="jboss-ejb3-embeddable" version="${jboss-ejb3-embeddable.version}" toDir="${lib.test.dir}"/>
<ext:install-lib name="jboss-ejb3-embeddable-thirdparty" version="${jboss-ejb3-embeddable-thirdparty.version}" toDir="${lib.test.dir}"/>
<ext:install-jboss-embedded version="${jboss-embedded.version}" toDir="${jboss-embedded.dir}"/>
<!-- common libs -->
<ext:install-lib name="commons-codec" version="${commons-codec.version}" toDir="${lib.common.dir}"/>
<ext:install-lib name="commons-io" version="${commons-io.version}" toDir="${lib.common.dir}"/>
@ -39,23 +37,15 @@
<ext:install-lib name="jcifs" version="${jcifs.version}" toDir="${lib.server.dir}"/>
<ext:install-lib name="gwt-user" version="${gwt-user.version}" toDir="${lib.gwt.dir}"/>
<ext:install-lib name="gwt-dev-windows" version="${gwt-dev-windows.version}" toDir="${lib.gwt.dir}"/>
<ext:install-jboss-lib name="commons-collections" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jboss-common" path="lib" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jboss-vfs" path="lib" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jboss-common-core" path="lib" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jboss" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="hibernate3" version="${jboss.version}" toDir="${lib.test.dir}"/>
<ext:install-jboss-lib name="jboss-j2ee" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jboss-ejb3x" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jboss-javaee" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jboss-remoting" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jbosssx" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="servlet-api" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jboss-annotations-ejb3" path="server/default/deploy/ejb3.deployer" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jboss-jmx" path="lib" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="jboss-j2se" path="lib" version="${jboss.version}" toDir="${lib.server.dir}"/>
<ext:install-jboss-lib name="xercesImpl" path="lib/endorsed" version="${jboss.version}" toDir="${lib.server.dir}"/>
<!-- client libs -->
<ext:install-jboss-lib name="jboss-ejb3-client" path="client" version="${jboss.version}" toDir="${lib.client.dir}"/>
<ext:install-jboss-lib name="jboss-remoting" path="client" version="${jboss.version}" toDir="${lib.client.dir}"/>
<ext:install-jboss-lib name="jboss-aop-jdk50-client" path="client" version="${jboss.version}" toDir="${lib.client.dir}"/>
<ext:install-jboss-lib name="jboss-aspect-jdk50-client" path="client" version="${jboss.version}" toDir="${lib.client.dir}"/>
</target>
<target name="compile">
@ -82,5 +72,11 @@
</antcall>
</target>
<target name="deploy4test">
<antcall target="delegate" inheritAll="false">
<param name="target" value="deploy4test-module"/>
</antcall>
</target>
<target name="clean-build-deploy" depends="clean,build,deploy"/>
</project>

View File

@ -1002,20 +1002,23 @@
<library name="server">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../lib/server/openjpa-1.2.0.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/commons-collections.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/jboss.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/jboss-j2ee.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/jboss-ejb3x.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/serp-1.13.1.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/itmill-toolkit-5.2.12.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/servlet-api.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/jcifs-1.3.2.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/common/commons-collections.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/jboss-javaee.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/jbosssx.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/jboss-vfs.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/jboss-j2se.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/../lib/server/src/openjpa-1.2.0-src.zip!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/itmill-toolkit-5.2.12.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/src/jcifs-1.3.2-src.zip!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/src/jboss-vfs-src.zip!/" />
</SOURCES>
</library>
<library name="common">
@ -1039,10 +1042,12 @@
</library>
<library name="test">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../lib/test/jboss-ejb3-embeddable-ALPHA-9.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/test/jboss-ejb3-embeddable-thirdparty-ALPHA-9.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/test/junit-4.5.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/test/hibernate3.jar!/" />
<root url="jar://$PROJECT_DIR$/../jboss-embedded/lib/hibernate-all.jar!/" />
<root url="jar://$PROJECT_DIR$/../jboss-embedded/lib/jboss-embedded-all.jar!/" />
<root url="jar://$PROJECT_DIR$/../jboss-embedded/lib/jboss-embedded.jar!/" />
<root url="jar://$PROJECT_DIR$/../jboss-embedded/lib/thirdparty-all.jar!/" />
<root url="file://$PROJECT_DIR$/../jboss-embedded/bootstrap" />
</CLASSES>
<JAVADOC />
<SOURCES>
@ -1050,12 +1055,7 @@
</SOURCES>
</library>
<library name="client">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../lib/client/jboss-ejb3-client.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/client/jboss-remoting.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/client/jboss-aspect-jdk50-client.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/client/jboss-aop-jdk50-client.jar!/" />
</CLASSES>
<CLASSES />
<JAVADOC />
<SOURCES />
</library>

View File

@ -1,11 +1,10 @@
jboss.version=4.2.3.GA-1
jboss.version=5.0.0.GA-1
jboss-embedded.version=beta3-1
commons-codec.version=1.3
commons-io.version=1.4
openjpa.version=1.2.0
itmill-toolkit.version=5.2.12
jcifs.version=1.3.2
serp.version=1.13.1
jboss-ejb3-embeddable.version=ALPHA-9
jboss-ejb3-embeddable-thirdparty.version=ALPHA-9
gwt-user.version=1.0
gwt-dev-windows.version=1.0

View File

@ -32,6 +32,7 @@
<fileset refid="common-lib-fs"/>
<fileset refid="server-lib-fs"/>
<fileset refid="test-lib-fs"/>
<fileset refid="jboss-embedded-lib-fs"/>
<fileset refid="chile-jars"/>
<pathelement location="${prod.out.dir}/${module.name}"/>
</path>
@ -93,6 +94,15 @@
</copy>
</target>
<target name="deploy4test-module" depends="base-mod.deploy4test-module">
<copy file="${build.dir}/${module.global.jar}" todir="${jboss-embedded.deploy.dir}"/>
<copy file="${build.dir}/${module.service.xml}" todir="${jboss-embedded.deploy.dir}"/>
<copy file="${src-serv.dir}/${module.ds.xml}" todir="${jboss-embedded.deploy.dir}"/>
<copy todir="${jboss-embedded.dir}/bootstrap/conf">
<fileset dir="${build.dir}/conf" includes="**/*"/>
</copy>
</target>
<target name="undeploy-module" depends="base-mod.undeploy-module">
<delete file="${jboss.dir}/server/default/deploy/${module.global.jar}"/>
<delete file="${jboss.dir}/server/default/deploy/${module.service.xml}"/>

View File

@ -2,11 +2,11 @@
<server>
<mbean code="com.haulmont.cuba.core.app.ResourceRepository"
name="haulmont.cuba:service=ResourceRepository">
<depends>jboss:service=Naming</depends>
<depends>jboss:service=TransactionManager</depends>
</mbean>
<mbean code="com.haulmont.cuba.core.app.ConfigStorage"
name="haulmont.cuba:service=ConfigStorage">
<depends>jboss:service=Naming</depends>
<depends>jboss:service=TransactionManager</depends>
</mbean>
</server>

View File

@ -18,13 +18,18 @@ import com.haulmont.chile.jpa.loader.JPAMetadataLoader;
import com.haulmont.chile.jpa.loader.AnnotationsMetadataLoader;
import java.io.InputStream;
import java.io.IOException;
import java.util.*;
import java.lang.reflect.Field;
import java.net.URL;
import java.net.URISyntaxException;
import org.dom4j.io.SAXReader;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VFS;
public class MetadataProviderImpl extends MetadataProvider
{
@ -61,6 +66,13 @@ public class MetadataProviderImpl extends MetadataProvider
final String name = field.getName();
return !name.startsWith("pc") && !name.startsWith("__") && super.isMetaPropertyField(field);
}
protected URL normalize(URL url) throws IOException, URISyntaxException {
if ("vfszip".equals(url.getProtocol())) {
url = VFSUtils.getRealURL(VFS.getCachedFile(url));
}
return super.normalize(url);
}
};
}
};

View File

@ -13,14 +13,10 @@ import junit.framework.TestCase;
import java.io.File;
import org.jboss.embedded.Bootstrap;
public abstract class CubaTestCase extends TestCase
{
protected void setUpDeploymentFiles() {
TestContainer.addDeploymentFile("cuba-core-global.jar");
TestContainer.addDeploymentFile("20cuba-core.jar");
TestContainer.addDeploymentFile("21cuba-core-service.xml");
}
protected void setUp() throws Exception {
super.setUp();
System.setProperty("cuba.UnitTestMode", "true");
@ -30,9 +26,8 @@ public abstract class CubaTestCase extends TestCase
System.setProperty(SecurityProvider.IMPL_PROP, "com.haulmont.cuba.core.sys.TestSecurityProvider");
if (!TestContainer.isStarted()) {
setUpDeploymentFiles();
TestContainer.start();
if (!Bootstrap.getInstance().isStarted()) {
Bootstrap.getInstance().bootstrap();
}
}
}

View File

@ -13,8 +13,8 @@ import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.jboss.ejb3.embedded.EJB3StandaloneBootstrap;
import org.jboss.ejb3.embedded.EJB3StandaloneDeployer;
//import org.jboss.ejb3.embedded.EJB3StandaloneBootstrap;
//import org.jboss.ejb3.embedded.EJB3StandaloneDeployer;
import org.jboss.mx.util.MBeanServerLocator;
import javax.management.*;
@ -25,6 +25,7 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Deprecated
public class TestContainer
{
private static boolean started;
@ -102,7 +103,7 @@ public class TestContainer
if (started)
return;
EJB3StandaloneBootstrap.boot(null);
// EJB3StandaloneBootstrap.boot(null);
Collections.sort(filesByExt, new ExtensionComparator());
for (String fileName : filesByExt) {
@ -124,20 +125,20 @@ public class TestContainer
deployServiceXml(file);
}
else {
EJB3StandaloneDeployer deployer = EJB3StandaloneBootstrap.createDeployer();
// EJB3StandaloneDeployer deployer = EJB3StandaloneBootstrap.createDeployer();
URL archive;
try {
archive = file.toURL();
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
deployer.getArchives().add(archive);
try {
deployer.create();
deployer.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
// deployer.getArchives().add(archive);
// try {
// deployer.create();
// deployer.start();
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
}
}
@ -192,23 +193,10 @@ public class TestContainer
}
}
// private static void setClassPath(File deployDir) {
// String deployPath;
// try {
// deployPath = deployDir.getCanonicalPath();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// String cp = System.getProperty("java.class.path");
// if (!cp.contains(deployPath + File.pathSeparator)) {
// System.setProperty("java.class.path", deployPath + File.pathSeparator + cp);
// }
// }
public static void stop() {
if (!started)
return;
EJB3StandaloneBootstrap.shutdown();
// EJB3StandaloneBootstrap.shutdown();
started = false;
}
}

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!-- ===================================================================== -->
<!-- -->
<!-- Log4j Configuration -->
<!-- -->
<!-- ===================================================================== -->
<!-- $Id$ -->
<!--
| For more configuration infromation and examples see the Jakarta Log4j
| owebsite: http://jakarta.apache.org/log4j
-->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Target" value="System.out"/>
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Messagen -->
<!--
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
-->
<!--<param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) -%m%n"/>-->
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>
<category name="org.jboss">
<priority value="INFO"/>
</category>
<root>
<appender-ref ref="CONSOLE"/>
</root>
</log4j:configuration>

View File

@ -26,6 +26,8 @@
<path id="test-compile-cp">
<fileset refid="common-lib-fs"/>
<fileset refid="server-lib-fs"/>
<fileset refid="test-lib-fs"/>
<fileset refid="jboss-embedded-lib-fs"/>
<fileset refid="chile-jars"/>
</path>
@ -42,4 +44,10 @@
</copy>
</target>
<target name="deploy4test-module" depends="base-mod.deploy4test-module">
<copy todir="${jboss-embedded.dir}/bootstrap/conf">
<fileset dir="${build.dir}/conf" includes="**/*"/>
</copy>
</target>
</project>