Examples of CompositeType


Examples of fr.imag.adele.apam.CompositeType

    models.add(model);

    Apam apam = getAService(Apam.class);

    CompositeType app = apam.createCompositeType(null, name, mainSpec,
        main, models, null);

    assertNotNull(app);

    assertNotNull(app.getMainImpl().getApformImpl());

    return app;
  }
View Full Code Here

Examples of fr.imag.adele.apam.CompositeType

    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;
View Full Code Here

Examples of fr.imag.adele.apam.CompositeType

      group = group.getGroup();
    }

    // Looking for composite definitions.
    if (this instanceof Instance) {
      CompositeType comptype = ((Instance) this).getComposite()
          .getCompType();
      dep = comptype.getCtxtRelation(this, id);
      if (dep != null) {
        return dep;
      }
    }
    if (this instanceof Implementation) {
      for (CompositeType comptype : ((Implementation) this)
          .getInCompositeType()) {
        dep = comptype.getCtxtRelation(this, id);
        if (dep != null) {
          return dep;
        }
      }
    }
View Full Code Here

Examples of fr.imag.adele.apam.CompositeType

    public void SingletonSharedInstance_tc013() {

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

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

  System.out.println("IMPL:" + impl);

  Composite rootComposite = null;

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

  impl.createInstance(null, null);

  Instance inst1 = CST.apamResolver.resolveImpl(rootComposite, impl,
View Full Code Here

Examples of fr.imag.adele.apam.CompositeType

      group = group.getGroup();
    }

    // Looking for composite definitions.
    if (this instanceof Instance) {
      CompositeType comptype = ((Instance) this).getComposite()
          .getCompType();

      for (RelationDefinition relDef : comptype.getCtxtRelations(this)) {
        if (!processed.contains(relDef.getName())) {
          relDefs.add(relDef);
          processed.add(relDef.getName());
        }
      }

    }
    if (this instanceof Implementation) {
      for (CompositeType comptype : ((Implementation) this)
          .getInCompositeType()) {
        for (RelationDefinition relDef : comptype
            .getCtxtRelations(this)) {
          if (!processed.contains(relDef.getName())) {
            relDefs.add(relDef);
            processed.add(relDef.getName());
          }
View Full Code Here

Examples of fr.imag.adele.apam.CompositeType

    System.out.println("=========== start testCreateCompoRootS1toS2Final");
    if (apam != null) {
      System.out.println("apam is Ok");
    }
    System.out.println("testing a root createCompositeType by name existing in ASM. will call S2Final.");
    CompositeType appliTest00 = apam.createCompositeType(null,  "Test00", null, "S1toS2Final", null,null);
    assertTrue(appliTest00!= null);

    System.out.println("testing create instance root");
    Instance a = appliTest00.createInstance(null /* composite */, null/* properties */);
    assertTrue(a!= null);

    System.out.println("testing call to S1toS2Final");
    S1 s01 = (S1) a.getServiceObject();
    s01.callS1("createAppli by API by name. Should call S2Final.");

    System.out.println("=========== passed testCreateCompoRootS1toS2Final\n\n");

    System.out.println("=========== start nested composite instance by API");
    System.out.println("Testing the manual creation of a composite instance inside another composite instance of same type");
    System.out.println("Weird but should work.");
    Instance test00_instance0 = appliTest00.createInstance((Composite) a /* composite */, null/* properties */);
    assertTrue (test00_instance0 != null);
    assertTrue (((Composite)a).containsInst(test00_instance0)) ;
    System.out.println("composite in composite same type !! " + test00_instance0 );

    System.out.println("=========== passed nested composite instance by API\n\n");
View Full Code Here

Examples of fr.imag.adele.apam.CompositeType

  public void testCreateCompoBySpec () {
    System.out.println("=========== start testCreateCompoBySpec");
    System.out.println(" Alternatively, a specification (S1) can be provided instead; it is resolved to find the main implem.\n");

    // The system will look for an atomic implementations of "S1" as the main implementation
    CompositeType appli3 = apam.createCompositeType(null, "TestS1Bis", null,  "S1", null /* models */, null /* properties */);
    assertTrue (appli3 != null) ;

    // Create an instance of that composite type
    Instance inst = appli3.createInstance(null /* composite */, null/* properties */);
    assertTrue (inst != null );

    System.out.println("=========== passed testCreateCompoBySpec\n\n");
  }
View Full Code Here

Examples of fr.imag.adele.apam.CompositeType

    props.put("impl-name", "5"); // final
    //props.put("location", "living"); // ok
    props.put("location", "anywhere"); // value not defined
    props.put("testEnumere", "v1");

    CompositeType appliTestAttr = apam.createCompositeType(null,  "TestInitAttr", null, "TestAttr", null, props);
    assertTrue(appliTestAttr != null);

    Instance appliTestAttr_0 = appliTestAttr.createInstance(null /* composite */, props/* properties */);
    System.out.println("Tested instance : " + appliTestAttr_0.getName());

    //since the composite type has no spec, all initial values are valid.
    //No longer ! all attr must be defined now.
    assertTrue (appliTestAttr_0 != null) ;
View Full Code Here

Examples of fr.imag.adele.apam.CompositeType

    <property S1toS2Final-String1="a String Value" />
    <property badAttr="yyy" />

     */

    CompositeType appliSetAttr = apam.createCompositeType(null,  "TestSetAttr", null, "TestAttr", null,null);
    assertTrue(appliSetAttr != null);

    Instance appliSetAttr_0 = appliSetAttr.createInstance(null /* composite */, null/* properties */);
    assertTrue (appliSetAttr_0 != null);
    //assertEquals ((CompositeImpl)appliSetAttr_0.getMainInst () != null);

    System.out.println(" Testing attributes on main implem declared: location = {living, kitchen, bedroom}");
    Implementation impl = appliSetAttr.getMainImpl(); //S1toS2Final
    Specification spec = impl.getSpec() ;
    Instance inst = null ;
    inst = impl.getInst() ; // any instance
    System.out.println("Tested instance : " + inst + ". TestedImpl : " + impl + " Tested spec : " + spec);

View Full Code Here

Examples of fr.imag.adele.apam.CompositeType

    @Override
  public void otherTests () {

    Map<String, String> props = new HashMap<String, String>();
    Instance test00_instance0 = null ;
    CompositeType appli3 ;
    // Calling that application from an external program (this instance).
    S1 s11 = (S1) test00_instance0.getServiceObject();
    s11.callS1("createAppli-1");

    // setting visibilities
    // composite a3 should not be shared
    //    test00_instance0.setProperty(CST.SHARED, CST.V_FALSE);

    System.out.println("\n\n===================================== Testing promotions\n"
        + " creating composite on S1 containing an S2 composite \n");

    props.clear();
    //    props.put(CST.A_LOCALIMPLEM, CST.V_TRUE);
    //    props.put(CST.A_LOCALINSTANCE, CST.V_TRUE);
    //    props.put(CST.A_BORROWIMPLEM, CST.V_FALSE);
    //    props.put(CST.A_BORROWINSTANCE, CST.V_FALSE);

    CompositeType mainCompo = apam.createCompositeType("Test00", "TestS1Promotions", null, "S1Main", null /* models */,
        props);

    System.err.println("TestS1Promotions inside Test00 and black box");
    mainCompo.createInstance((Composite) test00_instance0, props);

    System.out.println("\n\n\n========================== deuxieme exec ===");
    //        test00_instance0 = appli3.createInstance(null /* composite */, null/* properties */);

    // Calling that application from an external program (this instance).
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.