Package fr.imag.adele.apam

Examples of fr.imag.adele.apam.Implementation



    @Test
    public void CompositeDependencyFailException_tc045() {

  Implementation group_a = waitForImplByName(null,
    "group-a-fail-exception");

  Instance instance_a = group_a.createInstance(null, null);

  S3GroupAImpl ga1 = (S3GroupAImpl) instance_a.getServiceObject();

  String messageTemplate = "In dependency if we adopt fail='exception' exception='A', the exception A should be throw in case the dependency is not satifiable. %s";
View Full Code Here


        .getBundle(0)
        .getBundleContext()
        .getProperty(
          org.osgi.framework.Constants.FRAMEWORK_SYSTEMPACKAGES));

  Implementation group_a = waitForImplByName(null,
    "group-a-fail-exception-native");

  Instance instance_a = group_a.createInstance(null, null);

  S3GroupAImpl ga1 = (S3GroupAImpl) instance_a.getServiceObject();

  String messageTemplate = "In dependency if we adopt fail='exception' exception='A' (With A being an exception that already exists in java JRE), the exception A should be throw in case the dependency is not satifiable. But the exception thrown was not type (A)";
View Full Code Here

    }

    @Test
    public void CompositeDependencyFailWait_tc044() {

  Implementation cta = waitForImplByName(null, "group-a-fail-wait");

  Instance instanceApp1 = cta.createInstance(null, null);

  S3GroupAImpl ga1 = (S3GroupAImpl) instanceApp1.getServiceObject();

  ThreadWrapper wrapper = new ThreadWrapper(ga1);
  wrapper.setDaemon(true);
View Full Code Here

    }

    @Test
    public void RelationConstraintForSourceInstanceTargetInstance_tc113() {

  Implementation implementation = waitForImplByName(null,
    "S07-DependencyImpl");

  Implementation implementationTarget = waitForImplByName(null,
    "S07-implementation-15");

  Instance instanceInvalid01 = implementation.createInstance(null,
    new HashMap<String, String>() {
        {
      put("criteria", "do-not-take-this-instance");
        }
    });
  Instance instanceInvalid02 = implementation.createInstance(null,
    new HashMap<String, String>() {
        {
      put("criteria", "neither-this");
        }
    });
  Instance instanceValid = implementation.createInstance(null,
    new HashMap<String, String>() {
        {
      put("criteria", "the-chosen-one");
        }
    });
  Instance instanceInvalid04 = implementation.createInstance(null,
    new HashMap<String, String>() {
        {
      put("criteria", "ignore-this");
        }
    });

  Instance instanceTarget = implementationTarget.createInstance(null,
    null);

  S07ImplementationImporter15 implem = (S07ImplementationImporter15) instanceTarget
    .getServiceObject();
View Full Code Here

    }

    @Test
    public void RelationLinkCreationManual_tct004() {
  Implementation implementation = waitForImplByName(null,
    "S07-implementation-16");

  Instance instance = implementation.createInstance(null,
    Collections.<String, String> emptyMap());

  Implementation implementationdep = waitForImplByName(null,
    "S07-DependencyImpl-02");
  Instance instancedep = implementationdep.createInstance(null,
    Collections.<String, String> emptyMap());

  org.junit.Assert
    .assertTrue(
      "An exception should be raised as the dependency cannot be resolved automatically (creation=manual)",
View Full Code Here

    }

    @Test
    public void RelationLinkResolveExist_tct001() {

  Implementation implementation = waitForImplByName(null,
    "S07-implementation-14");

  Instance instance = implementation.createInstance(null,
    Collections.<String, String> emptyMap());

  org.junit.Assert
    .assertTrue(
      "An exception should be raised as the dependency cannot be resolved as no instance running",
      testResolutionExceptionCase14(instance, 2));
  Assert.assertEquals(
    "No relations should have been created (no instance of dependency existing)",
    0, instance.getRawLinks().size());

  Implementation implementationdep = waitForImplByName(null,
    "S07-DependencyImpl-02");

  Instance instancedep = implementationdep.createInstance(null,
    Collections.<String, String> emptyMap());
  auxListInstances();

  org.junit.Assert
    .assertFalse(
View Full Code Here

    }

    @Test
    public void RelationLinkResolveInternal_tct002() {
  Implementation implementation = waitForImplByName(null,
    "S07-implementation-14bis");

  Instance instance = implementation.createInstance(null,
    Collections.<String, String> emptyMap());

  org.junit.Assert
    .assertFalse(
      "No exception should be raised as the dependency should be instanciated",
      testResolutionExceptionCase14(instance, 2));
  Assert.assertEquals("One relation should have been created", 1,
    instance.getRawLinks().size());

  Instance instance2 = implementation.createInstance(null,
    Collections.<String, String> emptyMap());

  Implementation implementationdep = waitForImplByName(null,
    "S07-DependencyImpl-02");

  Assert.assertFalse(
    "No exception should be raised as the dependency is already instanciated",
    testResolutionExceptionCase14(instance2, 2));
  auxListInstances();
  Assert.assertEquals("Only one relation should have been created : ", 1,
    instance2.getRawLinks().size());
  Assert.assertEquals(
    "Only one instance of dependency should have been instanciated",
    1, implementationdep.getInsts().size());

  // Test should fail on external bundle resolution
  testResolutionExceptionCase14(instance2, 3);
  auxListInstances();
  org.junit.Assert
View Full Code Here

    // We take care only of implementations
    if (!(comp instanceof Implementation)) {
      return;
    }

    Implementation impl = (Implementation) comp;
    // it was not deployed
    if (!deployed && impl.isUsed()) {
      logger.info(" : selected " + impl);
      return;
    }

    CompositeType compoType;
    if (source instanceof Instance) {
      compoType = ((Instance) source).getComposite().getCompType();
    } else if (source instanceof Implementation) {
      compoType = ((Implementation) source).getInCompositeType().iterator().next();
    } else {
      logger.error("Should not call deployedImpl on a source Specification " + source);
      // TODO in which composite to put it. Still in root ?
      return;
    }
    ((CompositeTypeImpl) compoType).deploy(impl);

    // it is deployed or was never used so far
    if (impl.isUsed()) {
      logger.info(" : logically deployed " + impl);
    } else {// it was unused so far.
      ((ComponentImpl) impl).setFirstDeployed(compoType);
      if (deployed) {
        logger.info(" : deployed " + impl);
View Full Code Here

    return (Implementation) resolve.setResolved.iterator().next();
  }

  @Override
  public void updateComponent(String componentName) {
    Implementation impl = CST.componentBroker.getImpl(componentName);
    if (impl == null) {
      logger.error("Unknown component " + componentName);
      return;
    }
    UpdateMan.updateComponent(impl);
View Full Code Here

    }

    @Test
    public void RelationPreferencesForSourceInstanceTargetInstance_tc114() {

  Implementation implementation = waitForImplByName(null,
    "S07-DependencyImpl");

  Implementation implementationTarget = waitForImplByName(null,
    "S07-implementation-17");

  Instance instanceInvalid01 = implementation.createInstance(null,
    new HashMap<String, String>() {
        {
      put("criteria", "do-not-take-this-instance");
        }
    });
  Instance instanceInvalid02 = implementation.createInstance(null,
    new HashMap<String, String>() {
        {
      put("criteria", "neither-this");
        }
    });
  Instance instanceValid01 = implementation.createInstance(null,
    new HashMap<String, String>() {
        {
      put("criteria", "the-chosen-one");
        }
    });
  Instance instanceValid02 = implementation.createInstance(null,
    new HashMap<String, String>() {
        {
      put("criteria", "the-chosen-one");
        }
    });
  Instance instanceInvalid03 = implementation.createInstance(null,
    new HashMap<String, String>() {
        {
      put("criteria", "ignore-this");
        }
    });

  Instance instanceTarget = implementationTarget.createInstance(null,
    null);

  S07ImplementationImporter17 implem = (S07ImplementationImporter17) instanceTarget
    .getServiceObject();
View Full Code Here

TOP

Related Classes of fr.imag.adele.apam.Implementation

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.