use of org.apache.aries.unittest.mocks.MethodCall in project aries by apache.
the class AriesApplicationManagerImplTest method createUpdateDepMf.
private DeploymentMetadata createUpdateDepMf() {
DeploymentMetadata depMf = Skeleton.newMock(DeploymentMetadata.class);
Skeleton.getSkeleton(depMf).setReturnValue(new MethodCall(DeploymentMetadata.class, "getApplicationSymbolicName"), "org.apache.aries.application.management.test");
Skeleton.getSkeleton(depMf).setReturnValue(new MethodCall(DeploymentMetadata.class, "getApplicationVersion"), new Version("1.0.0"));
return depMf;
}
use of org.apache.aries.unittest.mocks.MethodCall in project aries by apache.
the class AriesApplicationManagerImplTest method testUpdateWithIncorrectDepMf.
@Test(expected = IllegalArgumentException.class)
public void testUpdateWithIncorrectDepMf() throws Exception {
AriesApplication app = createApplication(TEST_EBA);
DeploymentMetadata depMf = Skeleton.newMock(DeploymentMetadata.class);
Skeleton.getSkeleton(depMf).setReturnValue(new MethodCall(DeploymentMetadata.class, "getApplicationSymbolicName"), "random.app");
Skeleton.getSkeleton(depMf).setReturnValue(new MethodCall(DeploymentMetadata.class, "getApplicationVersion"), new Version("1.0.0"));
AriesApplicationContextManager ctxMgr = Skeleton.newMock(AriesApplicationContextManager.class);
_appMgr.setApplicationContextManager(ctxMgr);
_appMgr.update(app, depMf);
}
use of org.apache.aries.unittest.mocks.MethodCall in project aries by apache.
the class AriesApplicationManagerImplTest method testFailedUpdate.
@Test
public void testFailedUpdate() throws Exception {
AriesApplication app = createApplication(TEST_EBA);
DeploymentMetadata depMf = createUpdateDepMf();
AriesApplicationContext ctx = Skeleton.newMock(AriesApplicationContext.class);
Skeleton.getSkeleton(ctx).setReturnValue(new MethodCall(AriesApplicationContext.class, "getApplication"), app);
AriesApplicationContextManager ctxMgr = Skeleton.newMock(AriesApplicationContextManager.class);
Skeleton.getSkeleton(ctxMgr).setReturnValue(new MethodCall(AriesApplicationContextManager.class, "getApplicationContexts"), Collections.singleton(ctx));
Skeleton.getSkeleton(ctxMgr).setThrows(new MethodCall(AriesApplicationContextManager.class, "update", AriesApplication.class, DeploymentMetadata.class), new UpdateException("", null, false, null));
_appMgr.setApplicationContextManager(ctxMgr);
try {
_appMgr.update(app, depMf);
fail("Update should have failed.");
} catch (UpdateException e) {
assertTrue("Deployment.mf should have been updated", app.getDeploymentMetadata() == depMf);
}
}
use of org.apache.aries.unittest.mocks.MethodCall in project aries by apache.
the class EJBLocatorTest method assertXML.
private void assertXML(boolean b) {
Skeleton s = Skeleton.getSkeleton(registry);
MethodCall mc = new MethodCall(EJBRegistry.class, "addEJBView", "XML", "SINGLETON", "local.Iface", false);
if (b)
s.assertCalledExactNumberOfTimes(mc, 1);
else
s.assertNotCalled(mc);
mc = new MethodCall(EJBRegistry.class, "addEJBView", "XML", "SINGLETON", "remote.Iface", true);
if (b)
s.assertCalledExactNumberOfTimes(mc, 1);
else
s.assertNotCalled(mc);
}
use of org.apache.aries.unittest.mocks.MethodCall in project aries by apache.
the class EJBModellerTest method testModelServicesEmptyExportEJB.
@Test
public void testModelServicesEmptyExportEJB() throws ModellerException {
Manifest man = new Manifest();
setBasicHeaders(man);
man.getMainAttributes().putValue("Export-EJB", "");
modeller.modelServices(new BundleManifest(man), bundleLocation);
ejbLocator.assertCalled(new MethodCall(EJBLocator.class, "findEJBs", BundleManifest.class, bundleLocation, ParsedEJBServices.class));
}
Aggregations