Package org.apache.aries.unittest.mocks

Examples of org.apache.aries.unittest.mocks.MethodCall


  @Test
  public void testReferenceWithNoClassName() throws Exception
  {
    String testObject = "Test object";
    ObjectFactory factory = Skeleton.newMock(ObjectFactory.class);
    Skeleton.getSkeleton(factory).setReturnValue(new MethodCall(ObjectFactory.class, "getObjectInstance", Object.class, Name.class, Context.class, Hashtable.class), testObject);

    bc.registerService(ObjectFactory.class.getName(), factory, null);

    Reference ref = new Reference(null);
    Object obj = NamingManager.getObjectInstance(ref, null, null, env);
View Full Code Here


  @Test
  public void testSpecifiedFactoryWithMatchingFactory() throws Exception
  {
    String testObject = "Test object";
    ObjectFactory factory = Skeleton.newMock(ObjectFactory.class);
    Skeleton.getSkeleton(factory).setReturnValue(new MethodCall(ObjectFactory.class, "getObjectInstance", Object.class, Name.class, Context.class, Hashtable.class), testObject);

    Reference ref = new Reference("dummy.class.name", factory.getClass().getName(), "");

    bc.registerService(new String[] {ObjectFactory.class.getName(), factory.getClass().getName()},
                       factory, null);
View Full Code Here

  @Test
  public void testSpecifiedFactoryWithRegisteredButNotMatchingFactory() throws Exception
  {
    String testObject = "Test object";
    ObjectFactory factory = Skeleton.newMock(ObjectFactory.class);
    Skeleton.getSkeleton(factory).setReturnValue(new MethodCall(ObjectFactory.class, "getObjectInstance", Object.class, Name.class, Context.class, Hashtable.class), testObject);

    Reference ref = new Reference("dummy.class.name", "dummy.factory.class.name", "");

    bc.registerService(new String[] {ObjectFactory.class.getName(), factory.getClass().getName()},
                       factory, null);
View Full Code Here

  @Before
  public void setup() throws Exception
  {
    appMetadata = Skeleton.newMock(ApplicationMetadata.class);
    Skeleton.getSkeleton(appMetadata).setReturnValue(
        new MethodCall(ApplicationMetadata.class, "getApplicationSymbolicName"), "aries.test");
    Skeleton.getSkeleton(appMetadata).setReturnValue(
        new MethodCall(ApplicationMetadata.class, "getApplicationVersion"), new Version("1.0.0"));
    Skeleton.getSkeleton(appMetadata).setReturnValue(
        new MethodCall(ApplicationMetadata.class, "getUseBundles"), Collections.EMPTY_LIST);   
   
    app = Skeleton.newMock(AriesApplication.class);
    Skeleton.getSkeleton(app).setReturnValue(new MethodCall(AriesApplication.class, "getApplicationMetadata"), appMetadata);
   
    deplMFMgr = new DeploymentManifestManagerImpl();
    deplMFMgr.setResolver(_resolver);
    deplMFMgr.setLocalPlatform(localPlatform);
    deplMFMgr.setModellingManager(modellingManager);
View Full Code Here

 
  @Test
  public void testResolve() throws Exception
  {
   
    Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class, "getApplicationContents"), Arrays.asList(mockContent("aries.test.a", "1.0.0"), mockContent("aries.test.b", "[1.0.0, 2.0.0)" )));
    Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class, "getUseBundles"), Arrays.asList(BUNDLE_C, BUNDLE_D));
   
    DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata,
        new ArrayList<ModelledResource>(), Collections.<Content>emptyList());
    Manifest man = deplMFMgr.generateDeploymentManifest(appMetadata.getApplicationSymbolicName(),
        appMetadata.getApplicationVersion().toString(), deployedBundles);
View Full Code Here

    _resolver.addResult(cmr);
   
    // The second time DeploymentGenerator calls the Resolver, it will provide just
    // test.shared. The resolver will return test.shared _plus_ test.isolated.
    _resolver.addResult(cmr);
    Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class, "getApplicationContents"), Arrays.asList(mockContent("test.isolated" , "1.0.0")));
   
   
    try {
      DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata,
          new ArrayList<ModelledResource>(), new ArrayList<Content>());
View Full Code Here

    _resolver.addResult(cmr);
   
    // The second time DeploymentGenerator calls the Resolver, it will provide just
    // test.shared. The resolver will return test.shared _plus_ test.isolated.
    _resolver.addResult(cmr);
    Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class, "getApplicationContents"), Arrays.asList(mockContent("test.isolated1" , "1.0.0"), mockContent("test.isolated2" , "1.0.0")));
   
    app = Skeleton.newMock(AriesApplication.class);
    Skeleton.getSkeleton(app).setReturnValue(new MethodCall(AriesApplication.class, "getApplicationMetadata"), appMetadata);
   
    try {
      DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata,
          Arrays.asList(new ModelledResource[] {testIsolated1.getBundle(), testIsolated2.getBundle()}),
          new ArrayList<Content>());
View Full Code Here

    // The second time DeploymentGenerator calls the Resolver, it will provide just
    // test.shared. The resolver will return test.shared _plus_ test.isolated.
    _resolver.addResult(cmr);
    Skeleton.getSkeleton(appMetadata).setReturnValue(
        new MethodCall(ApplicationMetadata.class, "getApplicationContents"),
        Arrays.asList(
            mockContent("test.api" , "1.1.0"),
            mockContent("test.consumer" , "1.0.0"),
            mockContent("test.provider", "1.0.0")));

    app = Skeleton.newMock(AriesApplication.class);
    Skeleton.getSkeleton(app).setReturnValue(new MethodCall(AriesApplication.class, "getApplicationMetadata"), appMetadata);
   
    try {
      DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata,
          Arrays.asList(new ModelledResource[] {cmr.get(0), cmr.get(2), cmr.get(3)}),
          new ArrayList<Content>());
View Full Code Here

    // The second time DeploymentGenerator calls the Resolver, it will provide just
    // test.shared. The resolver will return test.shared _plus_ test.isolated.
    _resolver.addResult(cmr);
    Skeleton.getSkeleton(appMetadata).setReturnValue(
        new MethodCall(ApplicationMetadata.class, "getApplicationContents"),
        Arrays.asList(
            mockContent("test.util" , "1.1.0"),
            mockContent("test.bundle", "1.0.0")));

    app = Skeleton.newMock(AriesApplication.class);
    Skeleton.getSkeleton(app).setReturnValue(new MethodCall(AriesApplication.class, "getApplicationMetadata"), appMetadata);
   
    DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata,
        Arrays.asList(new ModelledResource[] {cmr.get(0), cmr.get(1)}),
        new ArrayList<Content>());
    Manifest mf = deplMFMgr.generateDeploymentManifest(appMetadata.getApplicationSymbolicName(),
View Full Code Here

    // The second time DeploymentGenerator calls the Resolver, it will provide just
    // test.shared. The resolver will return test.shared _plus_ test.isolated.
    _resolver.addResult(cmr);
   
    Skeleton.getSkeleton(appMetadata).setReturnValue(
        new MethodCall(ApplicationMetadata.class, "getApplicationContents"),
        Arrays.asList(
            mockContent("test.api" , "1.1.0"),
            mockContent("test.consumer" , "1.0.0"),
            mockContent("test.provider", "1.0.0")));
   
    Skeleton.getSkeleton(appMetadata).setReturnValue(
        new MethodCall(ApplicationMetadata.class, "getUseBundles"),
        Arrays.asList(mockContent("test.api", "1.0.0")));

    app = Skeleton.newMock(AriesApplication.class);
    Skeleton.getSkeleton(app).setReturnValue(new MethodCall(AriesApplication.class, "getApplicationMetadata"), appMetadata);
   
    DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata,
        Arrays.asList(new ModelledResource[] {cmr.get(0), cmr.get(2), cmr.get(3)}),
        new ArrayList<Content>());
   
View Full Code Here

TOP

Related Classes of org.apache.aries.unittest.mocks.MethodCall

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.