repo
stringlengths 1
191
⌀ | file
stringlengths 23
351
| code
stringlengths 0
5.32M
| file_length
int64 0
5.32M
| avg_line_length
float64 0
2.9k
| max_line_length
int64 0
288k
| extension_type
stringclasses 1
value |
---|---|---|---|---|---|---|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/lazyconnectionmanager/rar/LazyConnection.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jca.lazyconnectionmanager.rar;
/**
* @author <a href="mailto:[email protected]">Jesper Pedersen</a>
* @author <a href="mailto:[email protected]">Martin Simka</a>
*/
public interface LazyConnection {
boolean isManagedConnectionSet();
boolean closeManagedConnection();
boolean associate();
boolean isEnlisted();
boolean enlist();
void close();
}
| 1,452 | 34.439024 | 79 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/lazyconnectionmanager/rar/LazyXAResource.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jca.lazyconnectionmanager.rar;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.jboss.logging.Logger;
/**
* @author <a href="mailto:[email protected]">Jesper Pedersen</a>
* @author <a href="mailto:[email protected]">Martin Simka</a>
*/
public class LazyXAResource implements XAResource {
private static Logger logger = Logger.getLogger(LazyXAResource.class);
private LazyManagedConnection mc;
public LazyXAResource(LazyManagedConnection mc) {
logger.trace("#LazyXAResource");
this.mc = mc;
}
@Override
public void commit(Xid xid, boolean b) throws XAException {
logger.trace("#LazyXAResource.commit");
mc.setEnlisted(false);
}
@Override
public void end(Xid xid, int i) throws XAException {
logger.trace("#LazyXAResource.end");
}
@Override
public void forget(Xid xid) throws XAException {
logger.trace("#LazyXAResource.forget");
}
@Override
public int getTransactionTimeout() throws XAException {
logger.trace("#LazyXAResource.getTransactionTimeout");
return 0;
}
@Override
public boolean isSameRM(XAResource xaResource) throws XAException {
logger.trace("#LazyXAResource.isSameRM");
if (xaResource != null) { return xaResource instanceof LazyXAResource; }
return false;
}
@Override
public int prepare(Xid xid) throws XAException {
logger.trace("#LazyXAResource.prepare");
return XAResource.XA_OK;
}
@Override
public Xid[] recover(int i) throws XAException {
logger.trace("#LazyXAResource.recover");
return new Xid[0];
}
@Override
public void rollback(Xid xid) throws XAException {
logger.trace("#LazyXAResource.rollback");
mc.setEnlisted(false);
}
@Override
public boolean setTransactionTimeout(int i) throws XAException {
logger.trace("#LazyXAResource.setTransactionTimeout");
return true;
}
@Override
public void start(Xid xid, int i) throws XAException {
logger.trace("#LazyXAResource.start");
mc.setEnlisted(true);
}
}
| 3,297 | 30.711538 | 80 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/lazyconnectionmanager/rar/LazyManagedConnection.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jca.lazyconnectionmanager.rar;
import static org.wildfly.common.Assert.checkNotNullParam;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import jakarta.resource.NotSupportedException;
import jakarta.resource.ResourceException;
import jakarta.resource.spi.ConnectionEvent;
import jakarta.resource.spi.ConnectionEventListener;
import jakarta.resource.spi.ConnectionManager;
import jakarta.resource.spi.ConnectionRequestInfo;
import jakarta.resource.spi.DissociatableManagedConnection;
import jakarta.resource.spi.LazyEnlistableConnectionManager;
import jakarta.resource.spi.LazyEnlistableManagedConnection;
import jakarta.resource.spi.LocalTransaction;
import jakarta.resource.spi.ManagedConnection;
import jakarta.resource.spi.ManagedConnectionMetaData;
import javax.security.auth.Subject;
import javax.transaction.xa.XAResource;
import org.jboss.logging.Logger;
/**
* @author <a href="mailto:[email protected]">Jesper Pedersen</a>
* @author <a href="mailto:[email protected]">Martin Simka</a>
*/
public class LazyManagedConnection implements ManagedConnection, DissociatableManagedConnection,
LazyEnlistableManagedConnection {
private static Logger logger = Logger.getLogger(LazyManagedConnection.class);
private boolean localTransaction;
private boolean xaTransaction;
private boolean enlisted;
private LazyConnectionImpl connection;
private List<ConnectionEventListener> listeners;
private PrintWriter logwriter;
private LazyLocalTransaction lazyLocalTransaction;
private LazyXAResource lazyXAResource;
private ConnectionManager cm;
private LazyManagedConnectionFactory mcf;
public LazyManagedConnection(boolean localTransaction, boolean xaTransaction, ConnectionManager cm, LazyManagedConnectionFactory mcf) {
logger.trace("#LazyManagedConnection");
this.localTransaction = localTransaction;
this.xaTransaction = xaTransaction;
this.cm = cm;
this.mcf = mcf;
this.enlisted = false;
this.listeners = Collections.synchronizedList(new ArrayList<ConnectionEventListener>(1));
if (localTransaction) { this.lazyLocalTransaction = new LazyLocalTransaction(this); }
if (xaTransaction) { this.lazyXAResource = new LazyXAResource(this); }
}
@Override
public void dissociateConnections() throws ResourceException {
logger.trace("#LazyManagedConnection.dissociateConnections");
if (connection != null) {
connection.setManagedConnection(null);
connection = null;
}
}
@Override
public Object getConnection(Subject subject, ConnectionRequestInfo cri) throws ResourceException {
logger.trace("#LazyManagedConnection.getConnection");
if (connection != null) {
connection.setManagedConnection(null);
}
connection = new LazyConnectionImpl(cm, this, mcf, cri);
return connection;
}
@Override
public void destroy() throws ResourceException {
logger.trace("#LazyManagedConnection.destroy");
}
@Override
public void cleanup() throws ResourceException {
logger.trace("#LazyManagedConnection.cleanup");
if (connection != null) {
connection.setManagedConnection(null);
connection = null;
}
}
@Override
public void associateConnection(Object connection) throws ResourceException {
logger.trace("#LazyManagedConnection.associateConnection");
if (this.connection != null) {
this.connection.setManagedConnection(null);
}
if (connection != null) {
if (!(connection instanceof LazyConnectionImpl)) { throw new ResourceException("Connection isn't LazyConnectionImpl: " + connection.getClass().getName()); }
this.connection = (LazyConnectionImpl) connection;
this.connection.setManagedConnection(this);
} else {
this.connection = null;
}
}
@Override
public void addConnectionEventListener(ConnectionEventListener listener) {
logger.trace("#LazyManagedConnection.addConnectionEventListener");
checkNotNullParam("listener", listener);
listeners.add(listener);
}
@Override
public void removeConnectionEventListener(ConnectionEventListener listener) {
logger.trace("#LazyManagedConnection.removeConnectionEventListener");
checkNotNullParam("listener", listener);
listeners.remove(listener);
}
@Override
public XAResource getXAResource() throws ResourceException {
logger.trace("#LazyManagedConnection.getXAResource");
if (!xaTransaction || localTransaction) {
throw new NotSupportedException("GetXAResource not supported not supported");
} else {
return lazyXAResource;
}
}
@Override
public LocalTransaction getLocalTransaction() throws ResourceException {
logger.trace("#LazyManagedConnection.getLocalTransaction");
if (!localTransaction || xaTransaction) {
throw new NotSupportedException("LocalTransaction not supported");
} else {
return lazyLocalTransaction;
}
}
@Override
public ManagedConnectionMetaData getMetaData() throws ResourceException {
logger.trace("#LazyManagedConnection.getMetaData");
return new LazyManagedConnectionMetaData();
}
@Override
public void setLogWriter(PrintWriter printWriter) throws ResourceException {
logger.trace("#LazyManagedConnection.setLogWriter");
logwriter = printWriter;
}
@Override
public PrintWriter getLogWriter() throws ResourceException {
logger.trace("#LazyManagedConnection.getLogWriter");
return logwriter;
}
boolean isEnlisted() {
logger.trace("#LazyManagedConnection.isEnlisted");
return enlisted;
}
void setEnlisted(boolean enlisted) {
logger.trace("#LazyManagedConnection.setEnlisted");
this.enlisted = enlisted;
}
boolean enlist() {
logger.trace("#LazyManagedConnection.enlist");
try {
if (cm instanceof LazyEnlistableConnectionManager) {
LazyEnlistableConnectionManager lecm = (LazyEnlistableConnectionManager) cm;
lecm.lazyEnlist(this);
return true;
}
} catch (Throwable t) {
logger.error(t.getMessage(), t);
}
return false;
}
void closeHandle(LazyConnection handle) {
ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
event.setConnectionHandle(handle);
for (ConnectionEventListener cel : listeners) {
cel.connectionClosed(event);
}
}
}
| 7,947 | 35.292237 | 168 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/lazyconnectionmanager/rar/LazyConnectionFactoryImpl.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jca.lazyconnectionmanager.rar;
import javax.naming.NamingException;
import javax.naming.Reference;
import jakarta.resource.ResourceException;
import jakarta.resource.spi.ConnectionManager;
import org.jboss.logging.Logger;
/**
* @author <a href="mailto:[email protected]">Jesper Pedersen</a>
* @author <a href="mailto:[email protected]">Martin Simka</a>
*/
public class LazyConnectionFactoryImpl implements LazyConnectionFactory {
private static Logger logger = Logger.getLogger(LazyConnectionFactoryImpl.class);
private Reference reference;
private LazyManagedConnectionFactory mcf;
private ConnectionManager connectionManager;
public LazyConnectionFactoryImpl(LazyManagedConnectionFactory mcf, ConnectionManager connectionManager) {
logger.trace("#LazyConnectionFactoryImpl");
this.mcf = mcf;
this.connectionManager = connectionManager;
}
@Override
public LazyConnection getConnection() throws ResourceException {
logger.trace("#LazyConnectionFactoryImpl.getConnection");
return (LazyConnection) connectionManager.allocateConnection(mcf, null);
}
@Override
public Reference getReference() throws NamingException {
logger.trace("#LazyConnectionFactoryImpl.getReference");
return reference;
}
@Override
public void setReference(Reference reference) {
logger.trace("#LazyConnectionFactoryImpl.setReference");
this.reference = reference;
}
}
| 2,558 | 37.19403 | 109 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/lazyconnectionmanager/rar/LazyLocalTransaction.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jca.lazyconnectionmanager.rar;
import jakarta.resource.ResourceException;
import jakarta.resource.spi.LocalTransaction;
import org.jboss.logging.Logger;
/**
* @author <a href="mailto:[email protected]">Jesper Pedersen</a>
* @author <a href="mailto:[email protected]">Martin Simka</a>
*/
public class LazyLocalTransaction implements LocalTransaction {
private static Logger logger = Logger.getLogger(LazyLocalTransaction.class);
private LazyManagedConnection mc;
public LazyLocalTransaction(LazyManagedConnection mc) {
this.mc = mc;
}
@Override
public void begin() throws ResourceException {
logger.trace("#LazyLocalTransaction.begin");
mc.setEnlisted(true);
}
@Override
public void commit() throws ResourceException {
logger.trace("#LazyLocalTransaction.commit");
mc.setEnlisted(false);
}
@Override
public void rollback() throws ResourceException {
logger.trace("#LazyLocalTransaction.rollback");
mc.setEnlisted(false);
}
}
| 2,118 | 34.316667 | 80 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/lazyconnectionmanager/rar/LazyConnectionImpl.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jca.lazyconnectionmanager.rar;
import jakarta.resource.spi.ConnectionManager;
import jakarta.resource.spi.ConnectionRequestInfo;
import jakarta.resource.spi.LazyAssociatableConnectionManager;
import org.jboss.logging.Logger;
/**
* @author <a href="mailto:[email protected]">Jesper Pedersen</a>
* @author <a href="mailto:[email protected]">Martin Simka</a>
*/
public class LazyConnectionImpl implements LazyConnection {
private static Logger logger = Logger.getLogger(LazyConnectionImpl.class);
private ConnectionManager cm;
private LazyManagedConnection mc;
private LazyManagedConnectionFactory mcf;
private ConnectionRequestInfo cri;
public LazyConnectionImpl(ConnectionManager cm, LazyManagedConnection mc, LazyManagedConnectionFactory mcf, ConnectionRequestInfo cri) {
logger.trace("#LazyConnectionImpl");
this.cm = cm;
this.mc = mc;
this.mcf = mcf;
this.cri = cri;
}
@Override
public boolean isManagedConnectionSet() {
logger.trace("#LazyConnectionImpl.isManagedConnectionSet");
return mc != null;
}
@Override
public boolean closeManagedConnection() {
logger.trace("#LazyConnectionImpl.closeManagedConnection");
if (isManagedConnectionSet()) {
try {
mc.dissociateConnections();
mc = null;
return true;
} catch (Throwable t) {
logger.error("closeManagedConnection()", t);
}
}
return false;
}
@Override
public boolean associate() {
logger.trace("#LazyConnectionImpl.associate");
if (mc == null) {
if (cm instanceof LazyAssociatableConnectionManager) {
try {
LazyAssociatableConnectionManager lcm = (LazyAssociatableConnectionManager) cm;
lcm.associateConnection(this, mcf, cri);
return true;
} catch (Throwable t) {
logger.error("associate()", t);
}
}
}
return false;
}
@Override
public boolean isEnlisted() {
logger.trace("#LazyConnectionImpl.isEnlisted");
return mc.isEnlisted();
}
@Override
public boolean enlist() {
logger.trace("#LazyConnectionImpl.enlist");
return mc.enlist();
}
@Override
public void close() {
logger.trace("#LazyConnectionImpl.close");
if (mc != null) {
mc.closeHandle(this);
} else {
if (cm instanceof LazyAssociatableConnectionManager) {
LazyAssociatableConnectionManager lacm = (LazyAssociatableConnectionManager) cm;
lacm.inactiveConnectionClosed(this, mcf);
}
}
}
public void setManagedConnection(LazyManagedConnection mc) {
logger.trace("#LazyConnectionImpl.setManagedConnection");
this.mc = mc;
}
}
| 4,053 | 32.783333 | 140 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/ear/RarInsideEarReDeploymentTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2010, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jca.ear;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.junit.Assert.assertNotNull;
import javax.naming.Context;
import org.jboss.arquillian.container.test.api.Deployer;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.as.arquillian.api.ContainerResource;
import org.jboss.as.test.integration.jca.rar.MultipleAdminObject1;
import org.jboss.as.test.integration.management.base.AbstractMgmtTestBase;
import org.jboss.as.test.integration.management.base.ContainerResourceMgmtTestBase;
import org.jboss.as.test.integration.management.util.MgmtOperationException;
import org.jboss.dmr.ModelNode;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
import org.jboss.staxmapper.XMLElementReader;
import org.jboss.staxmapper.XMLElementWriter;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* @author <a href="[email protected]">Vladimir Rastseluev</a> JBQA-5968 test
* for undeployment and re-deployment
*/
@RunWith(Arquillian.class)
@RunAsClient
public class RarInsideEarReDeploymentTestCase extends
ContainerResourceMgmtTestBase {
static final String deploymentName = "re-deployment.ear";
static String subDeploymentName = "ear_packaged.rar";
private static ModelNode address;
@ContainerResource
private Context context;
@ArquillianResource
private Deployer deployer;
private void setup() throws Exception {
// since it is created after deployment it needs activation
address = new ModelNode();
address.add("subsystem", "resource-adapters");
address.add("resource-adapter", deploymentName + "#"
+ subDeploymentName);
address.protect();
ModelNode operation = new ModelNode();
operation.get(OP).set("add");
operation.get(OP_ADDR).set(address);
operation.get("archive").set(deploymentName + "#" + subDeploymentName);
executeOperation(operation);
ModelNode addr = address.clone();
addr.add("admin-objects", "Pool3");
operation = new ModelNode();
operation.get(OP).set("add");
operation.get(OP_ADDR).set(addr);
operation.get("jndi-name").set("java:jboss/exported/redeployed/Name3");
operation
.get("class-name")
.set("org.jboss.as.test.integration.jca.rar.MultipleAdminObject1Impl");
executeOperation(operation);
operation = new ModelNode();
operation.get(OP).set("activate");
operation.get(OP_ADDR).set(address);
executeOperation(operation);
}
/**
* Define the deployment
*
* @return The deployment archive
*/
@Deployment(name = deploymentName, managed = false)
public static EnterpriseArchive createDeployment() throws Exception {
ResourceAdapterArchive raa = ShrinkWrap.create(
ResourceAdapterArchive.class, subDeploymentName);
JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "multiple.jar");
ja.addPackage(MultipleAdminObject1.class.getPackage()).addClasses(
RarInsideEarReDeploymentTestCase.class,
MgmtOperationException.class, XMLElementReader.class,
XMLElementWriter.class);
ja.addPackage(AbstractMgmtTestBase.class.getPackage());
raa.addAsLibrary(ja);
raa.addAsManifestResource(
RarInsideEarReDeploymentTestCase.class.getPackage(), "ra.xml",
"ra.xml")
.addAsManifestResource(
new StringAsset(
"Dependencies: org.jboss.as.controller-client,org.jboss.dmr\n"),
"MANIFEST.MF");
final EnterpriseArchive ear = ShrinkWrap.create(
EnterpriseArchive.class, deploymentName);
ear.addAsModule(raa);
ear.addAsManifestResource(
RarInsideEarReDeploymentTestCase.class.getPackage(),
"application.xml", "application.xml");
return ear;
}
/**
* Test configuration
*
* @throws Throwable Thrown if case of an error
*/
@Test
public void testConfiguration() throws Throwable {
try {
deployer.deploy(deploymentName);
setup();
deployer.undeploy(deploymentName);
deployer.deploy(deploymentName);
MultipleAdminObject1 adminObject1 = (MultipleAdminObject1) context
.lookup("redeployed/Name3");
assertNotNull("AO1 not found", adminObject1);
} finally {
deployer.undeploy(deploymentName);
remove(address);
}
}
}
| 6,231 | 37.469136 | 96 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/workmanager/WorkManagerThreadsCheckTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2016, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jca.workmanager;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.core.AllOf.allOf;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_RESOURCE_DESCRIPTION_OPERATION;
import java.io.IOException;
import org.hamcrest.MatcherAssert;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.client.helpers.Operations;
import org.jboss.as.test.integration.jca.JcaMgmtBase;
import org.jboss.as.test.integration.management.util.MgmtOperationException;
import org.jboss.dmr.ModelNode;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Checks that only one short-running-thread pool or long-running-thread pool is allowed under one workmanager.
*
* @author Lin Gao
*/
@RunWith(Arquillian.class)
@RunAsClient
public class WorkManagerThreadsCheckTestCase extends JcaMgmtBase {
private static final PathAddress WORKMANAGER_ADDRESS = PathAddress.pathAddress("subsystem", "jca").append("workmanager", "default");
@Deployment
public static Archive<?> deploytRar() {
return ShrinkWrap.create(JavaArchive.class, "dummy.jar");
}
@Test
public void testOneLongRunningThreadPool() throws IOException {
ModelNode operation = Operations.createAddOperation(WORKMANAGER_ADDRESS.append("long-running-threads", "Long").toModelNode());
operation.get("max-threads").set(10);
operation.get("queue-length").set(10);
try {
executeOperation(operation);
Assert.fail("NOT HERE!");
} catch (MgmtOperationException e) {
String reason = e.getResult().get("failure-description").asString();
MatcherAssert.assertThat("Wrong error message", reason, allOf(
containsString("WFLYJCA0101"),
containsString("Long"),
containsString("long-running-threads"),
containsString("default")
));
}
}
@Test
public void testOneShortRunningThreadPool() throws IOException {
ModelNode operation = Operations.createAddOperation(WORKMANAGER_ADDRESS.append("short-running-threads", "Short").toModelNode());
operation.get("max-threads").set(10);
operation.get("queue-length").set(10);
try {
executeOperation(operation);
Assert.fail("NOT HERE!");
} catch (MgmtOperationException e) {
String reason = e.getResult().get("failure-description").asString();
MatcherAssert.assertThat("Wrong error message", reason, allOf(
containsString("WFLYJCA0101"),
containsString("Short"),
containsString("short-running-threads"),
containsString("default")
));
}
}
@Test
public void testShortRunningThreadPoolName() throws Exception {
PathAddress address = PathAddress.pathAddress("subsystem", "jca").append("workmanager", "name-test");
ModelNode operation = Operations.createAddOperation(address.toModelNode());
operation.get("name").set("name-test");
executeOperation(operation);
operation = Operations.createAddOperation(address.append("short-running-threads", "Short").toModelNode());
operation.get("max-threads").set(10);
operation.get("queue-length").set(10);
try {
executeOperation(operation);
Assert.fail("NOT HERE!");
} catch (MgmtOperationException e) {
String reason = e.getResult().get("failure-description").asString();
MatcherAssert.assertThat("Wrong error message", reason, allOf(
containsString("WFLYJCA0122"),
containsString("Short"),
containsString("short-running-threads"),
containsString("name-test")
));
} finally {
executeOperation(Operations.createRemoveOperation(address.toModelNode()));
}
}
@Test
public void testBlockingThreadPool() throws IOException {
Assert.assertTrue(isBlockingThreadPool("short-running-threads"));
Assert.assertTrue(isBlockingThreadPool("long-running-threads"));
}
protected boolean isBlockingThreadPool(String pool) throws IOException {
ModelNode operation = Operations.createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, WORKMANAGER_ADDRESS.append(pool, "default").toModelNode());
try {
ModelNode result = executeOperation(operation);
return result.asString().contains("A thread pool executor with a bounded queue where threads submittings tasks may block");
} catch (MgmtOperationException e) {
return false;
}
}
}
| 6,161 | 42.394366 | 153 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/workmanager/LongRunningThreadsCheckTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2010, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jca.workmanager;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import jakarta.annotation.Resource;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.arquillian.api.ServerSetup;
import org.jboss.as.arquillian.container.ManagementClient;
import org.jboss.as.connector.services.workmanager.NamedWorkManager;
import org.jboss.as.connector.services.workmanager.StatisticsExecutorImpl;
import org.jboss.as.test.integration.jca.JcaMgmtBase;
import org.jboss.as.test.integration.jca.JcaMgmtServerSetupTask;
import org.jboss.as.test.integration.jca.JcaTestsUtil;
import org.jboss.as.test.integration.jca.rar.MultipleAdminObject1;
import org.jboss.as.test.integration.jca.rar.MultipleAdminObject1Impl;
import org.jboss.as.test.integration.jca.rar.MultipleConnectionFactory1;
import org.jboss.as.test.integration.jca.rar.MultipleResourceAdapter3;
import org.jboss.as.test.integration.management.base.AbstractMgmtTestBase;
import org.jboss.as.test.shared.integration.ejb.security.PermissionUtils;
import org.jboss.dmr.ModelNode;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.lang.reflect.ReflectPermission;
/**
* JBQA-6454 Test case: long running threads pool and short running threads pool
* should be different in case of using work manager with defined long-running-threads property
* should be equal elsewhere
*
* @author <a href="[email protected]">Vladimir Rastseluev</a>
*/
@RunWith(Arquillian.class)
@ServerSetup(LongRunningThreadsCheckTestCase.TestCaseSetup.class)
public class LongRunningThreadsCheckTestCase {
public static String ctx = "customContext";
public static String wm = "customWM";
static class TestCaseSetup extends JcaMgmtServerSetupTask {
private boolean enabled;
private boolean failingOnError;
private boolean failingOnWarning;
@Override
public void doSetup(final ManagementClient managementClient) throws Exception {
enabled = getArchiveValidationAttribute("enabled");
failingOnError = getArchiveValidationAttribute("fail-on-error");
failingOnWarning = getArchiveValidationAttribute("fail-on-warn");
setArchiveValidation(false, false, false);
for (int i = 1; i <= 2; i++) {
ModelNode wmAddress = subsystemAddress.clone().add("workmanager", wm + i);
ModelNode bsAddress = subsystemAddress.clone().add("bootstrap-context", ctx + i);
ModelNode operation = new ModelNode();
try {
operation.get(OP).set(ADD);
operation.get(OP_ADDR).set(wmAddress);
operation.get(NAME).set(wm + i);
executeOperation(operation);
operation = new ModelNode();
operation.get(OP).set(ADD);
operation.get(OP_ADDR).set(wmAddress.clone().add("short-running-threads", wm + i));
operation.get("core-threads").set("20");
operation.get("queue-length").set("20");
operation.get("max-threads").set("20");
executeOperation(operation);
if (i == 2) {
operation = new ModelNode();
operation.get(OP).set(ADD);
operation.get(OP_ADDR).set(wmAddress.clone().add("long-running-threads", wm + i));
operation.get("core-threads").set("20");
operation.get("queue-length").set("20");
operation.get("max-threads").set("20");
executeOperation(operation);
}
operation = new ModelNode();
operation.get(OP).set(ADD);
operation.get(OP_ADDR).set(bsAddress);
operation.get(NAME).set(ctx + i);
operation.get("workmanager").set(wm + i);
executeOperation(operation);
} catch (Exception e) {
throw new Exception(e.getMessage() + operation, e);
}
}
}
}
/**
* Define the deployment
*
* @return The deployment archive
*/
@Deployment
public static EnterpriseArchive createDeployment() {
JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "wm.jar");
ja.addPackage(MultipleConnectionFactory1.class.getPackage()).addClasses(LongRunningThreadsCheckTestCase.class,
JcaMgmtServerSetupTask.class, JcaMgmtBase.class, JcaTestsUtil.class);
ja.addPackage(AbstractMgmtTestBase.class.getPackage());
ja.addAsManifestResource(new StringAsset("Dependencies: org.jboss.as.connector, org.jboss.ironjacamar.api, org.jboss.threads"),
"MANIFEST.MF");
ResourceAdapterArchive ra1 = ShrinkWrap.create(ResourceAdapterArchive.class, "wm1.rar");
ra1.addAsManifestResource(LongRunningThreadsCheckTestCase.class.getPackage(), "ra.xml", "ra.xml")
.addAsManifestResource(LongRunningThreadsCheckTestCase.class.getPackage(), "ironjacamar1.xml",
"ironjacamar.xml");
ResourceAdapterArchive ra2 = ShrinkWrap.create(ResourceAdapterArchive.class, "wm2.rar");
ra2.addAsManifestResource(LongRunningThreadsCheckTestCase.class.getPackage(), "ra.xml", "ra.xml")
.addAsManifestResource(LongRunningThreadsCheckTestCase.class.getPackage(), "ironjacamar2.xml",
"ironjacamar.xml");
EnterpriseArchive ea = ShrinkWrap.create(EnterpriseArchive.class, "wm.ear");
ea.addAsLibrary(ja).addAsModule(ra1).addAsModule(ra2);
ea.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
new RuntimePermission("accessDeclaredMembers"),
new ReflectPermission("suppressAccessChecks")
), "permissions.xml");
return ea;
}
@Resource(mappedName = "java:jboss/A1")
private MultipleAdminObject1 adminObject1;
@Resource(mappedName = "java:jboss/A2")
private MultipleAdminObject1 adminObject2;
/**
* Tests work manager without long-running-threads set
*
* @throws Throwable Thrown if case of an error
*/
@Test
public void testWmWithoutLongRunningThreads() throws Throwable {
assertNotNull("A1 not found", adminObject1);
MultipleAdminObject1Impl impl = (MultipleAdminObject1Impl) adminObject1;
MultipleResourceAdapter3 adapter = (MultipleResourceAdapter3) impl.getResourceAdapter();
assertNotNull(adapter);
NamedWorkManager manager = adapter.getWorkManager();
assertEquals(wm + 1, manager.getName());
assertTrue(manager.getShortRunningThreadPool() instanceof StatisticsExecutorImpl);
assertTrue(manager.getLongRunningThreadPool() instanceof StatisticsExecutorImpl);
assertEquals(JcaTestsUtil.extractBlockingExecutor((StatisticsExecutorImpl) manager.getShortRunningThreadPool()),
JcaTestsUtil.extractBlockingExecutor((StatisticsExecutorImpl) manager.getLongRunningThreadPool()));
}
/**
* Tests work manager with long-running-threads set
*
* @throws Throwable Thrown if case of an error
*/
@Test
public void testWmWithLongRunningThreads() throws Throwable {
assertNotNull("A2 not found", adminObject2);
MultipleAdminObject1Impl impl = (MultipleAdminObject1Impl) adminObject2;
MultipleResourceAdapter3 adapter = (MultipleResourceAdapter3) impl.getResourceAdapter();
assertNotNull(adapter);
NamedWorkManager manager = adapter.getWorkManager();
assertEquals(wm + 2, manager.getName());
assertFalse(manager.getShortRunningThreadPool().equals(manager.getLongRunningThreadPool()));
}
}
| 9,701 | 44.981043 | 135 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/bootstrap/CustomBootstrapContextTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2010, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jca.bootstrap;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import jakarta.annotation.Resource;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.arquillian.api.ServerSetup;
import org.jboss.as.arquillian.container.ManagementClient;
import org.jboss.as.test.integration.jca.JcaMgmtBase;
import org.jboss.as.test.integration.jca.JcaMgmtServerSetupTask;
import org.jboss.as.test.integration.jca.rar.MultipleAdminObject1;
import org.jboss.as.test.integration.jca.rar.MultipleAdminObject1Impl;
import org.jboss.as.test.integration.jca.rar.MultipleConnectionFactory1;
import org.jboss.as.test.integration.jca.rar.MultipleResourceAdapter2;
import org.jboss.as.test.integration.management.base.AbstractMgmtTestBase;
import org.jboss.dmr.ModelNode;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* @author <a href="[email protected]">Vladimir Rastseluev</a> JBQA-5936 custom bootstrap context deployment
*/
@RunWith(Arquillian.class)
@ServerSetup(CustomBootstrapContextTestCase.CustomBootstrapDeploymentTestCaseSetup.class)
public class CustomBootstrapContextTestCase {
public static String ctx = "customContext";
public static String wm = "customWM";
static class CustomBootstrapDeploymentTestCaseSetup extends JcaMgmtServerSetupTask {
ModelNode wmAddress = subsystemAddress.clone().add("workmanager", wm);
ModelNode bsAddress = subsystemAddress.clone().add("bootstrap-context", ctx);
@Override
public void doSetup(final ManagementClient managementClient) throws Exception {
ModelNode operation = new ModelNode();
try {
operation.get(OP).set(ADD);
operation.get(OP_ADDR).set(wmAddress);
operation.get(NAME).set(wm);
executeOperation(operation);
operation = new ModelNode();
operation.get(OP).set(ADD);
operation.get(OP_ADDR).set(wmAddress.clone().add("short-running-threads", wm));
operation.get("core-threads").set("20");
operation.get("queue-length").set("20");
operation.get("max-threads").set("20");
executeOperation(operation);
operation = new ModelNode();
operation.get(OP).set(ADD);
operation.get(OP_ADDR).set(bsAddress);
operation.get(NAME).set(ctx);
operation.get("workmanager").set(wm);
executeOperation(operation);
} catch (Exception e) {
throw new Exception(e.getMessage() + operation, e);
}
}
}
/**
* Define the deployment
*
* @return The deployment archive
*/
@Deployment
public static ResourceAdapterArchive createDeployment() throws Exception {
ResourceAdapterArchive raa = ShrinkWrap.create(ResourceAdapterArchive.class, "bootstrap_archive_ij.rar");
JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "multiple.jar");
ja.addPackage(MultipleConnectionFactory1.class.getPackage()).addClasses(CustomBootstrapContextTestCase.class,
JcaMgmtServerSetupTask.class, JcaMgmtBase.class);
ja.addPackage(AbstractMgmtTestBase.class.getPackage()); // needed to process the @ServerSetup annotation on the server side
raa.addAsLibrary(ja);
raa.addAsManifestResource(CustomBootstrapContextTestCase.class.getPackage(), "ra.xml", "ra.xml")
.addAsManifestResource(CustomBootstrapContextTestCase.class.getPackage(), "ironjacamar.xml", "ironjacamar.xml")
.addAsManifestResource(
new StringAsset(
"Dependencies: org.jboss.as.connector \n"),
"MANIFEST.MF");
return raa;
}
@Resource(mappedName = "java:jboss/name1")
private MultipleConnectionFactory1 connectionFactory1;
@Resource(mappedName = "java:jboss/Name3")
private MultipleAdminObject1 adminObject1;
/**
* Test configuration
*
* @throws Throwable Thrown if case of an error
*/
@Test
public void testConfiguration() throws Throwable {
assertNotNull("CF1 not found", connectionFactory1);
assertNotNull("AO1 not found", adminObject1);
MultipleAdminObject1Impl impl = (MultipleAdminObject1Impl) adminObject1;
MultipleResourceAdapter2 adapter = (MultipleResourceAdapter2) impl.getResourceAdapter();
assertNotNull(adapter);
assertEquals(wm, adapter.getWorkManagerName());
assertEquals(ctx, adapter.getBootstrapContextName());
}
}
| 6,350 | 41.34 | 131 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/rar/HelloWorldConnectionFactoryImpl.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.rar;
import javax.naming.NamingException;
import javax.naming.Reference;
import jakarta.resource.ResourceException;
import jakarta.resource.spi.ConnectionManager;
/**
* User: jpai
*/
public class HelloWorldConnectionFactoryImpl implements HelloWorldConnectionFactory {
/**
* The serialVersionUID
*/
private static final long serialVersionUID = 1L;
private Reference reference;
private HelloWorldManagedConnectionFactory mcf;
private ConnectionManager connectionManager;
/**
* Default constructor
*
* @param mcf ManagedConnectionFactory
* @param cxManager ConnectionManager
*/
public HelloWorldConnectionFactoryImpl(HelloWorldManagedConnectionFactory mcf, ConnectionManager cxManager) {
this.mcf = mcf;
this.connectionManager = cxManager;
}
/**
* Get connection from factory
*
* @return HelloWorldConnection instance
* @throws ResourceException Thrown if a connection can't be obtained
*/
@Override
public HelloWorldConnection getConnection() throws ResourceException {
return (HelloWorldConnection) connectionManager.allocateConnection(mcf, null);
}
/**
* Get the Reference instance.
*
* @return Reference instance
* @throws NamingException Thrown if a reference can't be obtained
*/
@Override
public Reference getReference() throws NamingException {
return reference;
}
/**
* Set the Reference instance.
*
* @param reference A Reference instance
*/
@Override
public void setReference(Reference reference) {
this.reference = reference;
}
}
| 2,767 | 23.936937 | 113 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/rar/HelloWorldConnectionImpl.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.rar;
/**
* User: jpai
*/
public class HelloWorldConnectionImpl implements HelloWorldConnection {
/**
* ManagedConnection
*/
private HelloWorldManagedConnection mc;
/**
* ManagedConnectionFactory
*/
private HelloWorldManagedConnectionFactory mcf;
/**
* Default constructor
*
* @param mc HelloWorldManagedConnection
* @param mcf HelloWorldManagedConnectionFactory
*/
public HelloWorldConnectionImpl(HelloWorldManagedConnection mc, HelloWorldManagedConnectionFactory mcf) {
this.mc = mc;
this.mcf = mcf;
}
/**
* Call helloWorld
*
* @return String helloworld
*/
public String helloWorld() {
return helloWorld(mcf.getResourceAdapter().toString());
}
/**
* Call helloWorld
*
* @param name String name
* @return String helloworld
*/
public String helloWorld(String name) {
return "Hello World, " + name + " !";
}
/**
* Close
*/
public void close() {
mc.closeHandle(this);
}
}
| 2,164 | 21.552083 | 109 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/rar/HelloWorldResourceAdapter.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.rar;
import jakarta.resource.ResourceException;
import jakarta.resource.spi.ActivationSpec;
import jakarta.resource.spi.BootstrapContext;
import jakarta.resource.spi.Connector;
import jakarta.resource.spi.ResourceAdapter;
import jakarta.resource.spi.ResourceAdapterInternalException;
import jakarta.resource.spi.TransactionSupport;
import jakarta.resource.spi.endpoint.MessageEndpointFactory;
import javax.transaction.xa.XAResource;
/**
* User: jpai
*/
@Connector(reauthenticationSupport = false, transactionSupport = TransactionSupport.TransactionSupportLevel.NoTransaction)
public class HelloWorldResourceAdapter implements ResourceAdapter {
@Override
public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException {
}
@Override
public void stop() {
}
@Override
public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws ResourceException {
}
@Override
public void endpointDeactivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) {
}
@Override
public XAResource[] getXAResources(ActivationSpec[] activationSpecs) throws ResourceException {
return new XAResource[0];
}
public boolean equals(Object o) {
return super.equals(o);
}
public int hashCode() {
return super.hashCode();
}
}
| 2,477 | 34.4 | 139 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/rar/HelloWorldManagedConnectionMetaData.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.rar;
import jakarta.resource.ResourceException;
import jakarta.resource.spi.ManagedConnectionMetaData;
/**
* User: jpai
*/
public class HelloWorldManagedConnectionMetaData implements ManagedConnectionMetaData {
/**
* Returns Product name of the underlying EIS instance connected
* through the ManagedConnection.
*
* @return Product name of the EIS instance
* @throws ResourceException Thrown if an error occurs
*/
@Override
public String getEISProductName() throws ResourceException {
return "HelloWorld Resource Adapter";
}
/**
* Returns Product version of the underlying EIS instance connected
* <p/>
* through the ManagedConnection.
*
* @return Product version of the EIS instance
* @throws ResourceException Thrown if an error occurs
*/
@Override
public String getEISProductVersion() throws ResourceException {
return "1.0";
}
/**
* Returns maximum limit on number of active concurrent connections
*
* @return Maximum limit for number of active concurrent connections
* @throws ResourceException Thrown if an error occurs
*/
@Override
public int getMaxConnections() throws ResourceException {
return 0;
}
/**
* Returns name of the user associated with the ManagedConnection instance
*
* @return Name of the user
* @throws ResourceException Thrown if an error occurs
*/
@Override
public String getUserName() throws ResourceException {
return null;
}
}
| 2,646 | 28.411111 | 87 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/rar/HelloWorldConnection.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.rar;
/**
* User: jpai
*/
public interface HelloWorldConnection {
/**
* HelloWorld
*
* @return String
*/
String helloWorld();
/**
* HelloWorld
*
* @param name A name
* @return String
*/
String helloWorld(String name);
/**
* Close
*/
void close();
}
| 1,399 | 24.925926 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/rar/HelloWorldManagedConnectionFactory.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.rar;
import java.io.PrintWriter;
import java.util.Set;
import jakarta.resource.ResourceException;
import jakarta.resource.spi.ConnectionDefinition;
import jakarta.resource.spi.ConnectionManager;
import jakarta.resource.spi.ConnectionRequestInfo;
import jakarta.resource.spi.ManagedConnection;
import jakarta.resource.spi.ManagedConnectionFactory;
import jakarta.resource.spi.ResourceAdapter;
import jakarta.resource.spi.ResourceAdapterAssociation;
import javax.security.auth.Subject;
/**
* User: jpai
*/
@ConnectionDefinition(connectionFactory = HelloWorldConnectionFactory.class,
connectionFactoryImpl = HelloWorldConnectionFactoryImpl.class,
connection = HelloWorldConnection.class,
connectionImpl = HelloWorldConnectionImpl.class)
public class HelloWorldManagedConnectionFactory implements ManagedConnectionFactory, ResourceAdapterAssociation {
/**
* The serialVersionUID
*/
private static final long serialVersionUID = 1L;
/**
* The resource adapter
*/
private ResourceAdapter ra;
private PrintWriter writer;
/**
* Default constructor
*/
public HelloWorldManagedConnectionFactory() {
}
/**
* Creates a Connection Factory instance.
*
* @return EIS-specific Connection Factory instance or
* <p/>
* jakarta.resource.cci.ConnectionFactory instance
* @throws ResourceException Generic exception
*/
public Object createConnectionFactory() throws ResourceException {
throw new ResourceException("This resource adapter doesn't support non-managed environments");
}
/**
* Creates a Connection Factory instance.
*
* @param cxManager ConnectionManager to be associated with created EIS
* <p/>
* connection factory instance
* @return EIS-specific Connection Factory instance or
* <p/>
* jakarta.resource.cci.ConnectionFactory instance
* @throws ResourceException Generic exception
*/
public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException {
return new HelloWorldConnectionFactoryImpl(this, cxManager);
}
/**
* Creates a new physical connection to the underlying EIS resource manager.
*
* @param subject Caller's security information
* @param cxRequestInfo Additional resource adapter specific connection
* <p/>
* request information
* @return ManagedConnection instance
* @throws ResourceException generic exception
*/
public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException {
return new HelloWorldManagedConnection(this);
}
/**
* Returns a matched connection from the candidate set of connections.
*
* @param connectionSet Candidate connection set
* @param subject Caller's security information
* @param cxRequestInfo Additional resource adapter specific connection request information
* @return ManagedConnection if resource adapter finds an acceptable match otherwise null
* @throws ResourceException generic exception
*/
public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException {
return null;
}
@Override
public void setLogWriter(PrintWriter printWriter) throws ResourceException {
this.writer = printWriter;
}
@Override
public PrintWriter getLogWriter() throws ResourceException {
return this.writer;
}
/**
* Get the resource adapter
*
* @return The handle
*/
public ResourceAdapter getResourceAdapter() {
return ra;
}
/**
* Set the resource adapter
*
* @param ra The handle
*/
public void setResourceAdapter(ResourceAdapter ra) {
this.ra = ra;
}
public boolean equals(Object o) {
return super.equals(o);
}
public int hashCode() {
return super.hashCode();
}
}
| 5,273 | 27.819672 | 152 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/rar/HelloWorldConnectionFactory.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.rar;
import java.io.Serializable;
import jakarta.resource.Referenceable;
import jakarta.resource.ResourceException;
/**
* User: jpai
*/
public interface HelloWorldConnectionFactory extends Serializable, Referenceable {
/**
* Get connection from factory
*
* @return HelloWorldConnection instance
* @throws ResourceException Thrown if a connection can't be obtained
*/
HelloWorldConnection getConnection() throws ResourceException;
}
| 1,535 | 33.133333 | 82 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/rar/HelloWorldManagedConnection.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.rar;
import static org.wildfly.common.Assert.checkNotNullParam;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import jakarta.resource.NotSupportedException;
import jakarta.resource.ResourceException;
import jakarta.resource.spi.ConnectionEvent;
import jakarta.resource.spi.ConnectionEventListener;
import jakarta.resource.spi.ConnectionRequestInfo;
import jakarta.resource.spi.LocalTransaction;
import jakarta.resource.spi.ManagedConnection;
import jakarta.resource.spi.ManagedConnectionMetaData;
import javax.security.auth.Subject;
import javax.transaction.xa.XAResource;
/**
* User: jpai
*/
public class HelloWorldManagedConnection implements ManagedConnection {
/**
* MCF
*/
private HelloWorldManagedConnectionFactory mcf;
/**
* Listeners
*/
private List<jakarta.resource.spi.ConnectionEventListener> listeners;
/**
* Connection
*/
private Object connection;
private PrintWriter writer;
/**
* default constructor
*
* @param mcf mcf
*/
public HelloWorldManagedConnection(HelloWorldManagedConnectionFactory mcf) {
this.mcf = mcf;
this.listeners = new ArrayList<jakarta.resource.spi.ConnectionEventListener>();
this.connection = null;
}
/**
* Creates a new connection handle for the underlying physical connection
* <p/>
* represented by the ManagedConnection instance.
*
* @param subject Security context as JAAS subject
* @param cxRequestInfo ConnectionRequestInfo instance
* @return generic Object instance representing the connection handle.
* @throws ResourceException generic exception if operation fails
*/
public Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException {
connection = new HelloWorldConnectionImpl(this, mcf);
return connection;
}
/**
* Used by the container to change the association of an
* <p/>
* application-level connection handle with a ManagedConneciton instance.
*
* @param connection Application-level connection handle
* @throws ResourceException generic exception if operation fails
*/
public void associateConnection(Object connection) throws ResourceException {
this.connection = connection;
}
/**
* Application server calls this method to force any cleanup on
* <p/>
* the ManagedConnection instance.
*
* @throws ResourceException generic exception if operation fails
*/
public void cleanup() throws ResourceException {
}
/**
* Destroys the physical connection to the underlying resource manager.
*
* @throws ResourceException generic exception if operation fails
*/
public void destroy() throws ResourceException {
this.connection = null;
}
/**
* Adds a connection event listener to the ManagedConnection instance.
*
* @param listener A new ConnectionEventListener to be registered
*/
public void addConnectionEventListener(ConnectionEventListener listener) {
checkNotNullParam("listener", listener);
listeners.add(listener);
}
/**
* Removes an already registered connection event listener
* <p/>
* from the ManagedConnection instance.
*
* @param listener Already registered connection event listener to be removed
*/
public void removeConnectionEventListener(ConnectionEventListener listener) {
checkNotNullParam("listener", listener);
listeners.remove(listener);
}
/**
* Returns an <code>jakarta.resource.spi.LocalTransaction</code> instance.
*
* @return LocalTransaction instance
* @throws ResourceException generic exception if operation fails
*/
public LocalTransaction getLocalTransaction() throws ResourceException {
throw new NotSupportedException("LocalTransaction not supported");
}
/**
* Returns an <code>javax.transaction.xa.XAresource</code> instance.
*
* @return XAResource instance
* @throws ResourceException generic exception if operation fails
*/
public XAResource getXAResource() throws ResourceException {
throw new NotSupportedException("GetXAResource not supported");
}
/**
* Gets the metadata information for this connection's underlying
* <p/>
* EIS resource manager instance.
*
* @return ManagedConnectionMetaData instance
* @throws ResourceException generic exception if operation fails
*/
public ManagedConnectionMetaData getMetaData() throws ResourceException {
return new HelloWorldManagedConnectionMetaData();
}
@Override
public void setLogWriter(PrintWriter printWriter) throws ResourceException {
this.writer = printWriter;
}
@Override
public PrintWriter getLogWriter() throws ResourceException {
return this.writer;
}
/**
* Close handle
*
* @param handle The handle
*/
void closeHandle(HelloWorldConnection handle) {
ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
event.setConnectionHandle(handle);
for (jakarta.resource.spi.ConnectionEventListener cel : listeners) {
cel.connectionClosed(event);
}
}
}
| 6,511 | 26.476793 | 112 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/rar/RarDeploymentTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.rar;
import javax.naming.InitialContext;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.integration.rar.ejb.NoOpEJB;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests that a .rar deployed within a .ear doesn't run into deployment problems
*
* @author Jaikiran Pai
* @see https://issues.jboss.org/browse/AS7-2111
*/
@RunWith(Arquillian.class)
public class RarDeploymentTestCase {
/**
* .ear
* |
* |--- helloworld.rar
* |
* |--- ejb.jar
* |
* |--- META-INF
* | |
* | |--- application.xml containing <module> <connector>helloworld.rar</connector> </module>
*
* @return
*/
@Deployment
public static Archive createDeployment() {
final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, "ejb.jar");
ejbJar.addClass(NoOpEJB.class);
final JavaArchive rar = ShrinkWrap.create(JavaArchive.class, "helloworld.rar");
rar.addPackage(HelloWorldResourceAdapter.class.getPackage());
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "rar-in-ear-test.ear");
ear.addAsModule(rar);
ear.addAsModule(ejbJar);
ear.addAsManifestResource(RarDeploymentTestCase.class.getPackage(), "application.xml", "application.xml");
return ear;
}
/**
* Test the deployment succeeded.
*
* @throws Exception
*/
@Test
public void testDeployment() throws Exception {
final NoOpEJB noOpEJB = InitialContext.doLookup("java:app/ejb/" + NoOpEJB.class.getSimpleName());
noOpEJB.doNothing();
}
}
| 2,957 | 33.395349 | 114 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/rar/ejb/NoOpEJB.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.rar.ejb;
import jakarta.ejb.Stateless;
/**
* User: jpai
*/
@Stateless
public class NoOpEJB {
public void doNothing() {
}
}
| 1,199 | 31.432432 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/FakeJAXBContextFactory.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2020 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.test.integration.jaxb;
import java.util.Map;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBContextFactory;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.Unmarshaller;
/**
* <p>Fake JAXB context factory for testing.</p>
*
* @author rmartinc
*/
public class FakeJAXBContextFactory implements JAXBContextFactory {
private static class FakeJAXBContext extends JAXBContext {
@Override
public Unmarshaller createUnmarshaller() throws JAXBException {
throw new UnsupportedOperationException("Fake JAXB context, method not implemented!");
}
@Override
public Marshaller createMarshaller() throws JAXBException {
throw new UnsupportedOperationException("Fake JAXB context, method not implemented!");
}
@Override
public String toString() {
return FakeJAXBContext.class.getSimpleName();
}
}
@Override
public JAXBContext createContext(Class<?>[] types, Map<String, ?> map) throws JAXBException {
return new FakeJAXBContext();
}
@Override
public JAXBContext createContext(String string, ClassLoader cl, Map<String, ?> map) throws JAXBException {
return new FakeJAXBContext();
}
}
| 2,034 | 31.301587 | 110 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/JAXBContextServlet.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2020 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.test.integration.jaxb;
import java.io.IOException;
import java.io.PrintWriter;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import org.jboss.as.test.integration.jaxb.bindings.PurchaseOrderType;
/**
* <p>Servlet that shows the JAXBContext retrieved.</p>
*
* @author rmartinc
*/
@WebServlet (urlPatterns = JAXBContextServlet.URL_PATTERN)
public class JAXBContextServlet extends HttpServlet {
public static final String URL_PATTERN = "/jaxbContextServlet";
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
try {
JAXBContext ctx = JAXBContext.newInstance(PurchaseOrderType.class);
resp.setContentType("text/plain;charset=UTF-8");
try (PrintWriter out = resp.getWriter()) {
out.print(ctx);
}
} catch (JAXBException e) {
throw new ServletException(e);
}
}
}
| 1,930 | 34.759259 | 113 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/JAXBUsageServlet.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jaxb;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;
import org.jboss.as.test.integration.jaxb.bindings.PurchaseOrderType;
@WebServlet (urlPatterns = JAXBUsageServlet.URL_PATTERN)
public class JAXBUsageServlet extends HttpServlet {
public static final String URL_PATTERN = "/jaxbServlet";
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
try {
Unmarshaller unmarshaller = JAXBContext.newInstance("org.jboss.as.test.integration.jaxb.bindings").createUnmarshaller();
String xml = "<?xml version=\"1.0\"?>\n"
+ "<purchaseOrder orderDate=\"1999-10-20\">\n" +
" <shipTo country=\"US\">\n" +
" <name>Alice Smith</name>\n" +
" <street>123 Maple Street</street>\n" +
" <city>Mill Valley</city>\n" +
" <state>CA</state>\n" +
" <zip>90952</zip>\n" +
" </shipTo>\n" +
" <billTo country=\"US\">\n" +
" <name>Robert Smith</name>\n" +
" <street>8 Oak Avenue</street>\n" +
" <city>Old Town</city>\n" +
" <state>PA</state>\n" +
" <zip>95819</zip>\n" +
" </billTo>\n" +
" <comment>Hurry, my lawn is going wild!</comment>\n" +
" <items>\n" +
" <item partNum=\"872-AA\">\n" +
" <productName>Lawnmower</productName>\n" +
" <quantity>1</quantity>\n" +
" <USPrice>148.95</USPrice>\n" +
" <comment>Confirm this is electric</comment>\n" +
" </item>\n" +
" <item partNum=\"926-AA\">\n" +
" <productName>Baby Monitor</productName>\n" +
" <quantity>1</quantity>\n" +
" <USPrice>39.98</USPrice>\n" +
" <shipDate>1999-05-21</shipDate>\n" +
" </item>\n" +
" </items>\n" +
"</purchaseOrder>";
PurchaseOrderType order = ((JAXBElement<PurchaseOrderType>)unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)))).getValue();
resp.getOutputStream().println(order.getShipTo().getCity());
} catch (JAXBException e) {
throw new RuntimeException(e);
}
}
}
| 4,195 | 43.638298 | 170 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/bindings/ObjectFactory.java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.08.30 at 03:04:17 PM CDT
//
package org.jboss.as.test.integration.jaxb.bindings;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlElementDecl;
import jakarta.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the org.jboss.as.test.integration.jaxb.bindings package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private static final QName _PurchaseOrder_QNAME = new QName("", "purchaseOrder");
private static final QName _Comment_QNAME = new QName("", "comment");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jboss.as.test.integration.jaxb.bindings
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link Items }
*
*/
public Items createItems() {
return new Items();
}
/**
* Create an instance of {@link USAddress }
*
*/
public USAddress createUSAddress() {
return new USAddress();
}
/**
* Create an instance of {@link PurchaseOrderType }
*
*/
public PurchaseOrderType createPurchaseOrderType() {
return new PurchaseOrderType();
}
/**
* Create an instance of {@link Items.Item }
*
*/
public Items.Item createItemsItem() {
return new Items.Item();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link PurchaseOrderType }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "purchaseOrder")
public JAXBElement<PurchaseOrderType> createPurchaseOrder(PurchaseOrderType value) {
return new JAXBElement<PurchaseOrderType>(_PurchaseOrder_QNAME, PurchaseOrderType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "comment")
public JAXBElement<String> createComment(String value) {
return new JAXBElement<String>(_Comment_QNAME, String.class, null, value);
}
}
| 2,890 | 29.431579 | 157 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/bindings/Items.java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.08.30 at 03:04:17 PM CDT
//
package org.jboss.as.test.integration.jaxb.bindings;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* <p>Java class for Items complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Items">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="item" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="productName" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="quantity">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}positiveInteger">
* <maxExclusive value="100"/>
* </restriction>
* </simpleType>
* </element>
* <element name="USPrice" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element ref="{}comment" minOccurs="0"/>
* <element name="shipDate" type="{http://www.w3.org/2001/XMLSchema}date" minOccurs="0"/>
* </sequence>
* <attribute name="partNum" use="required" type="{}SKU" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Items", propOrder = {
"item"
})
public class Items {
protected List<Items.Item> item;
/**
* Gets the value of the item property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the item property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getItem().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Items.Item }
*
*
*/
public List<Items.Item> getItem() {
if (item == null) {
item = new ArrayList<Items.Item>();
}
return this.item;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="productName" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="quantity">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}positiveInteger">
* <maxExclusive value="100"/>
* </restriction>
* </simpleType>
* </element>
* <element name="USPrice" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element ref="{}comment" minOccurs="0"/>
* <element name="shipDate" type="{http://www.w3.org/2001/XMLSchema}date" minOccurs="0"/>
* </sequence>
* <attribute name="partNum" use="required" type="{}SKU" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"productName",
"quantity",
"usPrice",
"comment",
"shipDate"
})
public static class Item {
@XmlElement(required = true)
protected String productName;
protected int quantity;
@XmlElement(name = "USPrice", required = true)
protected BigDecimal usPrice;
protected String comment;
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar shipDate;
@XmlAttribute(required = true)
protected String partNum;
/**
* Gets the value of the productName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getProductName() {
return productName;
}
/**
* Sets the value of the productName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setProductName(String value) {
this.productName = value;
}
/**
* Gets the value of the quantity property.
*
*/
public int getQuantity() {
return quantity;
}
/**
* Sets the value of the quantity property.
*
*/
public void setQuantity(int value) {
this.quantity = value;
}
/**
* Gets the value of the usPrice property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getUSPrice() {
return usPrice;
}
/**
* Sets the value of the usPrice property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setUSPrice(BigDecimal value) {
this.usPrice = value;
}
/**
* Gets the value of the comment property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getComment() {
return comment;
}
/**
* Sets the value of the comment property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setComment(String value) {
this.comment = value;
}
/**
* Gets the value of the shipDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getShipDate() {
return shipDate;
}
/**
* Sets the value of the shipDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setShipDate(XMLGregorianCalendar value) {
this.shipDate = value;
}
/**
* Gets the value of the partNum property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPartNum() {
return partNum;
}
/**
* Sets the value of the partNum property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPartNum(String value) {
this.partNum = value;
}
}
}
| 8,380 | 27.800687 | 123 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/bindings/PurchaseOrderType.java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.08.30 at 03:04:17 PM CDT
//
package org.jboss.as.test.integration.jaxb.bindings;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* <p>Java class for PurchaseOrderType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="PurchaseOrderType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="shipTo" type="{}USAddress"/>
* <element name="billTo" type="{}USAddress"/>
* <element ref="{}comment" minOccurs="0"/>
* <element name="items" type="{}Items"/>
* </sequence>
* <attribute name="orderDate" type="{http://www.w3.org/2001/XMLSchema}date" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PurchaseOrderType", propOrder = {
"shipTo",
"billTo",
"comment",
"items"
})
public class PurchaseOrderType {
@XmlElement(required = true)
protected USAddress shipTo;
@XmlElement(required = true)
protected USAddress billTo;
protected String comment;
@XmlElement(required = true)
protected Items items;
@XmlAttribute
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar orderDate;
/**
* Gets the value of the shipTo property.
*
* @return
* possible object is
* {@link USAddress }
*
*/
public USAddress getShipTo() {
return shipTo;
}
/**
* Sets the value of the shipTo property.
*
* @param value
* allowed object is
* {@link USAddress }
*
*/
public void setShipTo(USAddress value) {
this.shipTo = value;
}
/**
* Gets the value of the billTo property.
*
* @return
* possible object is
* {@link USAddress }
*
*/
public USAddress getBillTo() {
return billTo;
}
/**
* Sets the value of the billTo property.
*
* @param value
* allowed object is
* {@link USAddress }
*
*/
public void setBillTo(USAddress value) {
this.billTo = value;
}
/**
* Gets the value of the comment property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getComment() {
return comment;
}
/**
* Sets the value of the comment property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setComment(String value) {
this.comment = value;
}
/**
* Gets the value of the items property.
*
* @return
* possible object is
* {@link Items }
*
*/
public Items getItems() {
return items;
}
/**
* Sets the value of the items property.
*
* @param value
* allowed object is
* {@link Items }
*
*/
public void setItems(Items value) {
this.items = value;
}
/**
* Gets the value of the orderDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getOrderDate() {
return orderDate;
}
/**
* Sets the value of the orderDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setOrderDate(XMLGregorianCalendar value) {
this.orderDate = value;
}
}
| 4,301 | 22.380435 | 123 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/bindings/USAddress.java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.08.30 at 03:04:17 PM CDT
//
package org.jboss.as.test.integration.jaxb.bindings;
import java.math.BigDecimal;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for USAddress complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="USAddress">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="street" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="city" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="state" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="zip" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* </sequence>
* <attribute name="country" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="US" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "USAddress", propOrder = {
"name",
"street",
"city",
"state",
"zip"
})
public class USAddress {
@XmlElement(required = true)
protected String name;
@XmlElement(required = true)
protected String street;
@XmlElement(required = true)
protected String city;
@XmlElement(required = true)
protected String state;
@XmlElement(required = true)
protected BigDecimal zip;
@XmlAttribute
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "NMTOKEN")
protected String country;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the street property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStreet() {
return street;
}
/**
* Sets the value of the street property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStreet(String value) {
this.street = value;
}
/**
* Gets the value of the city property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCity() {
return city;
}
/**
* Sets the value of the city property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCity(String value) {
this.city = value;
}
/**
* Gets the value of the state property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getState() {
return state;
}
/**
* Sets the value of the state property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setState(String value) {
this.state = value;
}
/**
* Gets the value of the zip property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getZip() {
return zip;
}
/**
* Sets the value of the zip property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setZip(BigDecimal value) {
this.zip = value;
}
/**
* Gets the value of the country property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCountry() {
if (country == null) {
return "US";
} else {
return country;
}
}
/**
* Sets the value of the country property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCountry(String value) {
this.country = value;
}
}
| 5,138 | 22.359091 | 123 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/unit/JAXBContextTestBase.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2020 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.test.integration.jaxb.unit;
import java.io.FilePermission;
import java.io.IOException;
import java.lang.reflect.ReflectPermission;
import java.net.URL;
import jakarta.xml.bind.JAXBContextFactory;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.hamcrest.CoreMatchers;
import org.hamcrest.Matcher;
import org.hamcrest.MatcherAssert;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.as.test.integration.jaxb.FakeJAXBContextFactory;
import org.jboss.as.test.integration.jaxb.JAXBContextServlet;
import org.jboss.as.test.integration.jaxb.JAXBUsageServlet;
import org.jboss.as.test.integration.jaxb.bindings.Items;
import org.jboss.as.test.integration.jaxb.bindings.ObjectFactory;
import org.jboss.as.test.integration.jaxb.bindings.PurchaseOrderType;
import org.jboss.as.test.integration.jaxb.bindings.USAddress;
import org.jboss.as.test.shared.integration.ejb.security.PermissionUtils;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
/**
* <p>Base class for all the JAXB loading tests</p>
*
* @author rmartinc
*/
public abstract class JAXBContextTestBase {
protected static final String WEB_APP_INTERNAL_CONTEXT = "jaxb-internal-webapp";
protected static final String WEB_APP_CUSTOM_CONTEXT = "jaxb-custom-webapp";
protected static final String JAKARTA_FACTORY_PROP_NAME = JAXBContextFactory.class.getName();
protected static final String JAVAX_FACTORY_PROP_NAME = JAXBContextFactory.class.getName().replaceFirst("jakarta.", "javax.");
protected static final String JAVAX_JAXB_FACTORY_CLASS = "com.sun.xml.bind.v2.JAXBContextFactory";
protected static final String JAKARTA_JAXB_FACTORY_CLASS = "org.glassfish.jaxb.runtime.v2.JAXBContextFactory";
protected static final String CUSTOM_JAXB_FACTORY_CLASS = FakeJAXBContextFactory.class.getName();
protected static final String JAXB_PROPERTIES_FILE = "WEB-INF/classes/org/jboss/as/test/integration/jaxb/bindings/jaxb.properties";
protected static final String SERVICES_FILE = "META-INF/services/" + JAKARTA_FACTORY_PROP_NAME;
protected static final String PERMISSIONS_FILE = "META-INF/permissions.xml";
@ArquillianResource
protected URL url;
public static WebArchive createInternalDeployment() {
final WebArchive war = ShrinkWrap.create(WebArchive.class, WEB_APP_INTERNAL_CONTEXT + ".war");
war.addClasses(JAXBContextServlet.class, JAXBUsageServlet.class, Items.class, ObjectFactory.class, PurchaseOrderType.class, USAddress.class);
war.add(PermissionUtils.createPermissionsXmlAsset(
new RuntimePermission("accessDeclaredMembers"),
new ReflectPermission("suppressAccessChecks"),
new FilePermission("<<ALL FILES>>", "read")), PERMISSIONS_FILE);
return war;
}
public static WebArchive createCustomDeployment() {
final WebArchive war = ShrinkWrap.create(WebArchive.class, WEB_APP_CUSTOM_CONTEXT + ".war");
war.addClasses(JAXBContextServlet.class, Items.class, ObjectFactory.class, PurchaseOrderType.class, USAddress.class, FakeJAXBContextFactory.class);
return war;
}
protected void testDeafultImplementation(URL url) throws IOException {
// test the internal implementation is returned
try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
final String requestURL = url.toExternalForm() + JAXBContextServlet.URL_PATTERN;
final HttpGet request = new HttpGet(requestURL);
final HttpResponse response = httpClient.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
Assert.assertEquals("Unexpected status code", 200, statusCode);
final HttpEntity entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
final String responseMessage = EntityUtils.toString(entity);
Matcher matcher1 = CoreMatchers.containsString("/com/sun/xml/bind/v2/runtime/JAXBContextImpl");
Matcher matcher2 = CoreMatchers.containsString("/org/glassfish/jaxb/runtime/v2/runtime/JAXBContextImpl");
MatcherAssert.assertThat(responseMessage, CoreMatchers.either(matcher1).or(matcher2));
}
// test it works
try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
final String requestURL = url.toExternalForm() + JAXBUsageServlet.URL_PATTERN;
final HttpGet request = new HttpGet(requestURL);
final HttpResponse response = httpClient.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
Assert.assertEquals("Unexpected status code", 200, statusCode);
final HttpEntity entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
final String responseMessage = EntityUtils.toString(entity);
Assert.assertEquals("Wrong return value", "Mill Valley", responseMessage.trim());
}
}
protected void testCustomImplementation(URL url) throws IOException {
// test the custom jaxb context is returned
try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
final String requestURL = url.toExternalForm() + JAXBContextServlet.URL_PATTERN;
final HttpGet request = new HttpGet(requestURL);
final HttpResponse response = httpClient.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
Assert.assertEquals("Unexpected status code", 200, statusCode);
final HttpEntity entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
final String responseMessage = EntityUtils.toString(entity);
Assert.assertEquals("Fake context is returned", "FakeJAXBContext", responseMessage);
}
}
}
| 7,002 | 52.869231 | 155 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/unit/JAXBContextUsingPropertiesTestCase.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2020 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.test.integration.jaxb.unit;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* <p>Test for JAXB using a <em>jaxb.properties</em> file. The test will try to
* use the default implementation inside the module and a custom/fake one.</p>
*
* @author rmartinc
*/
@RunWith(Arquillian.class)
@RunAsClient
public class JAXBContextUsingPropertiesTestCase extends JAXBContextTestBase {
@Deployment(name = "app-internal", testable = false)
public static WebArchive createInternalDeployment() {
final WebArchive war = JAXBContextTestBase.createInternalDeployment();
String nl = System.getProperty("line.separator");
war.add(new StringAsset(
JAVAX_FACTORY_PROP_NAME + "=" + JAVAX_JAXB_FACTORY_CLASS + nl
+ JAKARTA_FACTORY_PROP_NAME + "=" + JAKARTA_JAXB_FACTORY_CLASS),
JAXB_PROPERTIES_FILE);
return war;
}
@Deployment(name = "app-custom", testable = false)
public static WebArchive createCustomDeployment() {
final WebArchive war = JAXBContextTestBase.createCustomDeployment();
String nl = System.getProperty("line.separator");
war.add(new StringAsset(
JAVAX_FACTORY_PROP_NAME + "=" + CUSTOM_JAXB_FACTORY_CLASS + nl
+ JAKARTA_FACTORY_PROP_NAME + "=" + CUSTOM_JAXB_FACTORY_CLASS),
JAXB_PROPERTIES_FILE);
return war;
}
@OperateOnDeployment("app-internal")
@Test
public void testInternal() throws Exception {
testDeafultImplementation(url);
}
@OperateOnDeployment("app-custom")
@Test
@Ignore("WFLY-16523")
public void testCustom() throws Exception {
testCustomImplementation(url);
}
}
| 2,812 | 36.506667 | 80 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/unit/JAXBContextUsingServicesTestCase.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2020 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.test.integration.jaxb.unit;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* <p>Test for JAXB using a <em>META-INF/services/</em> file. The test will try
* to use the custom/fake implementation provided by the app.</p>
*
* @author rmartinc
*/
@RunWith(Arquillian.class)
@RunAsClient
@Ignore("WFLY-16523")
public class JAXBContextUsingServicesTestCase extends JAXBContextTestBase {
@Deployment(name = "app-custom", testable = false)
public static WebArchive createCustomDeployment() {
final WebArchive war = JAXBContextTestBase.createCustomDeployment();
war.add(new StringAsset(CUSTOM_JAXB_FACTORY_CLASS), SERVICES_FILE);
return war;
}
@OperateOnDeployment("app-custom")
@Test
public void testCustom() throws Exception {
testCustomImplementation(url);
}
}
| 1,922 | 34.611111 | 79 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/unit/JAXBContextSystemPropInternalTestCase.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2020 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.test.integration.jaxb.unit;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.arquillian.api.ServerSetup;
import org.jboss.as.test.integration.security.common.AbstractSystemPropertiesServerSetupTask;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* <p>Test for JAXB using a System Property. The test will try using the
* default implementation inside the module.</p>
*
* @author rmartinc
*/
@RunWith(Arquillian.class)
@ServerSetup({JAXBContextSystemPropInternalTestCase.SystemPropertiesSetup.class})
@RunAsClient
public class JAXBContextSystemPropInternalTestCase extends JAXBContextTestBase {
/**
* Setup the system property to configure internal jaxb implementation.
*/
static class SystemPropertiesSetup extends AbstractSystemPropertiesServerSetupTask {
@Override
protected SystemProperty[] getSystemProperties() {
return new SystemProperty[] {
new DefaultSystemProperty(JAVAX_FACTORY_PROP_NAME, JAVAX_JAXB_FACTORY_CLASS),
new DefaultSystemProperty(JAKARTA_FACTORY_PROP_NAME, JAKARTA_JAXB_FACTORY_CLASS)
};
}
}
@Deployment(name = "app-internal", testable = false)
public static WebArchive createInternalDeployment() {
return JAXBContextTestBase.createInternalDeployment();
}
@OperateOnDeployment("app-internal")
@Test
public void testInternal() throws Exception {
testDeafultImplementation(url);
}
}
| 2,451 | 36.151515 | 96 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/unit/JAXBContextSystemPropCustomTestCase.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2020 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.test.integration.jaxb.unit;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.arquillian.api.ServerSetup;
import org.jboss.as.test.integration.security.common.AbstractSystemPropertiesServerSetupTask;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* <p>Test for JAXB using a System Property. The test will try using a
* custom/fake implementation.</p>
*
* @author rmartinc
*/
@RunWith(Arquillian.class)
@ServerSetup({JAXBContextSystemPropCustomTestCase.SystemPropertiesSetup.class})
@RunAsClient
public class JAXBContextSystemPropCustomTestCase extends JAXBContextTestBase {
/**
* Setup the system property to configure the custom jaxb implementation.
*/
static class SystemPropertiesSetup extends AbstractSystemPropertiesServerSetupTask {
@Override
protected SystemProperty[] getSystemProperties() {
return new SystemProperty[] {
new DefaultSystemProperty(JAVAX_FACTORY_PROP_NAME, CUSTOM_JAXB_FACTORY_CLASS),
new DefaultSystemProperty(JAKARTA_FACTORY_PROP_NAME, CUSTOM_JAXB_FACTORY_CLASS)
};
}
}
@Deployment(name = "app-custom", testable = false)
public static WebArchive createCustomDeployment() {
return JAXBContextTestBase.createCustomDeployment();
}
@OperateOnDeployment("app-custom")
@Test
public void testCustom() throws Exception {
testCustomImplementation(url);
}
}
| 2,422 | 35.712121 | 95 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxb/unit/JAXBUsageTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.jaxb.unit;
import java.net.URL;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.as.test.integration.jaxb.JAXBUsageServlet;
import org.jboss.as.test.integration.jaxb.bindings.Items;
import org.jboss.as.test.integration.jaxb.bindings.ObjectFactory;
import org.jboss.as.test.integration.jaxb.bindings.PurchaseOrderType;
import org.jboss.as.test.integration.jaxb.bindings.USAddress;
import org.jboss.as.test.shared.SecurityManagerFailure;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests that JAXB is usable from a WAR
*
* @author Jason T. Greene
*/
@RunWith(Arquillian.class)
@RunAsClient
public class JAXBUsageTestCase {
private static final String WEB_APP_CONTEXT = "jaxb-webapp";
@ArquillianResource
private URL url;
/**
* Create a .ear, containing a web application (without any Jakarta Server Faces constructs) and also the xerces jar in the .ear/lib
*
* @return
*/
@Deployment(name = "app", testable = false)
public static WebArchive createDeployment() {
final WebArchive war = ShrinkWrap.create(WebArchive.class, WEB_APP_CONTEXT + ".war");
war.addClasses(JAXBUsageServlet.class, Items.class, ObjectFactory.class, PurchaseOrderType.class, USAddress.class);
return war;
}
@BeforeClass
public static void beforeClass() {
SecurityManagerFailure.thisTestIsFailingUnderSM("WFLY-6192");
}
@OperateOnDeployment("app")
@Test
public void testJAXBServlet() throws Exception {
final HttpClient httpClient = new DefaultHttpClient();
final String xml = "dummy.xml";
final String requestURL = url.toExternalForm() + JAXBUsageServlet.URL_PATTERN;
final HttpGet request = new HttpGet(requestURL);
final HttpResponse response = httpClient.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
Assert.assertEquals("Unexpected status code", 200, statusCode);
final HttpEntity entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
final String responseMessage = EntityUtils.toString(entity);
Assert.assertEquals("Wrong return value", "Mill Valley", responseMessage.trim());
}
}
| 3,986 | 39.272727 | 136 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/configuration/nonportablemode/NonPortableExtension.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.configuration.nonportablemode;
import jakarta.enterprise.event.Observes;import jakarta.enterprise.inject.spi.AfterBeanDiscovery;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
import jakarta.enterprise.inject.spi.Extension;
public class NonPortableExtension implements Extension {
void beforeDiscovery(@Observes BeforeBeanDiscovery event, BeanManager manager) {
manager.getBeans("foo"); // this call is not allowed in the BeforeBeanDiscovery phase
}
void beansDiscovered(@Observes AfterBeanDiscovery event, BeanManager manager) {
manager.getBeans("foo"); // this call is not allowed in the AfterBeanDiscovery phase
}
}
| 1,776 | 43.425 | 97 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/configuration/nonportablemode/NonPortableModeTest.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.configuration.nonportablemode;
import jakarta.enterprise.inject.spi.Extension;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(Arquillian.class)
public class NonPortableModeTest {
@Deployment
public static Archive<?> getDeployment() {
return ShrinkWrap.create(WebArchive.class).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addPackage(NonPortableModeTest.class.getPackage())
.addAsServiceProvider(Extension.class, NonPortableExtension.class)
.addAsManifestResource(NonPortableModeTest.class.getPackage(), "jboss-all.xml", "jboss-all.xml");
}
@Test
public void testApplicationDeploys(NonPortableExtension extension) {
// in the strict mode, the extension would fail to deploy
Assert.assertNotNull(extension);
}
}
| 2,195 | 41.230769 | 155 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/configuration/requirebeandescriptor/RequireBeanDescriptorTest.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.configuration.requirebeandescriptor;
import jakarta.enterprise.inject.spi.BeanManager;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(Arquillian.class)
public class RequireBeanDescriptorTest {
@Deployment
public static Archive<?> getDeployment() {
JavaArchive library = ShrinkWrap.create(JavaArchive.class).addClass(Bar.class);
return ShrinkWrap.create(WebArchive.class).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addClasses(Foo.class)
.addAsManifestResource(RequireBeanDescriptorTest.class.getPackage(), "jboss-all.xml", "jboss-all.xml")
.addAsLibrary(library);
}
@Test
public void testImplicitBeanArchiveWithoutBeanDescriptorNotDiscovered(BeanManager manager) {
Assert.assertEquals(1, manager.getBeans(Foo.class).size());
Assert.assertEquals(Foo.class, manager.getBeans(Foo.class).iterator().next().getBeanClass());
Assert.assertTrue(manager.getBeans(Bar.class).isEmpty());
}
}
| 2,450 | 42.767857 | 118 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/configuration/requirebeandescriptor/Bar.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.configuration.requirebeandescriptor;
import jakarta.enterprise.context.RequestScoped;
@RequestScoped
public class Bar extends Foo {
}
| 1,196 | 38.9 | 79 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/configuration/requirebeandescriptor/Foo.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.configuration.requirebeandescriptor;
import jakarta.enterprise.context.RequestScoped;
@RequestScoped
public class Foo {
}
| 1,184 | 38.5 | 79 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/Multiple2.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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
* 2110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.test.integration.weld.modules;
import jakarta.inject.Inject;
/**
* @author Stuart Douglas
*/
public class Multiple2 {
@Inject
private Multiple1 multiple1;
public String getMessage() {
return multiple1.getMessage();
}
}
| 1,293 | 32.179487 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/BravoBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
public class BravoBean implements Comparable<Integer> {
@Override
public int compareTo(Integer o) {
return -1;
}
}
| 1,211 | 39.4 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/CharlieBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
public class CharlieBean implements Comparable<Integer> {
@Override
public int compareTo(Integer o) {
return -1;
}
}
| 1,213 | 39.466667 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/PortableExtensionModuleLookup.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
@ApplicationScoped
public class PortableExtensionModuleLookup implements PortableExtensionLookup {
@Inject
private PortableExtension portableExtension;
@Override
public PortableExtension getPortableExtension() {
return portableExtension;
}
}
| 1,432 | 36.710526 | 79 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/PortableExtensionLookup.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
public interface PortableExtensionLookup {
PortableExtension getPortableExtension();
}
| 1,168 | 40.75 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/DeltaLookup.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;
public class DeltaLookup {
@Inject
private Instance<Comparable<Integer>> instance;
public Instance<Comparable<Integer>> getInstance() {
return instance;
}
}
| 1,333 | 36.055556 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/DeltaBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
public class DeltaBean implements Comparable<Integer> {
@Override
public int compareTo(Integer o) {
return -1;
}
}
| 1,211 | 39.4 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/MultipleJarInModuleTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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
* 2110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.test.integration.weld.modules;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import jakarta.inject.Inject;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
/**
* Tests that multiple jars in a module are handled correctly
*
* see WFLY-3419
*
*/
@RunWith(Arquillian.class)
public class MultipleJarInModuleTestCase {
private static final List<TestModule> testModules = new ArrayList<>();
public static void doSetup() throws Exception {
URL url = MultipleJarInModuleTestCase.class.getResource("multiple-module.xml");
File moduleXmlFile = new File(url.toURI());
TestModule testModule = new TestModule("test.multiple", moduleXmlFile);
JavaArchive jar = testModule.addResource("m1.jar");
jar.addClass(Multiple1.class);
jar.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
jar = testModule.addResource("m2.jar");
jar.addClass(Multiple2.class);
jar.addAsManifestResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml");
testModules.add(testModule);
testModule.create(true);
}
@AfterClass
public static void tearDown() throws Exception {
for (TestModule testModule : testModules) {
testModule.remove();
}
}
@Deployment
public static Archive<?> getDeployment() throws Exception {
doSetup();
WebArchive war = ShrinkWrap.create(WebArchive.class)
.addClass(MultipleJarInModuleTestCase.class)
.addClass(TestModule.class)
.addAsWebInfResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: test.multiple meta-inf\n"), "MANIFEST.MF");
return war;
}
@Inject
private Multiple2 multiple2;
@Test
public void testMultipleJarsInModule() {
Assert.assertEquals("hello", multiple2.getMessage());
}
}
| 3,569 | 35.804124 | 113 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/AlphaBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
public class AlphaBean implements Comparable<Integer> {
@Override
public int compareTo(Integer o) {
return -1;
}
}
| 1,211 | 39.4 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/CrossModuleAccessibilityTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import jakarta.enterprise.inject.Instance;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests accessibility between modules deployed in WF.
*
* There are four built-in modules installed at the beginning of the test case: alpha, bravo, charlie and delta.
* The deployed testing application has a dependency on each of these modules. The following additional dependencies
* exist:
*
* alpha -> bravo
* bravo -> charlie
*
* Otherwise, the modules cannot access each other.
*
* @see WFLY-1746
*
* @author Jozef Hartinger
*
*/
@RunWith(Arquillian.class)
public class CrossModuleAccessibilityTestCase {
private static final List<TestModule> testModules = new ArrayList<>();
public static void doSetup() throws Exception {
addModule("alpha", "alpha-module.xml", AlphaBean.class, AlphaLookup.class);
addModule("bravo", "bravo-module.xml", BravoBean.class, BravoLookup.class);
addModule("charlie", "charlie-module.xml", CharlieBean.class, CharlieLookup.class);
addModule("delta", "delta-module.xml", DeltaBean.class, DeltaLookup.class);
}
private static void addModule(String moduleName, String moduleXml, Class<?> beanType, Class<?> lookupType) throws Exception {
URL url = beanType.getResource(moduleXml);
File moduleXmlFile = new File(url.toURI());
TestModule testModule = new TestModule("test." + moduleName, moduleXmlFile);
JavaArchive jar = testModule.addResource(moduleName + ".jar");
jar.addClass(beanType);
jar.addClass(lookupType);
jar.addAsManifestResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml");
testModules.add(testModule);
testModule.create(true);
}
@AfterClass
public static void tearDown() throws Exception {
for (TestModule testModule : testModules) {
testModule.remove();
}
}
@Deployment
public static Archive<?> getDeployment() throws Exception {
doSetup();
WebArchive war = ShrinkWrap.create(WebArchive.class, "CrossModuleAccessibilityTestCase.war")
.addClass(CrossModuleAccessibilityTestCase.class)
.addClass(TestModule.class)
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: test.alpha meta-inf, test.bravo meta-inf, test.charlie meta-inf, test.delta meta-inf\n"), "MANIFEST.MF");
return ShrinkWrap.create(EnterpriseArchive.class, "CrossModuleAccessibilityTestCase.ear").addAsModule(war);
}
@Test
public void testAlphaModule(AlphaLookup alpha) {
Assert.assertNotNull(alpha);
Set<String> accessibleImplementations = getAccessibleImplementations(alpha.getInstance());
Assert.assertTrue(accessibleImplementations.contains(AlphaBean.class.getSimpleName()));
Assert.assertTrue(accessibleImplementations.contains(BravoBean.class.getSimpleName()));
Assert.assertFalse(accessibleImplementations.contains(CharlieBean.class.getSimpleName()));
Assert.assertFalse(accessibleImplementations.contains(DeltaBean.class.getSimpleName()));
}
@Test
public void testBravoModule(BravoLookup bravo) {
Assert.assertNotNull(bravo);
Set<String> accessibleImplementations = getAccessibleImplementations(bravo.getInstance());
Assert.assertFalse(accessibleImplementations.contains(AlphaBean.class.getSimpleName()));
Assert.assertTrue(accessibleImplementations.contains(BravoBean.class.getSimpleName()));
Assert.assertTrue(accessibleImplementations.contains(CharlieBean.class.getSimpleName()));
Assert.assertFalse(accessibleImplementations.contains(DeltaBean.class.getSimpleName()));
}
@Test
public void testCharlieModule(CharlieLookup charlie) {
Assert.assertNotNull(charlie);
Set<String> accessibleImplementations = getAccessibleImplementations(charlie.getInstance());
Assert.assertFalse(accessibleImplementations.contains(AlphaBean.class.getSimpleName()));
Assert.assertFalse(accessibleImplementations.contains(BravoBean.class.getSimpleName()));
Assert.assertTrue(accessibleImplementations.contains(CharlieBean.class.getSimpleName()));
Assert.assertFalse(accessibleImplementations.contains(DeltaBean.class.getSimpleName()));
}
@Test
public void testDeltaModule(DeltaLookup delta) {
Assert.assertNotNull(delta);
Set<String> accessibleImplementations = getAccessibleImplementations(delta.getInstance());
Assert.assertFalse(accessibleImplementations.contains(AlphaBean.class.getSimpleName()));
Assert.assertFalse(accessibleImplementations.contains(BravoBean.class.getSimpleName()));
Assert.assertFalse(accessibleImplementations.contains(CharlieBean.class.getSimpleName()));
Assert.assertTrue(accessibleImplementations.contains(DeltaBean.class.getSimpleName()));
}
private Set<String> getAccessibleImplementations(Instance<Comparable<Integer>> instance) {
Set<String> result = new HashSet<>();
for (Object object : instance) {
result.add(object.getClass().getSimpleName());
}
return result;
}
}
| 7,045 | 44.166667 | 175 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/Multiple1.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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
* 2110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.test.integration.weld.modules;
import jakarta.enterprise.context.ApplicationScoped;
/**
* @author Stuart Douglas
*/
@ApplicationScoped
public class Multiple1 {
public String getMessage() {
return "hello";
}
}
| 1,274 | 33.459459 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/CharlieLookup.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;
public class CharlieLookup {
@Inject
private Instance<Comparable<Integer>> instance;
public Instance<Comparable<Integer>> getInstance() {
return instance;
}
}
| 1,335 | 36.111111 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/PortableExtension.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.Extension;
import jakarta.enterprise.inject.spi.ProcessAnnotatedType;
@ApplicationScoped
public class PortableExtension implements Extension {
private BeanManager beanManager;
public <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> event, final BeanManager beanManager) {
this.beanManager = beanManager;
}
public BeanManager getBeanManager() {
return this.beanManager;
}
}
| 1,686 | 38.232558 | 114 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/PortableExtensionSubdeploymentLookup.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
import jakarta.ejb.Stateless;
import jakarta.inject.Inject;
@Stateless
public class PortableExtensionSubdeploymentLookup implements PortableExtensionLookup {
@Inject
private PortableExtension portableExtension;
@Override
public PortableExtension getPortableExtension() {
return portableExtension;
}
}
| 1,408 | 36.078947 | 86 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/BravoLookup.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;
public class BravoLookup {
@Inject
private Instance<Comparable<Integer>> instance;
public Instance<Comparable<Integer>> getInstance() {
return instance;
}
}
| 1,333 | 36.055556 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/AlphaLookup.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;
public class AlphaLookup {
@Inject
private Instance<Comparable<Integer>> instance;
public Instance<Comparable<Integer>> getInstance() {
return instance;
}
}
| 1,333 | 36.055556 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/PortableExtensionLibraryLookup.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
@ApplicationScoped
public class PortableExtensionLibraryLookup implements PortableExtensionLookup {
@Inject
private PortableExtension portableExtension;
@Override
public PortableExtension getPortableExtension() {
return portableExtension;
}
}
| 1,433 | 36.736842 | 80 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/PortableExtensionInExternalModuleTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules;
import java.io.File;
import java.net.URL;
import jakarta.ejb.EJB;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.as.test.shared.ModuleUtils;
import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests the deployment of simple enterprise application depending on some external WFLY module. The external WFLY module
* defines beans and contains an extension (application scoped by default) which can be injected into
* <ul>
* <li>module itself</li>
* <li>utility library in application</li>
* <li>EJB sub-deployment in application</li>
* <li>WAR sub-deployment in application</li>
* </ul>
*
* @see WFLY-1746
*
* @author Petr Andreev
*
*/
@RunWith(Arquillian.class)
public class PortableExtensionInExternalModuleTestCase {
private static final Logger log = Logger.getLogger(PortableExtensionInExternalModuleTestCase.class.getName());
private static final String MANIFEST = "MANIFEST.MF";
private static final String MODULE_NAME = "portable-extension";
private static TestModule testModule;
@Inject
private PortableExtension extension;
/**
* The CDI-style EJB injection into the the test-case does not work!
*/
@EJB(mappedName = "java:global/test/ejb-subdeployment/PortableExtensionSubdeploymentLookup")
private PortableExtensionLookup ejbInjectionTarget;
public static void doSetup() throws Exception {
URL url = PortableExtension.class.getResource(MODULE_NAME + "-module.xml");
File moduleXmlFile = new File(url.toURI());
testModule = new TestModule("test." + MODULE_NAME, moduleXmlFile);
testModule.addResource("portable-extension.jar")
.addClasses(PortableExtension.class, PortableExtensionLookup.class, PortableExtensionModuleLookup.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
testModule.addClassCallback(ModuleUtils.ENTERPRISE_INJECT);
testModule.create();
}
@AfterClass
public static void tearDown() throws Exception {
testModule.remove();
}
@Deployment
public static EnterpriseArchive getDeployment() throws Exception {
doSetup();
JavaArchive library = ShrinkWrap.create(JavaArchive.class, "library.jar")
.addClasses(PortableExtensionLibraryLookup.class)
.addAsManifestResource(newBeans11Descriptor("annotated"), "beans.xml");
JavaArchive ejbSubdeployment = ShrinkWrap.create(JavaArchive.class, "ejb-subdeployment.jar")
.addClass(PortableExtensionSubdeploymentLookup.class)
// the CDI injection does not work neither with empty nor with 'all'!
.addAsManifestResource(newBeans11Descriptor("all"), "beans.xml");
WebArchive webSubdeployment = ShrinkWrap.create(WebArchive.class, "web-subdeployment.war")
.addClass(PortableExtensionInExternalModuleTestCase.class)
.addClass(TestModule.class)
.addAsWebInfResource(newBeans11Descriptor("annotated"), "beans.xml");
return ShrinkWrap.create(EnterpriseArchive.class, "test.ear").addAsLibrary(library).addAsModule(ejbSubdeployment)
.addAsModule(webSubdeployment)
// add EAR-wide dependency on external module
.addAsManifestResource(getModuleDependencies(), MANIFEST);
// Adding the deployment structure does not work: the interface PortableExtensionLookup is not on application class-path
// .addAsApplicationResource(getDeploymentStructure(), "jboss-deployment-structure.xml");
}
@Test
public void testInModule(PortableExtensionModuleLookup injectionTarget) {
assertPortableExtensionInjection(injectionTarget);
}
@Test
public void testInLibrary(PortableExtensionLibraryLookup injectionTarget) {
assertPortableExtensionInjection(injectionTarget);
}
/**
* The injectionTarget argument is not injected for EJB!
*
* @param injectionTarget
*/
@Test
public void testInEjbSubdeployment(PortableExtensionSubdeploymentLookup injectionTarget) {
assertPortableExtensionInjection(this.ejbInjectionTarget);
}
@Test
public void testInWarSubdeployment() {
Assert.assertNotNull(extension);
BeanManager beanManager = extension.getBeanManager();
Assert.assertNotNull(beanManager);
}
private void assertPortableExtensionInjection(PortableExtensionLookup injectionTarget) {
Assert.assertNotNull(injectionTarget);
PortableExtension extension = injectionTarget.getPortableExtension();
Assert.assertNotNull(extension);
BeanManager beanManager = extension.getBeanManager();
Assert.assertNotNull(beanManager);
}
private static StringAsset newBeans11Descriptor(String mode) {
return new StringAsset("<beans bean-discovery-mode=\"" + mode + "\" version=\"1.1\"/>");
}
private static Asset getModuleDependencies() {
return new StringAsset("Dependencies: test." + MODULE_NAME + " meta-inf\n");
}
@SuppressWarnings("unused")
private static Asset jbossDeploymentStructure() {
return new StringAsset("<jboss-deployment-structure xmlns=\"urn:jboss:deployment-structure:1.2\">\n"
+ "<deployment>\n<dependencies>\n<module name=\"test." + MODULE_NAME
+ "\" meta-inf=\"import\"/>\n</dependencies>\n</deployment>\n</jboss-deployment-structure>");
}
@SuppressWarnings("unused")
private static StringAsset emptyEjbJar() {
return new StringAsset(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<ejb-jar xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" \n"
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n"
+ " xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2.xsd\"\n"
+ " version=\"3.2\">\n\n</ejb-jar>");
}
}
| 7,760 | 40.725806 | 147 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/dependency/ModuleBBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.dependency;
import jakarta.enterprise.context.ApplicationScoped;
/**
*
* @author <a href="mailto:[email protected]">Matej Novotny</a>
*/
@ApplicationScoped
public class ModuleBBean {
public String ping() {
return ModuleBBean.class.getSimpleName();
}
}
| 1,350 | 35.513514 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/dependency/WarBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.dependency;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
/**
*
* @author <a href="mailto:[email protected]">Matej Novotny</a>
*/
@ApplicationScoped
public class WarBean {
@Inject
private ModuleABean moduleABean;
public ModuleABean getModuleABean() {
return moduleABean;
}
}
| 1,419 | 33.634146 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/dependency/StaticCdiModulesDependencyTest.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.dependency;
import java.io.File;
import jakarta.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.as.test.shared.ModuleUtils;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
*
* @author <a href="mailto:[email protected]">Matej Novotny</a>
*/
@RunWith(Arquillian.class)
public class StaticCdiModulesDependencyTest {
private static final String MODULE_NAME_A = "weld-module-A";
private static final String MODULE_NAME_B = "weld-module-B";
private static TestModule testModuleA;
private static TestModule testModuleB;
public static void doSetup() throws Exception {
testModuleB = ModuleUtils.createTestModuleWithEEDependencies(MODULE_NAME_B);
testModuleB.addResource("test-module-b.jar")
.addClasses(ModuleBBean.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
testModuleB.create();
// load the module.xml file and use it to create module, we need this to have Module B as exported dependency
File moduleFile = new File(ModuleABean.class.getResource("moduleA.xml").toURI());
testModuleA = new TestModule("test." + MODULE_NAME_A, moduleFile);
testModuleA.addResource("test-module-a.jar")
.addClasses(ModuleABean.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
testModuleA.create();
}
@AfterClass
public static void tearDown() throws Exception {
testModuleA.remove();
testModuleB.remove();
}
@Deployment
public static WebArchive getDeployment() throws Exception {
// create modules and deploy them
doSetup();
return ShrinkWrap.create(WebArchive.class)
.addClasses(StaticCdiModulesDependencyTest.class, WarBean.class, TestModule.class)
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: test." + MODULE_NAME_A + " meta-inf export\n"), "MANIFEST.MF");
}
@Inject
WarBean warBean;
@Test
public void testBeanAccessibilities() {
// test that WAR can use Module A bean
Assert.assertEquals(ModuleABean.class.getSimpleName(), warBean.getModuleABean().ping());
// verify that you can do WAR -> Module A -> Module B
// this way we verify that module a can see and use beans from module B
Assert.assertEquals(ModuleBBean.class.getSimpleName(), warBean.getModuleABean().pingModuleBBean());
}
}
| 3,949 | 39.721649 | 129 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/dependency/ModuleABean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.dependency;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
/**
*
* @author <a href="mailto:[email protected]">Matej Novotny</a>
*/
@ApplicationScoped
public class ModuleABean {
@Inject
private ModuleBBean moduleBBean;
public String ping() {
return ModuleABean.class.getSimpleName();
}
public String pingModuleBBean() {
return moduleBBean.ping();
}
}
| 1,510 | 32.577778 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/alias/ModuleBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.alias;
import jakarta.enterprise.context.ApplicationScoped;
/**
*
* @author <a href="mailto:[email protected]">Bartosz Spyrko-Smietanko</a>
*/
@ApplicationScoped
public class ModuleBean {
public String test() {
return "test";
}
}
| 1,328 | 34.918919 | 76 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/alias/WarBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.alias;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
/**
*
* @author <a href="mailto:[email protected]">Bartosz Spyrko-Smietanko</a>
*/
@ApplicationScoped
public class WarBean {
@Inject
private ModuleBean moduleBean;
public ModuleBean getInjectedBean() {
return moduleBean;
}
}
| 1,422 | 33.707317 | 76 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/alias/AliasCdiModulesDependencyTest.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.alias;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.as.test.shared.ModuleUtils;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import jakarta.inject.Inject;
import java.io.File;
/**
*
* @author <a href="mailto:[email protected]">Bartosz Spyrko-Smietanko</a>
*/
@RunWith(Arquillian.class)
public class AliasCdiModulesDependencyTest {
private static final String REF_MODULE_NAME = "weld-module-ref";
private static final String IMPL_MODULE_NAME = "weld-module-impl";
private static final String ALIAS_MODULE_NAME = "weld-module-alias";
private static TestModule testModuleRef;
private static TestModule testModuleImpl;
private static TestModule testModuleAlias;
public static void doSetup() throws Exception {
testModuleImpl = ModuleUtils.createTestModuleWithEEDependencies(IMPL_MODULE_NAME);
testModuleImpl.addResource("test-module.jar")
.addClasses(ModuleBean.class)
.addAsManifestResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml");
testModuleImpl.create();
// load the module.xml file and use it to create module, we need this to have Module B as exported dependency
File moduleFile = new File(AliasCdiModulesDependencyTest.class.getResource("module-ref.xml").toURI());
testModuleRef = new TestModule("test." + REF_MODULE_NAME, moduleFile);
testModuleRef.create();
File aliasModuleFile = new File(AliasCdiModulesDependencyTest.class.getResource("module-alias.xml").toURI());
testModuleAlias = new TestModule("test." + ALIAS_MODULE_NAME, aliasModuleFile);
testModuleAlias.create();
}
@AfterClass
public static void tearDown() throws Exception {
testModuleAlias.remove();
testModuleRef.remove();
testModuleImpl.remove();
}
@Deployment
public static WebArchive getDeployment() throws Exception {
doSetup();
return ShrinkWrap.create(WebArchive.class)
.addClasses(AliasCdiModulesDependencyTest.class, WarBean.class, TestModule.class)
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: test." + ALIAS_MODULE_NAME + " meta-inf export\n"), "MANIFEST.MF");
}
@Inject
WarBean warBean;
@Test
public void testBeanAccessibilities() {
Assert.assertNotNull(warBean.getInjectedBean());
}
}
| 3,905 | 40.115789 | 133 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/deployment/StaticModuleToDeploymentVisibilityEarTest.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.deployment;
import jakarta.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.as.test.shared.ModuleUtils;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Verifies that a bean (FooImpl3) in the top-level deployment unit is visible from a static Jakarta Contexts and Dependency Injection enabled module.
* At the same time beans from sub-deployments (FooImpl1, FooImpl2) are not visible.
*
* @author Jozef Hartinger
*
*/
@RunWith(Arquillian.class)
public class StaticModuleToDeploymentVisibilityEarTest {
private static final String MODULE_NAME = "weld-modules-deployment-ear";
private static TestModule testModule;
public static void doSetup() throws Exception {
testModule = ModuleUtils.createTestModuleWithEEDependencies(MODULE_NAME);
testModule.addResource("test-module.jar")
.addClasses(ModuleBean.class, Foo.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
testModule.create();
}
@AfterClass
public static void tearDown() throws Exception {
testModule.remove();
}
@Deployment
public static Archive<?> getDeployment() throws Exception {
doSetup();
WebArchive war1 = ShrinkWrap.create(WebArchive.class)
.addClasses(StaticModuleToDeploymentVisibilityEarTest.class, FooImpl1.class, TestModule.class)
.addAsWebInfResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml");
WebArchive war2 = ShrinkWrap.create(WebArchive.class)
.addClasses(FooImpl2.class)
.addAsWebInfResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml");
JavaArchive library = ShrinkWrap.create(JavaArchive.class)
.addClass(FooImpl3.class)
.addAsManifestResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml");
return ShrinkWrap.create(EnterpriseArchive.class)
.addAsModules(war1, war2)
.addAsLibrary(library)
.addAsManifestResource(new StringAsset("Dependencies: test." + MODULE_NAME + " meta-inf\n"), "MANIFEST.MF");
}
@Inject
private ModuleBean alpha;
@Test
public void testBeanAccessibility() {
Assert.assertNotNull(alpha.getFoo());
Assert.assertTrue(alpha.getFoo() instanceof FooImpl3);
}
}
| 4,016 | 41.284211 | 150 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/deployment/FooImpl2.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.deployment;
public class FooImpl2 implements Foo {
}
| 1,128 | 42.423077 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/deployment/ModuleBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.deployment;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
@ApplicationScoped
public class ModuleBean {
@Inject
private Foo foo;
public Foo getFoo() {
return foo;
}
}
| 1,305 | 34.297297 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/deployment/FooImpl1.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.deployment;
public class FooImpl1 implements Foo {
}
| 1,128 | 42.423077 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/deployment/StaticModuleToDeploymentVisibilityWarTest.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.deployment;
import jakarta.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.as.test.shared.ModuleUtils;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Verifies that a bean in the top-level deployment unit is visible from a static CDI-enabled module.
*
* @author Jozef Hartinger
*
*/
@RunWith(Arquillian.class)
public class StaticModuleToDeploymentVisibilityWarTest {
private static final String MODULE_NAME = "weld-modules-deployment-war";
private static TestModule testModule;
public static void doSetup() throws Exception {
testModule = ModuleUtils.createTestModuleWithEEDependencies(MODULE_NAME);
testModule.addResource("test-module.jar")
.addClasses(ModuleBean.class, Foo.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
testModule.create();
}
@AfterClass
public static void tearDown() throws Exception {
testModule.remove();
}
@Deployment
public static Archive<?> getDeployment() throws Exception {
doSetup();
return ShrinkWrap.create(WebArchive.class)
.addClasses(StaticModuleToDeploymentVisibilityWarTest.class, FooImpl1.class, TestModule.class)
.addAsWebInfResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: test." + MODULE_NAME + " meta-inf\n"), "MANIFEST.MF");
}
@Inject
private ModuleBean alpha;
@Test
public void testBeanAccessibility() {
Assert.assertNotNull(alpha.getFoo());
}
}
| 3,116 | 36.554217 | 124 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/deployment/ModuleBeanDiscoveryModeTest.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.deployment;
import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.as.test.shared.ModuleUtils;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.descriptor.api.Descriptors;
import org.jboss.shrinkwrap.descriptor.api.beans11.BeansDescriptor;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Verifies that the bean discovery mode defined in dependencies is taken into account.
*
* @author Yoann Rodiere
*
*/
@RunWith(Arquillian.class)
public class ModuleBeanDiscoveryModeTest {
private static final String MODULE_NAME = "module-with-annotated-bean-discovery-mode";
private static TestModule testModule;
public static void doSetup() throws Exception {
testModule = ModuleUtils.createTestModuleWithEEDependencies(MODULE_NAME);
testModule.addResource("test-module.jar")
.addClass(Foo.class)
/*
* Annotated with @ApplicationScoped, should be added to the CDI context.
*/
.addClass(FooImplAnnotated.class)
/*
* Not annotated, should be ignored as per the beans.xml
* (so there should be no ambiguity when resolving implementations for Foo).
*/
.addClass(FooImpl1.class)
.addAsManifestResource(createBeansXml("annotated"), "beans.xml");
testModule.create();
}
private static Asset createBeansXml(String beanDiscoveryMode) {
String beansXml = Descriptors.create(BeansDescriptor.class)
.version("1.1")
.beanDiscoveryMode(beanDiscoveryMode)
.exportAsString();
return new StringAsset(beansXml);
}
@AfterClass
public static void tearDown() throws Exception {
testModule.remove();
}
@Deployment
public static Archive<?> getDeployment() throws Exception {
doSetup();
return ShrinkWrap.create(WebArchive.class)
.addClasses(ModuleBeanDiscoveryModeTest.class, TestModule.class)
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: test." + MODULE_NAME + " meta-inf\n"), "MANIFEST.MF");
}
@Inject
private Instance<Foo> injected;
@Test
public void testBeanDiscovery() {
Assert.assertFalse(injected.isUnsatisfied());
Assert.assertFalse(injected.isAmbiguous());
MatcherAssert.assertThat(injected.get(), CoreMatchers.instanceOf(FooImplAnnotated.class));
}
}
| 4,153 | 37.462963 | 124 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/deployment/FooImpl3.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.deployment;
public class FooImpl3 implements Foo {
}
| 1,128 | 42.423077 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/deployment/Foo.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.deployment;
public interface Foo {
}
| 1,112 | 41.807692 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/deployment/FooImplAnnotated.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.deployment;
import jakarta.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class FooImplAnnotated implements Foo {
}
| 1,209 | 40.724138 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/export/ExportedModuleTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.export;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import jakarta.enterprise.inject.spi.Extension;
import jakarta.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests that an additional annotated type for a class that is not directly accessible
* from the injection site but is accessible indirectly through exports is injectable.
*
* https://issues.jboss.org/browse/WFLY-4250
*
* @author Jozef Hartinger
*
*/
@RunWith(Arquillian.class)
public class ExportedModuleTestCase {
private static final List<TestModule> testModules = new ArrayList<>();
public static void doSetup() throws Exception {
addModule("export-alpha", "alpha-module.xml", true, AlphaBean.class, AlphaExtension.class);
addModule("export-bravo", "bravo-module.xml", false, BravoBean.class, null);
addModule("export-charlie", "charlie-module.xml", false, CharlieBean.class, null);
}
private static void addModule(String moduleName, String moduleXml, boolean beanArchive, Class<?> beanType, Class<? extends Extension> extension) throws Exception {
URL url = beanType.getResource(moduleXml);
File moduleXmlFile = new File(url.toURI());
TestModule testModule = new TestModule("test." + moduleName, moduleXmlFile);
JavaArchive jar = testModule.addResource(moduleName + ".jar");
jar.addClass(beanType);
if (beanArchive) {
jar.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
if (extension != null) {
jar.addClass(extension);
jar.addAsServiceProvider(Extension.class, extension);
}
testModules.add(testModule);
testModule.create(true);
}
@AfterClass
public static void tearDown() throws Exception {
for (TestModule testModule : testModules) {
testModule.remove();
}
}
@Deployment
public static Archive<?> getDeployment() throws Exception {
doSetup();
return ShrinkWrap.create(WebArchive.class)
.addClass(ExportedModuleTestCase.class)
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: test.export-alpha meta-inf\n"), "MANIFEST.MF");
}
@Inject
BravoBean b;
@Inject
CharlieBean c;
@Test
public void testClassFromExportedDependencyAccessible() {
Assert.assertNotNull(b);
Assert.assertNotNull(c);
}
}
| 4,118 | 36.445455 | 167 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/export/BravoBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.export;
public class BravoBean {
}
| 1,111 | 40.185185 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/export/CharlieBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.export;
public class CharlieBean {
}
| 1,113 | 40.259259 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/export/AlphaExtension.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.export;
import jakarta.enterprise.event.Observes;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
import jakarta.enterprise.inject.spi.Extension;
public class AlphaExtension implements Extension {
public void registerBravo(@Observes BeforeBeanDiscovery event, BeanManager manager) {
event.addAnnotatedType(manager.createAnnotatedType(BravoBean.class), BravoBean.class.getName());
event.addAnnotatedType(manager.createAnnotatedType(CharlieBean.class), CharlieBean.class.getName());
}
}
| 1,646 | 44.75 | 108 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/export/AlphaBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.export;
public class AlphaBean {
}
| 1,111 | 40.185185 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/access/BuiltInBeanWithPackagePrivateConstructor.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.access;
import java.util.concurrent.atomic.AtomicReference;
import jakarta.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class BuiltInBeanWithPackagePrivateConstructor {
private final AtomicReference<String> value;
BuiltInBeanWithPackagePrivateConstructor() {
this.value = new AtomicReference<>();
}
public String getValue() {
return value.get();
}
public void setValue(String value) {
this.value.set(value);
}
}
| 1,564 | 33.777778 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/access/BuiltInBeanWithPackagePrivateConstructorTest.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.access;
import java.io.File;
import java.net.URL;
import jakarta.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(Arquillian.class)
public class BuiltInBeanWithPackagePrivateConstructorTest {
@Inject
private InjectedBean injectedBean;
private static TestModule testModule;
public static void doSetup() throws Exception {
tearDown();
URL url = BuiltInBeanWithPackagePrivateConstructor.class.getResource("test-module.xml");
File moduleXmlFile = new File(url.toURI());
testModule = new TestModule("test.module-accessibility", moduleXmlFile);
JavaArchive jar = testModule.addResource("module-accessibility.jar");
jar.addClass(BuiltInBeanWithPackagePrivateConstructor.class);
jar.addAsManifestResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml");
testModule.create(true);
}
@AfterClass
public static void tearDown() throws Exception {
if (testModule != null) {
testModule.remove();
}
}
@Deployment
public static Archive<?> getDeployment() throws Exception {
doSetup();
return ShrinkWrap.create(WebArchive.class).addClasses(InjectedBean.class, BuiltInBeanWithPackagePrivateConstructorTest.class)
.addClass(TestModule.class)
.addAsWebInfResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: test.module-accessibility meta-inf\n"), "MANIFEST.MF");
}
@Test
public void testBeanInjectable() throws IllegalArgumentException, IllegalAccessException {
BuiltInBeanWithPackagePrivateConstructor bean = injectedBean.getBean();
bean.setValue("foo");
Assert.assertEquals("foo", bean.getValue());
}
}
| 3,397 | 38.511628 | 133 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/modules/access/InjectedBean.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.modules.access;
import jakarta.inject.Inject;
public class InjectedBean {
@Inject
private BuiltInBeanWithPackagePrivateConstructor bean;
public BuiltInBeanWithPackagePrivateConstructor getBean() {
return bean;
}
}
| 1,308 | 36.4 | 70 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/implicitcomponents/ManagedBean2.java
|
package org.jboss.as.test.integration.weld.implicitcomponents;
import jakarta.annotation.ManagedBean;
/**
* @author Stuart Douglas
*/
@ManagedBean
public class ManagedBean2 {
public static final String MESSAGE = "Hello from bean 2";
public String getMessage() {
return MESSAGE;
}
}
| 309 | 16.222222 | 62 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/implicitcomponents/ImplicitComponentTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright (c) 2011, Red Hat, Inc., 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.
*/
package org.jboss.as.test.integration.weld.implicitcomponents;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import jakarta.inject.Inject;
/**
* Tests that managed beans an eligible for CDI injection, even with no beans.xml
*/
@RunWith(Arquillian.class)
public class ImplicitComponentTestCase {
@Deployment
public static JavaArchive deployment() {
return ShrinkWrap.create(JavaArchive.class, "war-example.jar")
.addPackage(ImplicitComponentTestCase.class.getPackage());
}
@Inject
private ManagedBean1 bean1;
@Test
public void testManagedBeanInjection() {
Assert.assertEquals(ManagedBean2.MESSAGE, bean1.getMessage());
}
}
| 1,956 | 34.581818 | 81 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/implicitcomponents/ManagedBean1.java
|
package org.jboss.as.test.integration.weld.implicitcomponents;
import jakarta.annotation.ManagedBean;
import jakarta.inject.Inject;
/**
* @author Stuart Douglas
*/
@ManagedBean
public class ManagedBean1 {
@Inject
private ManagedBean2 bean;
public String getMessage() {
return bean.getMessage();
}
}
| 330 | 15.55 | 62 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/packaging/SimpleEjb.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.interceptor.packaging;
import jakarta.ejb.Stateless;
/**
* @author Stuart Douglas
*/
@Stateless
@Intercepted
public class SimpleEjb {
public String sayHello() {
return "Hello";
}
}
| 1,262 | 32.236842 | 73 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/packaging/SimpleEjb2.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.interceptor.packaging;
import jakarta.ejb.Stateless;
/**
* @author Stuart Douglas
*/
@Stateless
@Intercepted
public class SimpleEjb2 {
private String postConstructMessage;
public String sayHello() {
return "Hello";
}
public String getPostConstructMessage() {
return postConstructMessage;
}
public void setPostConstructMessage(String postConstructMessage) {
this.postConstructMessage = postConstructMessage;
}
}
| 1,530 | 31.574468 | 73 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/packaging/InterceptorPackagingTestCase.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.interceptor.packaging;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import jakarta.inject.Inject;
/**
*
* Tests that interceptors that are packaged in separate jar files.
*
* @author Stuart Douglas
*/
@RunWith(Arquillian.class)
public class InterceptorPackagingTestCase {
@Deployment
public static Archive<?> deploy() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "interceptortest.ear");
JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "mod1.jar");
jar.addClasses(InterceptedBean.class, SimpleEjb.class, InterceptorPackagingTestCase.class);
jar.addAsManifestResource(new StringAsset("<beans bean-discovery-mode=\"all\"><interceptors><class>" + SimpleInterceptor.class.getName() + "</class></interceptors></beans>"), "beans.xml");
ear.addAsModule(jar);
jar = ShrinkWrap.create(JavaArchive.class, "mod2.jar");
jar.addClasses(SimpleInterceptor.class, SimpleEjb2.class, Intercepted.class);
jar.addAsManifestResource(new StringAsset("<beans bean-discovery-mode=\"all\"><interceptors><class>" + SimpleInterceptor.class.getName() + "</class></interceptors></beans>"), "beans.xml");
ear.addAsModule(jar);
return ear;
}
@Inject
private SimpleEjb simpleEjb;
@Inject
private SimpleEjb2 simpleEjb2;
@Inject
private InterceptedBean interceptedBean;
@Test
public void testInterceptorEnabled() {
Assert.assertEquals("Hello World", simpleEjb2.sayHello());
Assert.assertEquals("Hello World", interceptedBean.sayHello());
Assert.assertEquals("Hello World", simpleEjb.sayHello());
}
@Test
public void testPostConstructInvoked() {
Assert.assertEquals(SimpleInterceptor.POST_CONSTRUCT_MESSAGE + " World", simpleEjb2.getPostConstructMessage());
}
}
| 3,297 | 37.348837 | 196 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/packaging/Intercepted.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.interceptor.packaging;
import jakarta.interceptor.InterceptorBinding;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Stuart Douglas
*/
@Retention(RetentionPolicy.RUNTIME)
@InterceptorBinding
@Target(ElementType.TYPE)
public @interface Intercepted {
}
| 1,442 | 36.973684 | 73 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/packaging/SimpleInterceptor.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.interceptor.packaging;
import jakarta.annotation.PostConstruct;
import jakarta.interceptor.AroundInvoke;
import jakarta.interceptor.Interceptor;
import jakarta.interceptor.InvocationContext;
/**
* @author Stuart Douglas
*/
@Intercepted
@Interceptor
public class SimpleInterceptor {
public static final String POST_CONSTRUCT_MESSAGE = "Post Const Intercepted";
@PostConstruct
public void postConstruct(InvocationContext context) {
if(context.getTarget() instanceof SimpleEjb2) {
((SimpleEjb2)context.getTarget()).setPostConstructMessage(POST_CONSTRUCT_MESSAGE);
}
}
@AroundInvoke
public Object invoke(final InvocationContext context) throws Exception {
return context.proceed() + " World";
}
}
| 1,824 | 34.784314 | 94 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/packaging/InterceptedBean.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.interceptor.packaging;
/**
* @author Stuart Douglas
*/
@Intercepted
public class InterceptedBean {
public String sayHello() {
return "Hello";
}
}
| 1,226 | 35.088235 | 73 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/bridgemethods/BaseService.java
|
package org.jboss.as.test.integration.weld.interceptor.bridgemethods;
/**
*
*/
public interface BaseService<T> {
void doSomething(T param);
}
| 148 | 17.625 | 69 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/bridgemethods/BridgeMethodTest.java
|
package org.jboss.as.test.integration.weld.interceptor.bridgemethods;
import jakarta.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
/**
*
*/
@RunWith(Arquillian.class)
public class BridgeMethodTest {
@Deployment
public static Archive<?> deploy() {
return ShrinkWrap.create(JavaArchive.class, "testBridgeMethods.jar")
.addAsManifestResource(new StringAsset("<beans bean-discovery-mode=\"all\"><interceptors><class>" + SomeInterceptor.class.getName() + "</class></interceptors></beans>"), "beans.xml")
.addPackage(BridgeMethodTest.class.getPackage());
}
@Inject
private SpecialService specialService;
@Before
public void setUp() {
SomeInterceptor.invocationCount = 0;
}
@Test
public void testBridgeMethodInterceptor() {
specialService.doSomething("foo");
assertEquals(1, SomeInterceptor.invocationCount);
}
}
| 1,312 | 27.543478 | 198 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/bridgemethods/SomeInterceptorBinding.java
|
package org.jboss.as.test.integration.weld.interceptor.bridgemethods;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import jakarta.interceptor.InterceptorBinding;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
*
*/
@InterceptorBinding
@Inherited
@Target({ TYPE, METHOD })
@Retention(RUNTIME)
public @interface SomeInterceptorBinding {
}
| 536 | 23.409091 | 69 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/bridgemethods/SomeInterceptor.java
|
package org.jboss.as.test.integration.weld.interceptor.bridgemethods;
import jakarta.interceptor.AroundInvoke;
import jakarta.interceptor.Interceptor;
import jakarta.interceptor.InvocationContext;
/**
*
*/
@Interceptor
@SomeInterceptorBinding
public class SomeInterceptor {
public static volatile int invocationCount;
@AroundInvoke
public Object intercept(InvocationContext invocationContext) throws Exception {
invocationCount++;
/*System.out.println("invocationContext = " + invocationContext);
System.out.println("invocationContext.getMethod() = " + invocationContext.getMethod());*/
return invocationContext.proceed();
}
}
| 682 | 26.32 | 97 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/bridgemethods/SpecialService.java
|
package org.jboss.as.test.integration.weld.interceptor.bridgemethods;
/**
*
*/
public interface SpecialService extends BaseService<String> {
}
| 146 | 17.375 | 69 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/interceptor/bridgemethods/SpecialServiceImpl.java
|
package org.jboss.as.test.integration.weld.interceptor.bridgemethods;
import jakarta.ejb.Local;
import jakarta.ejb.Stateless;
/**
*
*/
@Stateless
@Local(SpecialService.class)
@SomeInterceptorBinding
public class SpecialServiceImpl implements SpecialService {
public void doSomething(String param) {
//System.out.println("SpecialServiceImpl.doSomething");
}
}
| 380 | 20.166667 | 69 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/builtin/CDIResource.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.builtin;
import java.security.Principal;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
@Path("cdiInject")
@Produces({"text/plain"})
public class CDIResource {
@Inject
Principal principal;
@GET
public String getMessage() {
return principal.getName();
}
}
| 1,414 | 31.906977 | 73 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/builtin/CDIBuiltinInjectionTestCase.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.builtin;
import static org.junit.Assert.assertEquals;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.as.test.integration.common.HttpRequest;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests that Jakarta Contexts and Dependency Injection of built-in beans works.
*
* @author Brian Stansberry
*/
@RunWith(Arquillian.class)
@RunAsClient
public class CDIBuiltinInjectionTestCase {
@Deployment(testable = false)
public static Archive<?> deploy() {
WebArchive war = ShrinkWrap.create(WebArchive.class,"cdibuiltin.war");
war.addClasses(CDIBuiltInApplication.class, CDIResource.class);
war.add(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
return war;
}
@ArquillianResource
private URL url;
private String performCall(String urlPattern) throws Exception {
return HttpRequest.get(url + urlPattern, 10, TimeUnit.SECONDS);
}
@Test
public void testJaxRsWithNoApplication() throws Exception {
String result = performCall("cdibuiltin/cdiInject");
assertEquals("anonymous", result);
}
}
| 2,592 | 34.520548 | 80 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/builtin/CDIBuiltInApplication.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.
*/
package org.jboss.as.test.integration.weld.builtin;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;
@ApplicationPath("/cdibuiltin")
public class CDIBuiltInApplication extends Application {
}
| 1,239 | 39 | 73 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/deployment/Echo.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat, Inc., and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.test.integration.weld.deployment;
import jakarta.enterprise.context.RequestScoped;
@RequestScoped
public class Echo implements Ping {
@Override
public void pong() {
}
}
| 982 | 32.896552 | 75 |
java
|
null |
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/weld/deployment/Foxtrot.java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat, Inc., and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.test.integration.weld.deployment;
import jakarta.enterprise.context.RequestScoped;
@RequestScoped
public class Foxtrot implements Ping {
@Override
public void pong() {
}
}
| 985 | 33 | 75 |
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.