use of org.apache.aries.ejb.modelling.EJBLocator in project aries by apache.
the class EJBLocatorFactoryTest method testGetEJBLocator.
@Test
public void testGetEJBLocator() {
EJBLocator locator = EJBLocatorFactory.getEJBLocator();
assertNotNull(locator);
assertTrue(locator.getClass().getName(), locator instanceof OpenEJBLocator);
}
use of org.apache.aries.ejb.modelling.EJBLocator in project aries by apache.
the class EJBLocatorFactoryTest method testGetEJBLocatorNoOpenEJB.
@Test
public void testGetEJBLocatorNoOpenEJB() throws Exception {
Class<?> elf = new ClassLoader(getClass().getClassLoader()) {
@Override
public Class<?> loadClass(String className) throws ClassNotFoundException {
if (className.startsWith("org.apache.openejb"))
throw new ClassNotFoundException(className);
if (className.equals(EJBLocatorFactory.class.getName())) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
IOUtils.copy(getResourceAsStream(className.replace('.', '/') + ".class"), baos);
} catch (IOException e) {
throw new ClassNotFoundException(className, e);
}
return defineClass(className, baos.toByteArray(), 0, baos.size());
}
return super.loadClass(className);
}
}.loadClass(EJBLocatorFactory.class.getName());
EJBLocator locator = (EJBLocator) elf.getMethod("getEJBLocator").invoke(null);
assertNotNull(locator);
assertTrue(locator.getClass().getName(), locator instanceof EJBLocationUnavailable);
}
use of org.apache.aries.ejb.modelling.EJBLocator in project aries by apache.
the class EJBModellerTest method setup.
@Before
public void setup() {
modeller = new EJBModeller();
EJBLocator locator = Skeleton.newMock(EJBLocator.class);
modeller.setLocator(locator);
ejbLocator = Skeleton.getSkeleton(locator);
bundleLocation = Skeleton.newMock(IDirectory.class);
}
Aggregations