Package fr.imag.adele.apam

Examples of fr.imag.adele.apam.Implementation


    }

    @Test
    public void InjectionUpdateLinkForSetType_tc013() {

  Implementation s1Impl = waitForImplByName(null,
    "fr.imag.adele.apam.pax.test.impl.S1Impl-tc013");

  Implementation sansungImpl = waitForImplByName(null, "SamsungSwitch");

  // This instance is created to avoid apam to instantiate automatically
  // (done in case it doesnt find any instance available)
  Instance sansungInstInitial = sansungImpl.createInstance(null, null);

  Instance s1Inst = s1Impl.createInstance(null, null);

  apam.waitForIt(Constants.CONST_WAIT_TIME);

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

  int initialSize = s1.getEletronicInstancesInSet().size();

  auxDisconectWires(s1Inst);

  Instance sansungInst = sansungImpl.createInstance(null, null);

  apam.waitForIt(Constants.CONST_WAIT_TIME);

  GenericSwitch samsungSwitch = (GenericSwitch) sansungInst
    .getServiceObject();
View Full Code Here


    }

    @Test
    public void InstantiableInstance_tc020() {

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

  boolean failed = false;

  try {
      Instance inst1 = impl.createInstance(null, null);
  } catch (Exception e) {
      // nothing to do
      failed = true;
  }
View Full Code Here

    }

    @Test
    public void NotInstantiableInstance_tc019() {

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

  boolean failed = false;

  Instance inst1 = null;

  try {
      inst1 = impl.createInstance(null, null);
  } catch (Exception e) {
      // nothing to do
      failed = true;
  }
View Full Code Here

    }

    @Test
    public void NotSingletonNotSharedInstance_tc017() {

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

  Instance inst1 = impl.createInstance(null, null);
  Instance inst2 = impl.createInstance(null, null);
  Instance inst3 = impl.createInstance(null, null);

  System.out.println("1 ----- " + inst1 + "/" + inst1.getServiceObject());
  System.out.println("2 ----- " + inst2 + "/" + inst2.getServiceObject());
  System.out.println("3 ----- " + inst3 + "/" + inst3.getServiceObject());
View Full Code Here

    }

    @Test
    public void NotSingletonSharedInstance_tc018() {

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

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

  Composite rootComposite = null;

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

  impl.createInstance(null, null);

  boolean success = true;
  try {
      impl.createInstance(null, null);
      impl.createInstance(null, null);
  } catch (Exception e) {
      success = false;
  }

  Assert.assertTrue(
View Full Code Here

    @Test
    public void PreferenceInjectionAttributeMultipleImplementationSingleInstance_tc025()
      throws InvalidSyntaxException {

  Implementation lgImpl = waitForImplByName(null, "LgSwitch");
  final Instance lgInst = lgImpl.createInstance(null,
    new HashMap<String, String>() {
        {
      put("currentVoltage", "100");
        }
    });

  Implementation samsungImpl = waitForImplByName(null, "SamsungSwitch");
  final Instance samsungInst = samsungImpl.createInstance(null,
    new HashMap<String, String>() {
        {
      put("currentVoltage", "500");
        }
    });

  Implementation philipsImpl = waitForImplByName(null, "philipsSwitch");

  final Instance philipsInst = philipsImpl.createInstance(null,
    new HashMap<String, String>() {
        {
      put("currentVoltage", "500");
        }
    });

  Implementation siemensImpl = waitForImplByName(null, "SiemensSwitch");
  final Instance siemensInst = siemensImpl.createInstance(null,
    new HashMap<String, String>() {
        {
      put("currentVoltage", "105");
        }
    });

  System.out.println("Instances before injection request");
  auxListInstances("\t");

  // Creates S1 instance (class that requires the injection)
  Implementation s1Impl = waitForImplByName(null,
    "fr.imag.adele.apam.pax.test.impl.S1Impl");

  Instance s1Inst = s1Impl.createInstance(null, null);

  // apam.waitForIt(Constants.CONST_WAIT_TIME);

  S1Impl s1 = (S1Impl) s1Inst.getServiceObject();
View Full Code Here

    @Test
    public void PreferenceInjectionAttributeSingleImplementationMultipleInstance_tc024()
      throws InvalidSyntaxException {

  Implementation lgImpl = waitForImplByName(null, "LgSwitch");
  final Instance lgInst = lgImpl.createInstance(null,
    new HashMap<String, String>() {
        {
      put("currentVoltage", "100");
        }
    });

  Implementation samsungImpl = waitForImplByName(null, "SamsungSwitch");
  final Instance samsungInst = samsungImpl.createInstance(null,
    new HashMap<String, String>() {
        {
      put("currentVoltage", "500");
        }
    });

  final Instance samsungInst2 = samsungImpl.createInstance(null,
    new HashMap<String, String>() {
        {
      put("currentVoltage", "500");
        }
    });

  Implementation siemensImpl = waitForImplByName(null, "SiemensSwitch");
  final Instance siemensInst = siemensImpl.createInstance(null,
    new HashMap<String, String>() {
        {
      put("currentVoltage", "105");
        }
    });

  System.out.println("Instances before injection request");
  auxListInstances("\t");

  // Creates S1 instance (class that requires the injection)
  Implementation s1Impl = waitForImplByName(null,
    "fr.imag.adele.apam.pax.test.impl.S1Impl");

  Instance s1Inst = s1Impl.createInstance(null, null);

  apam.waitForIt(Constants.CONST_WAIT_TIME);

  S1Impl s1 = (S1Impl) s1Inst.getServiceObject();
View Full Code Here

    @Test
    @Ignore
    public void PreferenceResolutionAfterInjection_tct006()
      throws InvalidSyntaxException {

  Implementation lgImpl = waitForImplByName(null, "LgSwitch");
  final Instance lgInst = lgImpl.createInstance(null,
    new HashMap<String, String>() {
        {
      put("currentVoltage", "100");
        }
    });

  System.out.println("Instances before injection request");
  auxListInstances("\t");

  // Creates S1 instance (class that requires the injection)
  Implementation s1Impl = waitForImplByName(null,
    "fr.imag.adele.apam.pax.test.impl.S1Impl");

  Instance s1Inst = s1Impl.createInstance(null, null);

  // apam.waitForIt(Constants.CONST_WAIT_TIME);

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

  Eletronic lgSwitch = (Eletronic) lgInst.getServiceObject();

  System.out
    .println("Instances after FIRST injection request (preference cannot be resolved)");
  auxListInstances("\t");

  Instance injectedInstance = CST.componentBroker.getInstService(s1
    .getDevicePreference110v());

  System.out.println("Injected:" + injectedInstance);

  Assert.assertTrue(
    String.format(
      "The instance injected cannot be the prefered one (currentVoltage=500), since there exist no instance in which the preference is valid."
        + " The instance %s (currentVoltage:%s) was injected instead of %s (currentVoltage:%s)",
      injectedInstance.getName(), injectedInstance
        .getAllProperties().get("currentVoltage"),
      lgInst.getName(),
      lgInst.getAllProperties().get("currentVoltage")), s1
      .getDevicePreference110v() == lgSwitch);

  Implementation samsungImpl = waitForImplByName(null, "SamsungSwitch");
  final Instance samsungInst = samsungImpl.createInstance(null,
    new HashMap<String, String>() {
        {
      put("currentVoltage", "500");
        }
    });
View Full Code Here

    @Test
    public void removedCallbackWhenThereAreConstraints_tc112() {

  String messageTemplate = "In case of a remove callback, when a property of a service A change and the service B use a constraint to inject A on its instance, the link from A->B should be brocken and restablished, thus remove callback should have been called";

  Implementation impl = waitForImplByName(null,
    "S1Impl-removed-callback-with-constraint");

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

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

  S2 first = s1.getS2();
View Full Code Here

    @Test
    public void removedCallbackWhenThereAreNOConstraints_tc111() {

  String messageTemplate = "In case of a remove callback, when a property of a service A change and the service B do NOT use a constraint to inject A on its instance, the link from A->B should NOT be brocken and restablished, thus remove callback should NOT have been called";

  Implementation impl = waitForImplByName(null,
    "S1Impl-removed-callback-with-no-constraint");

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

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

  s1.getS2();
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.