[jboss-cvs] JBossAS SVN: r90114 - in projects/embedded/trunk: testsuite-full-dep and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jun 12 03:37:46 EDT 2009
Author: ALRubinger
Date: 2009-06-12 03:37:45 -0400 (Fri, 12 Jun 2009)
New Revision: 90114
Added:
projects/embedded/trunk/testsuite-full-dep/
projects/embedded/trunk/testsuite-full-dep/.classpath
projects/embedded/trunk/testsuite-full-dep/.project
projects/embedded/trunk/testsuite-full-dep/.settings/
projects/embedded/trunk/testsuite-full-dep/.settings/org.eclipse.jdt.core.prefs
projects/embedded/trunk/testsuite-full-dep/.settings/org.maven.ide.eclipse.prefs
projects/embedded/trunk/testsuite-full-dep/pom.xml
projects/embedded/trunk/testsuite-full-dep/src/
projects/embedded/trunk/testsuite-full-dep/src/main/
projects/embedded/trunk/testsuite-full-dep/src/main/java/
projects/embedded/trunk/testsuite-full-dep/src/main/resources/
projects/embedded/trunk/testsuite-full-dep/src/test/
projects/embedded/trunk/testsuite-full-dep/src/test/java/
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/SecurityActions.java
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/ServerTestCase.java
projects/embedded/trunk/testsuite-full-dep/src/test/resources/
projects/embedded/trunk/testsuite-full-dep/src/test/resources/log4j.xml
Log:
[EMB-26] Create a testsuite project to handle ClassLoading mode where AS dependency set is upon the application CL (in progress)
Property changes on: projects/embedded/trunk/testsuite-full-dep
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
Name: svn:mergeinfo
+
Added: projects/embedded/trunk/testsuite-full-dep/.classpath
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/.classpath (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/.classpath 2009-06-12 07:37:45 UTC (rev 90114)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: projects/embedded/trunk/testsuite-full-dep/.project
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/.project (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/.project 2009-06-12 07:37:45 UTC (rev 90114)
@@ -0,0 +1,17 @@
+<projectDescription>
+ <name>jboss-embedded-testsuite</name>
+ <comment>JBoss Application Server Embedded TestSuite with Full Dependency Set</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/embedded/trunk/testsuite-full-dep/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/.settings/org.eclipse.jdt.core.prefs 2009-06-12 07:37:45 UTC (rev 90114)
@@ -0,0 +1,5 @@
+#Thu Jun 11 14:31:45 GMT-05:00 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: projects/embedded/trunk/testsuite-full-dep/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/.settings/org.maven.ide.eclipse.prefs 2009-06-12 07:37:45 UTC (rev 90114)
@@ -0,0 +1,8 @@
+#Thu Jun 11 14:33:21 GMT-05:00 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+version=1
Added: projects/embedded/trunk/testsuite-full-dep/pom.xml
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/pom.xml (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/pom.xml 2009-06-12 07:37:45 UTC (rev 90114)
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.embedded</groupId>
+ <artifactId>jboss-embedded-build</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+
+ <!-- Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Artifact Configuration -->
+ <artifactId>jboss-embedded-testsuite-fulldep</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <name>JBossAS Embedded TestSuite for Full AS Dependency Set</name>
+ <description>JBoss Application Server Embedded TestSuite with Full AS Dependency Set</description>
+
+ <build>
+
+ <plugins>
+ <!-- Surefire -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <!--
+ This doesn't seem to help for JDK5, and is not needed in
+ JDK6. Aims to address "feature not implemented" error onn
+ boot
+ -->
+ <property>
+ <name>java.endorsed.dirs</name>
+ <value>/home/alrubinger/business/jboss/wc/jbossas/branches/Branch_5_x/build/output/jboss-5.2.0.Beta/lib/endorsed</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- Properties -->
+ <properties>
+ <version.org.jboss.jbossas>5.2.0-SNAPSHOT</version.org.jboss.jbossas>
+ <version.jboss.web>2.1.3.GA</version.jboss.web>
+
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ <!-- JUnit -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <!-- AS modules and 3rdparty deps -->
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-build</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <type>pom</type>
+ </dependency>
+
+ <!--
+ Deps in the runtime of AS but *not* part of the AS dep tree
+ -->
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-management</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <classifier>jsr77</classifier>
+ </dependency>
+ <dependency>
+ <groupId>jboss.web</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>${version.jboss.web}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.web</groupId>
+ <artifactId>el-api</artifactId>
+ <version>${version.jboss.web}</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added: projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/SecurityActions.java
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/SecurityActions.java (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/SecurityActions.java 2009-06-12 07:37:45 UTC (rev 90114)
@@ -0,0 +1,128 @@
+package org.jboss;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * SecurityActions
+ *
+ * A set of privileged actions that are not to leak out
+ * of this package
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class SecurityActions
+{
+
+ //-------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * No external instanciation
+ */
+ private SecurityActions()
+ {
+
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Utility Methods --------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Sets the specified property with key and value
+ */
+ static void setSystemProperty(final String key, final String value)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ System.setProperty(key, value);
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Obtains the system property with the specified key
+ *
+ * @param key
+ * @return
+ * @throws IllegalArgumentException If the key is null
+ */
+ static String getSystemProperty(final String key) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key was null");
+ }
+
+ // Get sysprop
+ return AccessController.doPrivileged(new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getProperty(key);
+ }
+ });
+ }
+
+ /**
+ * Obtains the Thread Context ClassLoader
+ */
+ static ClassLoader getThreadContextClassLoader()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+
+ /**
+ * Sets the specified CL upon the current Thread's Context
+ *
+ * @param cl
+ * @throws IllegalArgumentException If the CL was null
+ */
+ static void setThreadContextClassLoader(final ClassLoader cl) throws IllegalArgumentException
+ {
+ if (cl == null)
+ {
+ throw new IllegalArgumentException("ClassLoader was null");
+ }
+
+ AccessController.doPrivileged(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ Thread.currentThread().setContextClassLoader(cl);
+ return null;
+ };
+ });
+ }
+
+ /**
+ * Adds the specified shutdown hook
+ *
+ * @param shutdownHook
+ */
+ static void addShutdownHook(final Thread shutdownHook)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ Runtime.getRuntime().addShutdownHook(shutdownHook);
+ return null;
+ }
+ });
+
+ }
+}
Added: projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/ServerTestCase.java
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/ServerTestCase.java (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/ServerTestCase.java 2009-06-12 07:37:45 UTC (rev 90114)
@@ -0,0 +1,161 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ */
+//FIXME We have to be in org.jboss due to JMX getPackage in AS
+package org.jboss;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.jboss.bootstrap.spi.as.config.JBossASConfigurationInitializer;
+import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
+import org.jboss.bootstrap.spi.as.server.JBossASServer;
+import org.jboss.bootstrap.spi.as.server.JBossASServerFactory;
+import org.jboss.bootstrap.spi.lifecycle.LifecycleState;
+import org.junit.Test;
+
+/**
+ * ServerTestCase
+ *
+ * Don't even begin to consider this a real test :D
+ * It's essentially all the logic of what Embedded Core will
+ * provide in one unified place.
+ *
+ * This is the initial prototype for Embedded AS to run
+ * with a full AS Dependency Set upon the Application
+ * ClassLoader. The deps are defined by pom.xml.
+ *
+ * Some hacks worthy of note:
+ * 1) JBOSS_HOME is hardcoded
+ * 2) Requires JDK6 to run, something to do with JAXP not getting endorsed
+ * from java.endorsed.dirs in pom.xml Surefire Config
+ * 3) This class must be in package org.jboss due to JMX
+ * package checking in AS org.jboss.management.j2ee.deployers.LocalJBossServerDomain at 335
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class ServerTestCase
+{
+
+ //-------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * The server instance
+ */
+ private static JBossASServer server;
+
+ /**
+ * Location of JBOSS_HOME, hack for now.
+ */
+ @Deprecated
+ //FIXME
+ private static final String HARDCODED_JBOSS_HOME = "/home/alrubinger/business/jboss/wc/jbossas/branches/Branch_5_x/build/output/jboss-5.2.0.Beta/";
+
+ //-------------------------------------------------------------------------------||
+ // Tests ------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Ensures that the server reports as running
+ */
+ @Test
+ public void testServerStart() throws Throwable
+ {
+ //FIXME
+ // These should be set up by some common AS booter if not specified, not unique to Embedded
+ System.setProperty("xb.builder.useUnorderedSequence", Boolean.TRUE.toString());
+ System.setProperty("java.rmi.server.hostname", "localhost");
+
+ //FIXME Hack
+ // http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4237170
+ System.setProperty("javax.security.jacc.PolicyConfigurationFactory.provider",
+ "org.jboss.security.jacc.JBossPolicyConfigurationFactory");
+
+ final String propKeyJBossasBindAddress = JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS;
+ final String defaultBindAddress = "127.0.0.1";
+ System.setProperty(propKeyJBossasBindAddress, defaultBindAddress);
+
+ System.out.println(System.getProperties());
+
+ // Initialize the JDK logmanager
+ String name = System.getProperty("java.util.logging.manager");
+ if (name == null)
+ {
+ System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
+ }
+
+ //FIXME Hardcoded for testing
+ final String jbossHome = HARDCODED_JBOSS_HOME;
+
+ //FIXME We shouldn't need any of this log stuff, should we?
+ /*
+ * Set boot log directory
+ */
+ final String sysPropBootLogDir = "jboss.boot.server.log.dir";
+ final String sysPropLogDir = JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LOG_DIR;
+ String serverName = System.getProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_NAME);
+ if (serverName == null || serverName.length() == 0)
+ {
+ serverName = JBossASConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT;
+ }
+ final String manualBootLogDir = System.getProperty(sysPropBootLogDir);
+ final String manualLogDir = System.getProperty(sysPropLogDir);
+ // If nothing's been explicitly specified
+ if (manualBootLogDir == null && manualLogDir == null)
+ {
+ // We default it
+ final File jbossHomeFile = new File(jbossHome);
+ final URL jbossHomeUrl = jbossHomeFile.toURI().toURL();
+ final URL serverLog = new URL(jbossHomeUrl, "server/" + serverName + "/log/");
+ final File serverLogFile = new File(serverLog.toURI());
+ final String serverLogString = serverLogFile.getAbsolutePath();
+ System.setProperty(sysPropBootLogDir, serverLogString);
+ }
+ // If we've got a manual log dir, use it
+ else if (manualLogDir != null)
+ {
+ System.setProperty(sysPropBootLogDir, manualLogDir);
+ }
+
+ // Make Server
+ server = JBossASServerFactory.createServer();
+
+ // Set JBOSS_HOME
+ server.getConfiguration().jbossHome(jbossHome);
+
+ // Start
+ server.start();
+
+ final LifecycleState state = server.getState();
+ final LifecycleState expected = LifecycleState.STARTED;
+ TestCase.assertEquals("The server is not reporting as started", expected, state);
+
+ // Shutdown
+ server.shutdown();
+
+ }
+
+}
Added: projects/embedded/trunk/testsuite-full-dep/src/test/resources/log4j.xml
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/resources/log4j.xml (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/resources/log4j.xml 2009-06-12 07:37:45 UTC (rev 90114)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
+
+<!--
+ | 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">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <param name="File" value="target/test.log"/>
+ <param name="Threshold" value="INFO"/>
+ <param name="Append" value="false"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.jnp">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.jboss.embedded">
+ <priority value="ALL"/>
+ </category>
+
+ <category name="org.jboss.bootstrap">
+ <priority value="ALL"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
More information about the jboss-cvs-commits
mailing list