Package fr.imag.adele.apam

Examples of fr.imag.adele.apam.Implementation


    }

    @Test
    public void SingletonNotSharedInstance_tc015() {

  Implementation impl = waitForImplByName(null,
    "HouseMeterSingletonNotShared");

  Instance inst1 = impl.createInstance(null,
    new HashMap<String, String>());
  Instance inst2 = null;

  try {
      inst2 = impl.createInstance(null, new HashMap<String, String>());
  } catch (Exception e) {
      // Nothing to do
  }

  System.out.println("-----" + inst1);
View Full Code Here


    }

    @Test
    public void SingletonSharedInstance_tc013() {

  Implementation impl = waitForImplByName(null,
    "HouseMeterSingletonShared");

  CompositeType root = (CompositeType) impl.getInCompositeType()
    .toArray()[0];

  System.out.println("IMPL:" + impl);

  Composite rootComposite = null;

  if (root.getInst() instanceof Composite) {
      rootComposite = (Composite) root.getInst();
  }

  impl.createInstance(null, null);

  Instance inst1 = CST.apamResolver.resolveImpl(rootComposite, impl,
    new HashSet<String>(), new ArrayList<String>());
  Instance inst2 = CST.apamResolver.resolveImpl(rootComposite, impl,
    new HashSet<String>(), new ArrayList<String>());
View Full Code Here

      return null;
    }

    String implementationName = apfImpl.getDeclaration().getName();

    Implementation implementation = getImpl(implementationName);
    if (implementation != null) {
      logger.error("Error adding implementation: already exists" + implementationName);
      return implementation;
    }
View Full Code Here

    /*
     * Get the implementation group to create the instance. If the
     * implementation can not be resolved the creation of the instance
     * fails.
     */
    Implementation implementation = getImpl(implementationName);
    if (implementation == null) {
      logger.error("Error adding instance: implementation not found" + implementationName);
      return null;
    }

View Full Code Here

  @Override
  public Implementation createImpl(CompositeType compo, String implName, URL url, Map<String, String> properties) {
    assert implName != null && url != null;

    Implementation impl = getImpl(implName);
    if (impl != null) { // do not create twice
      return impl;
    }
    impl = ApamInstall.intallImplemFromURL(url, implName);
    if (impl == null) {
View Full Code Here

  @Test
  public void obrmanInstanciationWhenBundleInstalledNotStarted_tct005() {
    waitForApam();

    Implementation implementation = waitForImplByName(null,
        "Obrman-Test-S3Impl");

    Assert.assertNotNull(
        "Obrman-Test-S3Impl cannot be resolved (cannot be found using obrman)",
        implementation);

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

    Assert.assertNotNull("Instance of Obrman-Test-S3Impl is null", instance);
    Bundle bundle = implementation.getApformComponent().getBundle();

    try {
      bundle.stop();
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }

    implementation = waitForImplByName(null, "Obrman-Test-S3Impl");

    Assert.assertNotNull(
        "Obrman-Test-S3Impl cannot be resolved as bundle is not started",
        implementation);

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

    Assert.assertNotNull("Instance of Obrman-Test-S3Impl is null", instance);

  }
View Full Code Here

  @Test
  public void RelationLinkResolveExternal_tct003() {
    waitForApam();

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

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

    // Test should success on external bundle resolution
    auxListInstances();
    org.junit.Assert
View Full Code Here

    CompositeType compo = (CompositeType) waitForComponentByName(null,
        "CompositeSequenceStartwithOK_tct037");
   
    compo.createInstance(null, null);
   
    Implementation implOK = CST.componentBroker.getImpl("ImplemOK");
    Assert.assertNotNull("ImplemOK should have been installed" , implOK );
    Assert.assertNotNull("An Instance of ImplemOK should have been created" , implOK.getInst() );
    Assert.assertTrue("The instance name should be thisOneOK (from the composite)" , implOK.getInst().getName().equals("thisOneOK") );
   
    Implementation implFailing = CST.componentBroker.getImpl("ImplFailing");
    Assert.assertNull("ImplemFailing should NOT have been installed" , implFailing );
    System.out.println("Test finished correctly");
 
View Full Code Here

    CompositeType compo = (CompositeType) waitForComponentByName(null,
        "CompositeSequenceStartwithFail_tct038");
   
    compo.createInstance(null, null);
   
    Implementation implOK = CST.componentBroker.getImpl("ImplemOK");
    Assert.assertNotNull("ImplemOK should have been installed" , implOK );
    Assert.assertNotNull("An Instance of ImplemOK should have been created" , implOK.getInst() );
    Assert.assertTrue("The instance name should be thisOneOK (from the composite)" , implOK.getInst().getName().equals("thisOneOK") );
   
    Implementation implFailing = CST.componentBroker.getImpl("ImplFailing");
    Assert.assertNull("ImplemFailing should NOT have been installed" , implFailing );
    System.out.println("Test finished correctly");
 
View Full Code Here

    @Test
    public void AddedRemovedCallbackInDependencyDeclaration_tc023() {

  String message = "Into an <implementation>, when declaring a dependency, we may specify methods (with an Instance type parameter) to be called as soon as the dependency is wired or unwired, those are 'added' and 'removed' attributes respectively. %s";

  Implementation impl = waitForImplByName(null,
    "S1Impl-added-removed-callback-signature-instance");
  apam.waitForIt(Constants.CONST_WAIT_TIME);

  Instance instance = impl.createInstance(null,
    new HashMap<String, String>());

  S1Impl s1 = (S1Impl) instance.getServiceObject();

  Assert.assertTrue(
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.