Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved some core tests from container-cdi. Added XATransaction to syst…
…em classpath specs
- Loading branch information
1 parent
5264511
commit ce5ea90
Showing
7 changed files
with
222 additions
and
2 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...s/src/test/java/test/org/jboss/forge/furnace/classpath/ForgeGetVersionIsCallableTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package test.org.jboss.forge.furnace.classpath; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.forge.arquillian.archive.ForgeArchive; | ||
import org.jboss.forge.arquillian.services.LocalServices; | ||
import org.jboss.forge.furnace.Furnace; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(Arquillian.class) | ||
public class ForgeGetVersionIsCallableTest | ||
{ | ||
@Deployment | ||
public static ForgeArchive getDeployment() | ||
{ | ||
ForgeArchive archive = ShrinkWrap.create(ForgeArchive.class) | ||
.addAsLocalServices(ForgeGetVersionIsCallableTest.class); | ||
|
||
return archive; | ||
} | ||
|
||
@Test | ||
public void testGetVersionIsCallable() throws Exception | ||
{ | ||
Furnace furnace = LocalServices.getFurnace(this.getClass().getClassLoader()); | ||
furnace.getVersion(); | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
container-tests/src/test/java/test/org/jboss/forge/furnace/classpath/ForgeSetArgsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2013 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package test.org.jboss.forge.furnace.classpath; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import org.jboss.forge.furnace.Furnace; | ||
import org.jboss.forge.furnace.impl.util.Files; | ||
import org.jboss.forge.furnace.repositories.AddonRepositoryMode; | ||
import org.jboss.forge.furnace.se.FurnaceFactory; | ||
import org.junit.After; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
/** | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
*/ | ||
public class ForgeSetArgsTest | ||
{ | ||
static File repodir1; | ||
|
||
@Before | ||
public void init() throws IOException | ||
{ | ||
repodir1 = File.createTempFile("forge", "repo1"); | ||
repodir1.deleteOnExit(); | ||
} | ||
|
||
@After | ||
public void teardown() | ||
{ | ||
Files.delete(repodir1, true); | ||
} | ||
|
||
@Test | ||
public void testAddonsCanReferenceDependenciesInOtherRepositories() throws IOException | ||
{ | ||
String[] args = new String[] { "arg1", "arg2" }; | ||
|
||
Furnace forge = FurnaceFactory.getInstance(Furnace.class.getClassLoader()); | ||
forge.setArgs(args); | ||
forge.addRepository(AddonRepositoryMode.MUTABLE, repodir1); | ||
forge.startAsync(); | ||
|
||
String[] forgeArgs = forge.getArgs(); | ||
Assert.assertArrayEquals(args, forgeArgs); | ||
|
||
forge.stop(); | ||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
...r-tests/src/test/java/test/org/jboss/forge/furnace/classpath/XATransactionLookupTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package test.org.jboss.forge.furnace.classpath; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.forge.arquillian.archive.ForgeArchive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(Arquillian.class) | ||
public class XATransactionLookupTest | ||
{ | ||
@Deployment | ||
public static ForgeArchive getDeployment() | ||
{ | ||
ForgeArchive archive = ShrinkWrap.create(ForgeArchive.class) | ||
.addAsLocalServices(XATransactionLookupTest.class); | ||
|
||
return archive; | ||
} | ||
|
||
@Test | ||
public void testGetJDKProvidedXATypes() throws Exception | ||
{ | ||
try | ||
{ | ||
getClass().getClassLoader().loadClass("javax.transaction.xa.XAResource"); | ||
getClass().getClassLoader().loadClass("javax.transaction.TransactionRequiredException"); | ||
} | ||
catch (Exception e) | ||
{ | ||
Assert.fail("Could not load required transaction classes." + e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testXATypeInstantiations() | ||
{ | ||
Assert.assertNotNull(new javax.transaction.xa.XAException()); | ||
Assert.assertNotNull(new javax.transaction.TransactionRequiredException()); | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
container-tests/src/test/java/test/org/jboss/forge/furnace/classpath/XPathLookupTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package test.org.jboss.forge.furnace.classpath; | ||
|
||
import javax.xml.xpath.XPathFactory; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.forge.arquillian.archive.ForgeArchive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(Arquillian.class) | ||
public class XPathLookupTest | ||
{ | ||
@Deployment | ||
public static ForgeArchive getDeployment() | ||
{ | ||
ForgeArchive archive = ShrinkWrap.create(ForgeArchive.class) | ||
.addAsLocalServices(XPathLookupTest.class); | ||
|
||
return archive; | ||
} | ||
|
||
@Test | ||
public void testGetJDKProvidedXPathImpl() throws Exception | ||
{ | ||
try | ||
{ | ||
getClass().getClassLoader().loadClass("com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl"); | ||
getClass().getClassLoader().loadClass("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); | ||
getClass().getClassLoader().loadClass("com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"); | ||
getClass().getClassLoader().loadClass("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); | ||
getClass().getClassLoader().loadClass("com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl"); | ||
getClass().getClassLoader().loadClass("com.sun.xml.internal.stream.events.XMLEventFactoryImpl"); | ||
getClass().getClassLoader().loadClass("com.sun.xml.internal.stream.XMLInputFactoryImpl"); | ||
getClass().getClassLoader().loadClass("com.sun.xml.internal.stream.XMLOutputFactoryImpl"); | ||
getClass().getClassLoader().loadClass("com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl"); | ||
getClass().getClassLoader().loadClass("com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory"); | ||
getClass().getClassLoader().loadClass("com.sun.org.apache.xerces.internal.parsers.SAXParser"); | ||
} | ||
catch (Exception e) | ||
{ | ||
Assert.fail("Could not load required Factory class." + e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testXPathFactoryLookup() | ||
{ | ||
Assert.assertNotNull(XPathFactory.newInstance().newXPath()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...in/java/org/jboss/forge/furnace/impl/modules/providers/XATransactionJDKClasspathSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.jboss.forge.furnace.impl.modules.providers; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import org.jboss.modules.ModuleIdentifier; | ||
|
||
public class XATransactionJDKClasspathSpec extends AbstractModuleSpecProvider | ||
{ | ||
public static final ModuleIdentifier ID = ModuleIdentifier.create("javax.transaction.xa"); | ||
|
||
public static Set<String> paths = new HashSet<String>(); | ||
|
||
static | ||
{ | ||
paths.add("javax/transaction"); | ||
paths.add("javax/transaction/xa"); | ||
} | ||
|
||
@Override | ||
protected ModuleIdentifier getId() | ||
{ | ||
return ID; | ||
} | ||
|
||
@Override | ||
protected Set<String> getPaths() | ||
{ | ||
return paths; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters