Package fr.imag.adele.apam

Examples of fr.imag.adele.apam.Specification


  }

  @Override
  public Resolved<?> resolve(RelToResolve dep) {
   
    Specification spec = CST.componentBroker.getSpecResource(dep.getTarget());
    if (spec == null) {
      return null;
    }

    waitComponent(spec.getName());
    return null;
  }
View Full Code Here


    }
    return (Implementation) impl;
  }

  public static Specification intallSpecFromURL(URL url, String compoName) {
    Specification spec = (Specification) installFromURL(url, compoName);
    if (spec == null) {
      return null;
    }
    if (!(spec instanceof Specification)) {
      logger.error("component " + compoName + " is found but is not a Specification.");
View Full Code Here

   
    mainImpl = CST.apamResolver.findImplByName(this, mainComponent);
    if (mainImpl != null) {
      logger.debug("The main component of " + this.getName() + " is an Implementation : " + mainImpl.getName());
    } else {
      Specification spec = CST.apamResolver.findSpecByName(this, mainComponent);
      if (spec != null) {
        logger.debug("The main component of " + this.getName() + " is a Specification : " + spec.getName());
        /*
         * It is a specification to resolve as the main implem. Do not
         * select another composite
         */
        Set<String> constraints = new HashSet<String>();
View Full Code Here

    // (missing, eager)

    // Look if the client requires one of the resources provided by the
    // specification
    if (compoDep.getTarget() instanceof SpecificationReference) {
      Specification spec = CST.apamResolver.findSpecByName(compoInst, ((SpecificationReference) compoDep.getTarget()).getName());
      if ((spec != null) && spec.getDeclaration().getProvidedResources().contains(getTarget()) && (!multiple || compoDep.isMultiple())) {
        return true;
      }
    }

    // If the composite has a relation toward an implementation
View Full Code Here

  @Test
  public void testPropertyDefinitionSpec_tct026() {

    logger.debug("Testing Specification properties defined");
    Specification specsS1 = waitForSpecByName(null, "specs-s1-tct026");

    for (int i = 0; i <= 6; i++) {
      Assert.assertEquals(
          " Property def" + i + "-specs-s1 is not defined",
          "def" + i + "-specs-s1",
          specsS1.getDeclaration()
              .getPropertyDefinition("def" + i + "-specs-s1")
              .getName());
    }

    logger.debug("Testing Specification properties setted");
    Assert.assertEquals(" Property def0-specs-s1 is not setted",
        "final-value", specsS1.getProperty("def0-specs-s1"));
    Assert.assertEquals(" Property def1-specs-s1 is not setted",
        "final-value", specsS1.getProperty("def1-specs-s1"));

  }
View Full Code Here

  @Test
  public void testPropertyDefinitionFloat_tct029() {

    logger.debug("Testing definition of Float in apam descriptors ");
    Specification specsS1 = waitForSpecByName(null, "specs-s1-tct026");
    Implementation implemS1 = waitForImplByName(null, "implem-s1-tct026");
    Instance instanceS1 = waitForInstByName(null, "instance-s1-tct026");

    for (int i = 0; i < 3; i++) {
      testPropertyDefinition(specsS1, "prop-def" + i, "float",
View Full Code Here

  @Test
  public void testPropertySettingFloat_tct030() {
    logger.debug("Testing get and set of Float from apam descriptors (values and default values)");

    Specification specsS1 = waitForSpecByName(null, "specs-s1-tct026");
    Implementation implemS1 = waitForImplByName(null, "implem-s1-tct026");
    Instance instanceS1 = waitForInstByName(null, "instance-s1-tct026");

    logger.debug("Testing properties already setted in descriptor");
    testPropertyGetFloat(specsS1, "prop-def0", (float) 12.34);
    testPropertyGetFloat(implemS1, "prop-def0", (float) 12.34);
    testPropertyGetFloat(instanceS1, "prop-def0", (float) 12.34);

    testPropertyGetFloat(implemS1, "prop-impl0", (float) 23.45);
    testPropertyGetFloat(instanceS1, "prop-impl0", (float) 23.45);

    testPropertyGetFloat(instanceS1, "prop-inst0", (float) 34.56);
   
    testPropertyGetFloat(implemS1, "prop-def4", (float) 12.34);

    logger.debug("Testing properties default values setted in descriptor (not working - specification of apam behavior ambiguous)");

    logger.debug("Testing setting and getting properties using apam API");
    specsS1.setProperty("prop-def1", new Float(98.76));
    testPropertyGetFloat(specsS1, "prop-def1", (float) 98.76);

    instanceS1.setProperty("prop-inst2", new Float(98.76));
    testPropertyGetFloat(instanceS1, "prop-inst2", (float) 98.76);
  }
View Full Code Here

  }

  protected Specification waitForSpecByName(Component client,
      String componentName, long timeout) {
    waitForApam();
    Specification spec = CST.apamResolver.findSpecByName(client,
        componentName);
    long sleep = 0;

    while (sleep < timeout && spec == null) {
      try {
View Full Code Here

 
        String specName = null;
 
        SpecificationReference specReference = null;
 
        Specification spec = CST.componentBroker.getSpec(specName);
        if (spec != null) {
          specReference = spec.getApformSpec().getDeclaration().getReference();
        }
 
        declaration = new RemoteImplementationDeclaration(name,specReference);
        // TODO distriman: load remote interfaces
        // declaration.getProvidedResources().add(new
View Full Code Here

TOP

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

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.