Examples of Implementation


Examples of fr.imag.adele.apam.Implementation

    }

    @Test
    public void RelationSourceInstanceTargetInstance_tc109() {

  Implementation target = waitForImplByName(null, "S07-DependencyImpl");
  target.createInstance(null, null);

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

  Instance instance = implementation.createInstance(null, null);

  S07ImplementationImporter13 dependency = (S07ImplementationImporter13) instance
    .getServiceObject();

  // Force field injection
View Full Code Here

Examples of fr.imag.adele.apam.Implementation

    }

    @Test
    public void RelationSourceInstanceTargetSpecification_tc121() {

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

  Instance instance = implementation.createInstance(null, new HashMap() {
      {
    put("instance-property", "ok");
      }
  });// Collections.<String, String> emptyMap()
View Full Code Here

Examples of fr.imag.adele.apam.Implementation

    }

    @Test
    public void RelationSourceSpecificationTargetImplementation_tc104() {

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

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

  S07ImplementationImporter08 dependency = (S07ImplementationImporter08) instance
    .getServiceObject();

  // Force field injection
  dependency.getInjected();

  ComponentImpl ci = (ComponentImpl) implementation.getSpec();

  Assert.assertTrue(String.format(
    "One link should have been created, but %s links were found",
    ci.getLocalLinks().size()), ci.getLocalLinks().size() == 1);
View Full Code Here

Examples of fr.imag.adele.apam.Implementation

    }

    @Test
    public void RelationSourceSpecificationTargetImplementationFailExceptionCustom_tc108() {

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

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

  S07ImplementationImporter12 dependency = (S07ImplementationImporter12) instance
    .getServiceObject();
View Full Code Here

Examples of fr.imag.adele.apam.Implementation

    }

    @Test
    public void RelationSourceSpecificationTargetImplementationFailExceptionGeneric_tc107() {

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

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

  S07ImplementationImporter11 dependency = (S07ImplementationImporter11) instance
    .getServiceObject();
View Full Code Here

Examples of fr.imag.adele.apam.Implementation

    }

    @Test
    public void RelationSourceSpecificationTargetImplementationFailWait_tc106() {

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

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

  S07ImplementationImporter10 dependency = (S07ImplementationImporter10) instance
    .getServiceObject();
View Full Code Here

Examples of fr.imag.adele.apam.Implementation

    if (composite == null) {
      throw new InvalidConfiguration("Null parent while creating instance");
    }

    Implementation implementation = CST.componentBroker.getImpl(apformInst.getDeclaration().getImplementation().getName());

    if (implementation == null) {
      throw new InvalidConfiguration("Null implementation while creating instance");
    }
View Full Code Here

Examples of fr.imag.adele.apam.Implementation

    }

    @Test
    public void RelationSourceSpecificationTargetInstance_tc103() {

  Implementation target = waitForImplByName(null, "S07-DependencyImpl");
  target.createInstance(null, null);

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

  Instance instance = implementation.createInstance(null, null);

  S07ImplementationImporter07 dependency = (S07ImplementationImporter07) instance
    .getServiceObject();

  // Force field injection
  dependency.getInjected();

  ComponentImpl ci = (ComponentImpl) implementation.getSpec();

  Assert.assertTrue(String.format(
    "One link should have been created, but %s links were found",
    ci.getLocalLinks().size()), ci.getLocalLinks().size() == 1);
View Full Code Here

Examples of fr.imag.adele.apam.Implementation

    }

    @Test
    public void RelationSourceSpecificationTargetSpecification_tc105() {

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

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

  S07ImplementationImporter09 dependency = (S07ImplementationImporter09) instance
    .getServiceObject();

  // Force field injection
  dependency.getInjected();

  ComponentImpl ci = (ComponentImpl) implementation.getSpec();

  Assert.assertTrue(String.format(
    "One link should have been created, but %s links were found",
    ci.getLocalLinks().size()), ci.getLocalLinks().size() == 1);
View Full Code Here

Examples of fr.imag.adele.apam.Implementation

      if (relToResolve.getTargetKind() == ComponentKind.SPECIFICATION) {
        return new Resolved<Specification>(spec);
      }
      impls = spec.getImpls();
    } else if (relToResolve.getTarget() instanceof ImplementationReference) {
      Implementation impl = CST.componentBroker.getImpl(name);
      if (impl == null) {
        return null;
      }
      if (relToResolve.getTargetKind() == ComponentKind.IMPLEMENTATION) {
        return new Resolved<Implementation>(impl);
      }
      impls = new HashSet<Implementation>();
      impls.add(impl);
    } else if (relToResolve.getTarget() instanceof InstanceReference) {
      Instance inst = CST.componentBroker.getInst(name);
      if (inst == null) {
        return null;
      }
      if (relToResolve.getTargetKind() == ComponentKind.INSTANCE) {
        return new Resolved<Instance>(inst);
      }
      logger.debug("if (relToResolve.getTarget() instanceof InstanceReference) ") ;
      return null;
    } else if (relToResolve.getTarget() instanceof ComponentReference<?>) {
      logger.error("Invalid target reference : " + relToResolve.getTarget());
      return null;
    }

    /*
     * We have computed all component references It is either already
     * resolved, or the implems are in impls. Now Resolve by resource.
     */
    else if (relToResolve.getTarget() instanceof ResourceReference) {
      if (relToResolve.getTargetKind() == ComponentKind.SPECIFICATION) {
        Set<Specification> specs = new HashSet<Specification>();
        for (Specification spec : CST.componentBroker.getSpecs()) {
          if (spec.getProvidedResources().contains(relToResolve.getTarget())) {
            specs.add(spec);
          }
        }
        return relToResolve.getResolved(specs, false);
      }

      /*
       * target Kind is implem or instance get all the implems that
       * implement the resource
       */
      impls = new HashSet<Implementation>();
      for (Implementation impl : CST.componentBroker.getImpls()) {
        if (impl.getProvidedResources().contains((relToResolve.getTarget()))) {
          impls.add(impl);
        }
      }
    }

    // TargetKind is implem or instance, but no implem found.
    if (impls == null || impls.isEmpty()) {
      return null;
    }

    // If TargetKind is implem, select the good one(s)
    if (relToResolve.getTargetKind() == ComponentKind.IMPLEMENTATION) {
      return relToResolve.getResolved(impls, false);
    }

    /*
     * We have in impls all the implementations satisfying the relation
     * target (type and name only). We are looking for instances. Take all
     * the instances of these implementations satisfying the relation
     * constraints and visibility.
     */

    /*
     *  Fast track : if looking for one instance and no preferences, return the first valid instance
     */
    boolean fast = (!relToResolve.isMultiple() && !relToResolve.hasPreferences());

    Set<Instance> insts = new HashSet<Instance>();
    for (Implementation impl : impls) {
      for (Instance inst : impl.getInsts()) {
        if (inst.isSharable() && source.canSee(inst) && inst.matchRelationConstraints(relToResolve)) {
          if (fast) {
            return new Resolved<Instance>(inst);
          }
          insts.add(inst);
        }
      }
    }

    if (!insts.isEmpty()) {
      /*
       * If relation is singleton, select the best instance.
       */
      if (relToResolve.isMultiple()) {
        return new Resolved<Instance>(insts);
      }
      return new Resolved<Instance>(relToResolve.getPrefered(insts));
    }

    /*
     * Keep only the implementations satisfying the constraints of the
     * relation
     */
    Set<Implementation> valid = new HashSet<Implementation>();
    for (Implementation impl : impls) {
      if (relToResolve.matchRelationConstraints(ComponentKind.IMPLEMENTATION, impl.getAllProperties())) {
        valid.add(impl);
      }
    }

    if (!!!valid.isEmpty()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.