Package fr.imag.adele.apam

Examples of fr.imag.adele.apam.Instance


    @Test
    public void FunctionCall_tc093() {
  Implementation subjectAimpl = waitForImplByName(null, "subject-a");

  Instance subjectA = subjectAimpl.createInstance(null, null);

  S6Impl s6 = (S6Impl) subjectA.getServiceObject();

  auxListProperties("\t", subjectA);

  String template = "after fetching a property value (pointing to a function) the returned value do not correspond to the returned function. Value '%s' was returned instead of '%s'";
  String message = String
    .format(template, subjectA.getProperty("function-case-01"),
      s6.functionCall(null));

  Assert.assertTrue(message, subjectA.getProperty("function-case-01")
    .equals(s6.functionCall(null)));
    }
View Full Code Here


    @Test
    public void FunctionCallEscaped_tc094() {
  Implementation subjectAimpl = waitForImplByName(null, "subject-a");

  Instance subjectA = subjectAimpl.createInstance(null, null);

  auxListProperties("\t", subjectA);

  String template = "after fetching a property value (pointing to a function which the '@' was escaped with backslash) the returned value do not correspond to the returned function. Value '%s' was returned instead of '%s'";
  String message = String.format(template,
    subjectA.getProperty("function-case-01"), "@functionCall");

  Assert.assertTrue(message, subjectA.getProperty("function-case-02")
    .equals("@functionCall"));

    }
View Full Code Here

    @Test
    public void SubstitutionGetPropertyEscaped_tc095() {
  Implementation subjectAimpl = waitForImplByName(null, "subject-a");

  Instance subjectA = subjectAimpl.createInstance(null, null);

  auxListProperties("\t", subjectA);

  String templace = "after fetching a property value (pointing to metasubstitution) with '$' escaped (with backslash), the content should not be processed by metasubtitution. Value was %s instead of %s";
  String message = String.format(templace,
    subjectA.getProperty("property-case-09"),
    "$impl-case-09.$property-subject-b");

  Assert.assertTrue(message, subjectA.getProperty("property-case-09")
    .equals("$impl-case-09.$property-subject-b"));

    }
View Full Code Here

    @Test
    public void SubstitutionGetPropertyOutsideDefinictionInSpecPropertyNowhere_tc091() {
  Implementation subjectAimpl = waitForImplByName(null, "subject-a");

  Instance subjectA = subjectAimpl.createInstance(null, null);

  auxListProperties("\t", subjectA);

  Assert.assertTrue(
    "Given two composites A B, was not possible to reach the right value for a property of A through B by substituion (e.g. in B declare a property with the value '$AImpl.$property'): when there is only a definition in the Spec and no property in the Impl",
    subjectA.getProperty("property-case-03").equals("value-spec"));

    }
View Full Code Here

    @Test
    public void SubstitutionGetPropertyOutsideDefinitionInSpecPropertyInImpl_tc090() {
  Implementation subjectAimpl = waitForImplByName(null, "subject-a");

  Instance subjectA = subjectAimpl.createInstance(null, null);

  auxListProperties("\t", subjectA);

  Assert.assertTrue(
    "Given two composites A B, was not possible to reach the right value for a property of A through B by substituion (e.g. in B declare a property with the value '$AImpl.$property') ",
    subjectA.getProperty("property-case-01").equals("value-impl"));

    }
View Full Code Here

    @Test
    public void SubstitutionGetPropertyOutsideDefinitionNowherePropertyInImpl_tc092() {
  Implementation subjectAimpl = waitForImplByName(null, "subject-a");

  Instance subjectA = subjectAimpl.createInstance(null, null);

  auxListProperties("\t", subjectA);

  System.err.println(subjectA.getProperty("property-case-08"));

  Assert.assertTrue(
    "Given two composites A B, was not possible to reach the right value for a property of A through B by substituion (e.g. in B declare a property with the value '$AImpl.$property'): when there is only a definition in the Impl",
    subjectA.getProperty("property-case-08") != null
      && subjectA.getProperty("property-case-08").equals(
        "value-impl"));

    }
View Full Code Here

    @Test
    public void SubstitutionGetPropertyString_tc089() {
  Implementation impl = waitForImplByName(null,
    "MetasubstitutionStringTest");

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

  auxListProperties("\t", instance);

  Assert.assertTrue("geting property didnt work as expected", instance
    .getProperty("meta_string_retrieve").equals("goethe"));
  Assert.assertTrue("prefixing didnt work as expected", instance
    .getProperty("meta_string_prefix").equals("pregoethe"));
  Assert.assertTrue("postfixing didnt work as expected", instance
    .getProperty("meta_string_suffix").equals("goethepost"));
  Assert.assertTrue(
    "applying prefix and sufix at same time didnt work as expected",
    instance.getProperty("meta_string_prefix_suffix").equals(
      "pregoethepost"));

    }
View Full Code Here

    @Test
    public void SubstitutionGetPropertyWithDotInMiddleOfComponentName_tc093() {
  Implementation subjectAimpl = waitForImplByName(null, "impl-case-11");

  Instance subjectA = subjectAimpl.createInstance(null,
    Collections.singletonMap("property-subject-b", "bete"));

  auxListProperties("\t", subjectA);

  System.err.println("--->" + subjectA.getProperty("property-case-10"));

  // Assert.assertTrue("Substitution did not work when the component contains . (dots) in the name",subjectA.getProperty("property-case-10").equals("value-impl"));

  Assert.assertTrue(subjectA.getProperty("property-subject-b-spec")
    .equals("mydefault"));
  Assert.assertTrue(subjectA.getProperty("property-subject-b").equals(
    "bete"));
    }
View Full Code Here

    @Test
    public void SubstitutionGetPropertyWithDotInMiddleOfComponentName_tc117() {
  Implementation subjectAimpl = waitForImplByName(null, "subject-a");

  Instance subjectA = subjectAimpl.createInstance(null, null);

  auxListProperties("\t", subjectA);

  System.err.println("--->" + subjectA.getProperty("property-case-10"));

  Assert.assertTrue(
    "Substitution did not work when the component contains . (dots) in the name",
    subjectA.getProperty("property-case-10").equals("value-impl"));

    }
View Full Code Here

    public void SubstitutionReachingMultipleNodes_tc122() {
  Implementation subjectAimpl = waitForImplByName(null, "subject-a");

  Implementation implementationAlpha = waitForImplByName(null,
    "impl-case-12-child");
  Instance instanceAlpha = implementationAlpha.createInstance(null,
    new HashMap<String, String>() {
        {
      put("property-subject-b", "alpha(child)");
        }
    });

  Implementation implementationBravo = waitForImplByName(null,
    "impl-case-12-child");

  Instance instanceBravo = implementationBravo.createInstance(null,
    new HashMap<String, String>() {
        {
      put("property-subject-b", "bravo(child)");
        }
    });

  Implementation implementationCharlie = waitForImplByName(null,
    "impl-case-12");
  Instance instanceCharlie = implementationCharlie.createInstance(null,
    new HashMap<String, String>() {
        {
      put("property-subject-b", "charlie(parent)");
        }
    });

  Implementation implementationDelta = waitForImplByName(null,
    "impl-case-12");
  Instance instanceDelta = implementationDelta.createInstance(null,
    new HashMap<String, String>() {
        {
      put("property-subject-b", "delta(parent)");
        }
    });

  // Instance of the subject-a (parent)
  Instance subjectA = subjectAimpl.createInstance(null, null);

  // Force the field to be injected
  S6Impl s6parent = (S6Impl) subjectA.getServiceObject();
  s6parent.getS6();

  // Force the field to be injected
  Instance middleInstance = auxListInstanceReferencedBy(s6parent.getS6());
  S6Impl s6middle = (S6Impl) middleInstance.getServiceObject();
  s6middle.getS6();

  // Force the field to be injected
  Instance childInstance = auxListInstanceReferencedBy(s6middle.getS6());
  S6Impl s6child = (S6Impl) childInstance.getServiceObject();
  s6child.getS6();

  auxListProperties("\t", subjectA);

  System.err.println("-->" + subjectA.getProperty("property-case-12"));

  Assert.assertTrue(
    String.format(
      "Substitution did not find the correct value when navigating through multiple nodes (Expecting %s as property, but found %s)",
      subjectA.getProperty("property-case-12"),
      childInstance.getProperty("property-subject-b")),
    subjectA.getProperty("property-case-12").equals(
      childInstance.getProperty("property-subject-b")));

    }
View Full Code Here

TOP

Related Classes of fr.imag.adele.apam.Instance

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.