Package fr.imag.adele.apam.pax.test.implS1

Examples of fr.imag.adele.apam.pax.test.implS1.S1Impl


  apam.waitForIt(Constants.CONST_WAIT_TIME);

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

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

  Assert.assertTrue(
    String.format(
      message,
      "Although 'added' method should not be called before the resolution of the dependency"),
    s1.getIsOnInitCallbackCalled() == false);
  Assert.assertTrue(
    String.format(
      message,
      "Although 'remove' method should not be called before the resolution of the dependency"),
    s1.getIsOnRemoveCallbackCalled() == false);

  s1.getS2();

  Assert.assertTrue(
    String.format(
      message,
      "Although 'added' method was not called during the wiring process(dependency resolution)"),
    s1.getIsOnInitCallbackCalled() == true);

  Assert.assertTrue(
    String.format(
      message,
      "the 'added' the callback method was called although the instance was not received as parameter"),
    s1.getIsBindUnbindReceivedInstanceParameter() == true);

  auxDisconectWires(instance);

  Assert.assertTrue(
    String.format(message,
      "Although 'remove' method was not called during the unwiring process"),
    s1.getIsOnRemoveCallbackCalled() == true);

  Assert.assertTrue(
    String.format(
      message,
      "the 'remove' the callback method was called although the instance was not received as parameter"),
    s1.getIsBindUnbindReceivedInstanceParameter() == true);

    }
View Full Code Here


  apam.waitForIt(Constants.CONST_WAIT_TIME);

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

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

  Assert.assertTrue(
    String.format(
      message,
      "Although 'added' method should not be called before the resolution of the dependency"),
    s1.getIsOnInitCallbackCalled() == false);
  Assert.assertTrue(
    String.format(
      message,
      "Although 'remove' method should not be called before the resolution of the dependency"),
    s1.getIsOnRemoveCallbackCalled() == false);

  s1.getS2();

  Assert.assertTrue(
    String.format(
      message,
      "Although 'added' method was not called during the wiring process(dependency resolution)"),
    s1.getIsOnInitCallbackCalled() == true);

  auxDisconectWires(instance);

  Assert.assertTrue(
    String.format(message,
      "Although 'remove' method was not called during the unwiring process"),
    s1.getIsOnRemoveCallbackCalled() == true);

    }
View Full Code Here

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

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

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

  Instance philipsSwitch = CST.componentBroker.getInstService(s1
    .getSimpleDevice110v());

  philipsSwitch.setProperty("currentVoltage", "110");

  String manufacturer = philipsSwitch.getProperty("manufacturer");
View Full Code Here

    "fr.imag.adele.apam.pax.test.impl.S1Impl");

  // apam.waitForIt(Constants.CONST_WAIT_TIME);

  Instance s1Inst = s1Impl.createInstance(null, null);
  S1Impl s1 = (S1Impl) s1Inst.getServiceObject();

  // apam.waitForIt(Constants.CONST_WAIT_TIME);

  for (Eletronic e : s1.getEletronicInstancesConstraintsInstance()) {
      Instance p = CST.componentBroker.getInstService(e);
      System.out.println("---- Voltage:"
        + p.getProperty("currentVoltage") + " / Name:"
        + p.getName());

      boolean found = false;

      for (Instance l : validInstances) {
    if (l.getName().equals(p.getName())) {
        found = true;
        break;
    }
      }

      // Check if all valid instances were injected
      Assert.assertTrue(
        String.format(
          "Instance %s (currentVoltage:%s) was injected even if its does not obey the constraint (currentVoltage<=110)",
          p.getName(), p.getProperty("currentVoltage")), p
          .match("(currentVoltage<=110)"));
      Assert.assertTrue(
        String.format(
          "Instance %s (currentVoltage:%s) was not found in the list of valid instances for the constraint (currentVoltage<=110)",
          p.getName(), p.getProperty("currentVoltage")),
        found);

  }

  auxListInstances("--------------");

  // check if there is no other instance injected
  Assert.assertTrue(
    String.format(
      "The number of valid instances and the number of injected instances differ, instances not expected were injected. %d injected instead of %d",
      s1.getEletronicInstancesConstraintsInstance().size(),
      validInstances.size()),
    s1.getEletronicInstancesConstraintsInstance().size() == validInstances
      .size());

    }
View Full Code Here

  };

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

  Instance s1Inst = s1Impl.createInstance(null, null);
  S1Impl s1 = (S1Impl) s1Inst.getServiceObject();

  // auxListInstanceReferencedBy("#################",s1.getEletronicInstancesConstraintsInstance());
  auxListInstances("-------Available instances before using the list-------");

  System.out.println("Size of the injected list:"  + s1.getEletronicInstancesConstraintsInstance().size());

  for (Eletronic e : s1.getEletronicInstancesConstraintsInstance()) {
      Instance p = CST.componentBroker.getInstService(e);
      System.out.println("---- Voltage:"
        + p.getProperty("currentVoltage") + " / Name:"
        + p.getName());

      boolean found = false;

      for (Instance l : validInstances) {
    if (l.getName().equals(p.getName())) {
        found = true;
        break;
    }
      }

      // Check if all valid instances were injected
      Assert.assertTrue(
        String.format(
          "Instance %s (currentVoltage:%s) was injected even if its does not obey the constraint (currentVoltage <= 110)",
          p.getName(), p.getProperty("currentVoltage")), p
          .match("(currentVoltage <= 110)"));
      Assert.assertTrue(
        String.format(
          "Instance %s (currentVoltage:%s) was not found in the list of valid instances for the constraint (currentVoltage <= 110)",
          p.getName(), p.getProperty("currentVoltage")),
        found);

  }

  auxListInstances("-------Available instances after using the list-------");

  // check if there is no other instance injected
  Assert.assertTrue(
    String.format(
      "The number of valid instances and the number of injected instances differ, instances not expected were injected. %d injected instead of %d",
      s1.getEletronicInstancesConstraintsInstance().size(),
      validInstances.size()),
    s1.getEletronicInstancesConstraintsInstance().size() == validInstances
      .size());

    }
View Full Code Here

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

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

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

    String messageTemplace = "for a property type injected='external', the %s";

    Assert.assertTrue(String.format(messageTemplace,
        "initial value declared in the xml should NOT be ignored"), s1
        .getStateNotInternal().equals("default"));

    s1Inst.setProperty("stateNotInternal", "changedByApamAPI");

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should be changeable by ApamInstance.setProperty, which is not true when checking the java instance property value"),
        (s1.getStateNotInternal() == null ? "" : s1
            .getStateNotInternal()).equals("changedByApamAPI"));

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should be changeable by ApamInstance.setProperty, which is not true when checking ApamInstance.getProperty"),
        s1Inst.getProperty("stateNotInternal").equals(
            "changedByApamAPI"));

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should be changeable by ApamInstance.setProperty, which is not true when checking ApamInstance.getAllProperties"),
        s1Inst.getAllProperties().get("stateNotInternal")
            .equals("changedByApamAPI"));

    s1.setStateNotInternal("changedByJavaInstance");

    // All the following situation should remains unchanged since the field
    // is an external (check the spec:
    // https://docs.google.com/document/d/1JNffl2oNeS26HFbJ2OT-KnpvZnEYm5sja2XprsYG3Mo/edit#)

    Assert.assertNotNull(s1.getStateNotInternal());

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should be changeable by java instance, although the value remains un altered when checking the java instance value"),
        s1.getStateNotInternal().equals("changedByApamAPI"));

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should be changeable by java instance, although the value remains un altered when checking ApamInstance.getProperty"),
View Full Code Here

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

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

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

    String messageTemplace = "for a property type internal='true', %s";

    Assert.assertTrue(String.format(messageTemplace,
        "initial value declared in the xml should be ignored"), s1
        .getStateInternal() == null);

    s1Inst.setProperty("stateInternal", "changedByApamAPI");

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should NOT be changeable by ApamInstance.setProperty, although the value remains un altered java instance property value"),
        s1.getStateInternal() == null);

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should NOT be changeable by ApamInstance.setProperty, although the value remains un altered when checking ApamInstance.getProperty"),
        s1Inst.getProperty("stateInternal") == null);

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should NOT be changeable by ApamInstance.setProperty,  although the value remains un altered when checking ApamInstance.getAllProperties"),
        s1Inst.getAllProperties().get("stateInternal") == null);

    s1.setStateInternal("changedByJavaInstance");

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should be changeable by java instance, although the value remains un altered when checking the java instance property value"),
        s1.getStateInternal().equals("changedByJavaInstance"));

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should be changeable by java instance, although the value remains un altered when checking ApamInstance.getProperty"),
View Full Code Here

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

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

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

    Assert.assertTrue(
        "Internal property value should be null, since the xml should be ignore.",
        s1Inst.getAllProperties().get("stateInternal") == null);
View Full Code Here

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

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

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

    // this should be updated correctly
    samsungInst.setProperty("currentVoltage", "999");
    // this should stay with the old value
    samsungInst.setProperty("made", "deutschland");
View Full Code Here

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

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

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

    String messageTemplace = "for a property type injected='external', the %s";

    Assert.assertTrue(
        String.format(messageTemplace,
            "initial value declared in the xml should NOT be ignored for external"),
        s1.getInjectedExternal().equals("default"));
    s1Inst.setProperty("injectedExternal", "changedByApamAPI");
    Assert.assertTrue(String.format(messageTemplace,
        " value should be changeable by ApamInstance.setProperty"), (s1
        .getInjectedExternal() == null ? "" : s1.getInjectedExternal())
        .equals("changedByApamAPI"));
    Assert.assertTrue(
        String.format(
            messageTemplace,
            " value should be changeable by ApamInstance.setProperty, which is not true when checking ApamInstance.getProperty"),
        s1Inst.getProperty("injectedExternal").equals(
            "changedByApamAPI"));
    Assert.assertTrue(
        String.format(
            messageTemplace,
            " value should be changeable by ApamInstance.setProperty, which is not true when checking ApamInstance.getAllProperties"),
        s1Inst.getAllProperties().get("injectedExternal")
            .equals("changedByApamAPI"));

    s1.setInjectedExternal("changedByJavaInstance");

    Assert.assertNotNull(s1.getInjectedExternal());

    logger.debug("-----s1.getInjectedExternal():"
        + s1.getInjectedExternal());

    // Property should remain unchanged
    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should NOT be changeable by java instance, but it changed when checking JavaInstance.myfield"),
        s1.getInjectedExternal().equals("changedByApamAPI"));

    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should NOT be changeable by java instance, but it changed when checking ApamInstance.getProperty()"),
View Full Code Here

TOP

Related Classes of fr.imag.adele.apam.pax.test.implS1.S1Impl

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.