[jboss-cvs] JBossAS SVN: r101607 - in projects/ejb-book/trunk: ch05-encryption and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Feb 27 17:11:03 EST 2010
Author: ALRubinger
Date: 2010-02-27 17:11:02 -0500 (Sat, 27 Feb 2010)
New Revision: 101607
Modified:
projects/ejb-book/trunk/build/pom.xml
projects/ejb-book/trunk/ch05-encryption/pom.xml
projects/ejb-book/trunk/ch05-encryption/src/test/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionIntegrationTestCase.java
projects/ejb-book/trunk/ch05-encryption/src/test/resources/jndi.properties
Log:
[EJBBOOK-20] Use Arquillian for CH05 Encryption integration testing
Modified: projects/ejb-book/trunk/build/pom.xml
===================================================================
--- projects/ejb-book/trunk/build/pom.xml 2010-02-27 19:44:01 UTC (rev 101606)
+++ projects/ejb-book/trunk/build/pom.xml 2010-02-27 22:11:02 UTC (rev 101607)
@@ -20,12 +20,13 @@
<version.junit_junit>4.5</version.junit_junit>
<version.org.jboss.embedded>1.0.0-alpha-1</version.org.jboss.embedded>
<version.org.jboss.jbossas>6.0.0.M1</version.org.jboss.jbossas>
- <version.org.jboss.shrinkwrap>1.0.0-alpha-2</version.org.jboss.shrinkwrap>
+ <version.org.jboss.shrinkwrap>1.0.0-alpha-5</version.org.jboss.shrinkwrap>
<version.org.jboss.ejb3_jboss.ejb3.api>3.1.0-Alpha1</version.org.jboss.ejb3_jboss.ejb3.api>
<version.org.jboss.ejb3_jboss.ejb3.ext.api>1.0.0</version.org.jboss.ejb3_jboss.ejb3.ext.api>
<version.org.jboss.javaee_jboss-jms-api>1.1.0.GA</version.org.jboss.javaee_jboss-jms-api>
<version.org.jboss.logging_jboss.logging.log4j>2.0.6.GA</version.org.jboss.logging_jboss.logging.log4j>
<version.org.jboss.logging_jboss.logging.spi>2.0.5.GA</version.org.jboss.logging_jboss.logging.spi>
+ <version.org.jboss.arquillian>1.0.0-SNAPSHOT</version.org.jboss.arquillian>
</properties>
@@ -154,6 +155,20 @@
<version>${version.org.jboss.shrinkwrap}</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-container-openejb</artifactId>
+ <version>${version.org.jboss.arquillian}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <version>${version.org.jboss.arquillian}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
Modified: projects/ejb-book/trunk/ch05-encryption/pom.xml
===================================================================
--- projects/ejb-book/trunk/ch05-encryption/pom.xml 2010-02-27 19:44:01 UTC (rev 101606)
+++ projects/ejb-book/trunk/ch05-encryption/pom.xml 2010-02-27 22:11:02 UTC (rev 101607)
@@ -77,6 +77,16 @@
<artifactId>commons-codec</artifactId>
<version>${version.commons.codec_commons.codec}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-container-openejb</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ </dependency>
</dependencies>
@@ -86,6 +96,9 @@
<!-- Declare the "Integration Test" Profile -->
<id>it</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
<build>
@@ -106,10 +119,6 @@
</goals>
<configuration>
<skip>false</skip>
- <!-- Include jbossall-client.jar on the CP -->
- <additionalClasspathElements>
- <additionalClasspathElement>${jboss.home}/client/jbossall-client.jar</additionalClasspathElement>
- </additionalClasspathElements>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<printSummary>true</printSummary>
<forkMode>always</forkMode>
@@ -120,77 +129,7 @@
</execution>
</executions>
</plugin>
-
- <!--
-
- Define the JBossAS Maven Control Plugin
- -->
- <plugin>
-
- <groupId>org.jboss.maven.plugins.jbossas</groupId>
- <artifactId>maven-jboss-as-control-plugin</artifactId>
- <version>0.1.2-SNAPSHOT</version>
-
- <!-- Executions -->
- <executions>
-
- <!--
-
- Start JBossAS with our new configuration
- -->
- <execution>
- <id>start-jbossas</id>
- <goals>
- <goal>start</goal>
- </goals>
- <phase>pre-integration-test</phase>
- <configuration>
- <jvmArgs>
- <jvmArg>-Xmx512M</jvmArg>
- </jvmArgs>
- <serverConfigName>default</serverConfigName>
- <jboss.test.run>true</jboss.test.run>
- </configuration>
- </execution>
-
- <!--
-
- Deploy into our custom JBossAS Configuration
- -->
- <execution>
- <id>deploy-test-slsb</id>
- <goals>
- <goal>deploy</goal>
- </goals>
- <phase>pre-integration-test</phase>
- <configuration>
- <serverConfigName>default</serverConfigName>
- <files>${project.build.directory}/lib/commons-codec.jar,${project.build.directory}/${project.build.finalName}.${project.packaging}
- </files>
- <jboss.test.run>true</jboss.test.run>
- </configuration>
- </execution>
-
- <!--
-
- Stop JBossAS
- -->
- <execution>
- <id>stop-jbossas</id>
- <goals>
- <goal>stop</goal>
- </goals>
- <phase>post-integration-test</phase>
- <configuration>
- <serverConfigName>default</serverConfigName>
- <jboss.test.run>true</jboss.test.run>
- </configuration>
- </execution>
-
- </executions>
-
- </plugin>
-
+
</plugins>
</build>
Modified: projects/ejb-book/trunk/ch05-encryption/src/test/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionIntegrationTestCase.java
===================================================================
--- projects/ejb-book/trunk/ch05-encryption/src/test/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionIntegrationTestCase.java 2010-02-27 19:44:01 UTC (rev 101606)
+++ projects/ejb-book/trunk/ch05-encryption/src/test/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionIntegrationTestCase.java 2010-02-27 22:11:02 UTC (rev 101607)
@@ -22,14 +22,22 @@
package org.jboss.ejb3.examples.ch05.encryption;
+import java.net.MalformedURLException;
+import java.net.URL;
+
import javax.naming.Context;
import javax.naming.InitialContext;
import junit.framework.TestCase;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* EncryptionIntegrationTestCase
@@ -39,6 +47,7 @@
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
*/
+ at RunWith(Arquillian.class)
public class EncryptionIntegrationTestCase extends EncryptionTestCaseSupport
{
// ---------------------------------------------------------------------------||
@@ -56,15 +65,15 @@
private static Context namingContext;
/**
- * The EJB 3.x remote business view of the EncryptionEJB
+ * The EJB 3.x local business view of the EncryptionEJB
*/
- private static EncryptionRemoteBusiness encryptionRemoteBusiness;
+ private static EncryptionLocalBusiness encryptionLocalBusiness;
/**
- * JNDI Name of the Remote Business Reference
+ * JNDI Name of the Business Reference
*/
- //TODO Use Global JNDI Syntax (not yet supported in JBoss EJB3)
- private static final String JNDI_NAME_ENCRYPTION_REMOTE_BUSINESS = EncryptionBean.EJB_NAME + "/remote";
+ //TODO Use Global JNDI Syntax or injection
+ private static final String JNDI_NAME_ENCRYPTION_LOCAL_BUSINESS = EncryptionBean.EJB_NAME + "Local";
/**
* Correlates to the env-entry within ejb-jar.xml, to be used as an override from the default
@@ -76,6 +85,22 @@
*/
private static final String EXPECTED_ALGORITHM_MESSAGE_DIGEST = "SHA";
+ /**
+ * Define the deployment
+ */
+ @Deployment
+ public static JavaArchive createDeployment() throws MalformedURLException
+ {
+ final JavaArchive archive = Archives.create("slsb.jar", JavaArchive.class).addClasses(EncryptionBean.class,
+ EncryptionCommonBusiness.class, EncryptionLocalBusiness.class, EncryptionRemoteBusiness.class,
+ EncryptionException.class).addManifestResource(
+ new URL(EncryptionIntegrationTestCase.class.getProtectionDomain().getCodeSource().getLocation(),
+ "../classes/META-INF/ejb-jar.xml"), "ejb-jar.xml");
+ //TODO SHRINKWRAP-141 Make addition of the ejb-jar less verbose
+ log.info(archive.toString(true));
+ return archive;
+ }
+
// ---------------------------------------------------------------------------||
// Lifecycle Methods ---------------------------------------------------------||
// ---------------------------------------------------------------------------||
@@ -87,7 +112,7 @@
namingContext = new InitialContext();
// Obtain EJB 3.x Business Reference
- encryptionRemoteBusiness = (EncryptionRemoteBusiness) namingContext.lookup(JNDI_NAME_ENCRYPTION_REMOTE_BUSINESS);
+ encryptionLocalBusiness = (EncryptionLocalBusiness) namingContext.lookup(JNDI_NAME_ENCRYPTION_LOCAL_BUSINESS);
}
// ---------------------------------------------------------------------------||
@@ -108,7 +133,7 @@
log.info("testHashing");
// Test via superclass
- this.assertHashing(encryptionRemoteBusiness);
+ this.assertHashing(encryptionLocalBusiness);
}
/**
@@ -121,7 +146,7 @@
log.info("testEncryption");
// Test via superclass
- this.assertEncryption(encryptionRemoteBusiness);
+ this.assertEncryption(encryptionLocalBusiness);
}
/**
@@ -137,7 +162,7 @@
log.info("testMessageDigestAlgorithmOverride");
// Get the algorithm used
- final String algorithm = encryptionRemoteBusiness.getMessageDigestAlgorithm();
+ final String algorithm = encryptionLocalBusiness.getMessageDigestAlgorithm();
log.info("Using MessageDigest algorithm: " + algorithm);
// Ensure expected
@@ -158,7 +183,7 @@
log.info("testCiphersPassphraseOverride");
// Get the algorithm used
- final String passphrase = encryptionRemoteBusiness.getCiphersPassphrase();
+ final String passphrase = encryptionLocalBusiness.getCiphersPassphrase();
log.info("Using Encryption passphrase: " + passphrase);
// Ensure expected
Modified: projects/ejb-book/trunk/ch05-encryption/src/test/resources/jndi.properties
===================================================================
--- projects/ejb-book/trunk/ch05-encryption/src/test/resources/jndi.properties 2010-02-27 19:44:01 UTC (rev 101606)
+++ projects/ejb-book/trunk/ch05-encryption/src/test/resources/jndi.properties 2010-02-27 22:11:02 UTC (rev 101607)
@@ -1,4 +1,2 @@
-# JNDI Properties for Remote interaction with JBoss Application Server Naming Service
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=jnp://localhost:1099
\ No newline at end of file
+# JNDI Properties for Local interaction with OpenEJB Naming Provider
+java.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list