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

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


    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='internal', the %s";

    Assert.assertNull(
        String.format(messageTemplace,
            "initial value declared in the xml should be ignored for internal"),
        s1.getInjectedInternal());
    s1Inst.setProperty("injectedInternal", "changedByApamAPI");
    Assert.assertTrue(String.format(messageTemplace,
        " value should NOT be changeable by ApamInstance.setProperty"),
        s1.getInjectedInternal() == null
            || s1.getInjectedInternal().equals("changedByApamAPI"));
    Assert.assertNull(
        String.format(
            messageTemplace,
            " value should NOT be changeable by ApamInstance.setProperty, which is not true when checking ApamInstance.getProperty"),
        s1Inst.getProperty("injectedInternal"));
    Assert.assertNull(
        String.format(
            messageTemplace,
            " value should NOT be changeable by ApamInstance.setProperty, which is not true when checking ApamInstance.getAllProperties"),
        s1Inst.getAllProperties().get("injectedInternal"));

    s1.setInjectedInternal("changedByJavaInstance");
    Assert.assertNotNull(s1.getInjectedInternal());
    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.getInjectedInternal().equals("changedByJavaInstance"));
    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should be changeable by java instance, although the value remains un altered when checking ApamInstance.getProperty"),
        s1Inst.getProperty("injectedInternal").equals(
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 whose type injected not specified (should be both by default), the %s";

    Assert.assertTrue(
        String.format(messageTemplace,
            "initial value declared in the xml should NOT be ignored for both"),
        s1.getInjectedBothByDefault().equals("default"));
    s1Inst.setProperty("injectedBothByDefault", "changedByApamAPI");
    Assert.assertTrue(
        String.format(messageTemplace,
            " value should be changeable by ApamInstance.setProperty"),
        (s1.getInjectedBothByDefault() == null ? "" : s1
            .getInjectedBothByDefault()).equals("changedByApamAPI"));
    Assert.assertTrue(
        String.format(
            messageTemplace,
            " value should be changeable by ApamInstance.setProperty, which is not true when checking ApamInstance.getProperty"),
        s1Inst.getProperty("injectedBothByDefault").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("injectedBothByDefault")
            .equals("changedByApamAPI"));

    s1.setInjectedBothByDefault("changedByJavaInstance");
    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.getInjectedBothByDefault() == null ? "" : s1
            .getInjectedBothByDefault())
            .equals("changedByJavaInstance"));
    Assert.assertTrue(
        String.format(
            messageTemplace,
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='both', the %s";

    Assert.assertTrue(
        String.format(messageTemplace,
            "initial value declared in the xml should NOT be ignored for both"),
        s1.getInjectedBoth().equals("default"));
    s1Inst.setProperty("injectedBoth", "changedByApamAPI");
    Assert.assertTrue(String.format(messageTemplace,
        " value should be changeable by ApamInstance.setProperty"), (s1
        .getInjectedBoth() == null ? "" : s1.getInjectedBoth())
        .equals("changedByApamAPI"));
    Assert.assertTrue(
        String.format(
            messageTemplace,
            " value should be changeable by ApamInstance.setProperty, which is not true when checking ApamInstance.getProperty"),
        s1Inst.getProperty("injectedBoth").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("injectedBoth")
            .equals("changedByApamAPI"));

    s1.setInjectedBoth("changedByJavaInstance");
    Assert.assertNotNull(s1.getInjectedBoth());
    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.getInjectedBoth().equals("changedByJavaInstance"));
    Assert.assertTrue(
        String.format(
            messageTemplace,
            "value should be changeable by java instance, although the value remains un altered when checking ApamInstance.getProperty"),
        s1Inst.getProperty("injectedBoth").equals(
View Full Code Here

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

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

    S1Impl_tct025 s1 = (S1Impl_tct025) s1Inst.getServiceObject();
    String messageTemplace = "for a property defined in constructor, the %s";

    Assert.assertNotNull(String.format(messageTemplace,
        "value declared in the xml should be ignored for internal"), s1
        .getInjectedInternal());
    Assert.assertTrue(String.format(messageTemplace,
        "value declared in the xml should be ignored for internal"), s1
        .getInjectedInternal().equals("Constructor defined value"));

    Assert.assertTrue(String.format(messageTemplace,
        "value declared in the xml should be used for external"), s1
        .getInjectedExternal().equals("default"));

    Assert.assertTrue(String.format(messageTemplace,
        "value declared in the xml should be used for both"), s1
        .getInjectedBothSetted().equals("default"));

    Assert.assertNotNull(
        String.format(messageTemplace,
            "value declared in the constructor should be kept if not configured in XML"),
        s1.getInjectedBothUnsetted());
    Assert.assertTrue(
        String.format(messageTemplace,
            "value declared in the constructor should be kept if not configured in XML"),
        s1.getInjectedBothUnsetted()
            .equals("Constructor defined value"));
  }
View Full Code Here

    Instance instSourceA = implSource.createInstance(null, null);
    Instance instSourceB = implSource.createInstance(null, null);
    Instance instTarget = implTarget.createInstance(null, null);

    ServiceDependencySource_tct018 sourceA = (ServiceDependencySource_tct018) instSourceA
        .getServiceObject();
    ServiceDependencySource_tct018 sourceB = (ServiceDependencySource_tct018) instSourceB
        .getServiceObject();

    boolean exceptionThrown = false;

    try {
      sourceA.getAndKeepTarget();
      System.out.println("Source A resolved target, but keeping");
      sourceB.getAndReleaseTarget();
      System.out.println("Source B resolved target");
    } catch (Throwable ex) {
      System.out.println("Exception thrown : " + ex.getMessage());
      exceptionThrown = true;
    }
    Assert.assertTrue(
        "Usual Case if A resolve and use a target (not shared), B cannot use it",
        exceptionThrown);

    exceptionThrown = false;
    try {
      sourceA.getAndReleaseTarget();
      System.out.println("Source A resolved target, and released");
      sourceB.getAndReleaseTarget();
      System.out.println("Source B resolved target, and released");
    } catch (Throwable ex) {
      System.out.println("Exception thrown : " + ex.getMessage());
      exceptionThrown = true;
    }
View Full Code Here

TOP

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

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.