Examples of ConfigurationMetaData


Examples of org.objectweb.celtix.configuration.ConfigurationMetadata

        assertNotNull(factory.createDefaultProvider(null));
    }
   
    public void testConstruction() {
        assertNotNull(top);       
        ConfigurationMetadata model = top.getModel();
        assertNotNull(model);
        assertEquals(18, model.getDefinitions().size());
    }
View Full Code Here

Examples of org.objectweb.celtix.configuration.ConfigurationMetadata

        "http://celtix.objectweb.org/configuration/types";
   

    public void testStandardTypes() {
            
        ConfigurationMetadata model = buildMetadata("meta1.xml");
        assertEquals("http://celtix.objectweb.org/configuration/test/meta1",
                     model.getNamespaceURI());
        Collection<ConfigurationItemMetadata> definitions = model.getDefinitions();
        assertEquals(9, definitions.size());
        ConfigurationItemMetadata definition = null;
       
        definition = model.getDefinition("booleanItem");
        assertNotNull(definition);
        assertEquals("booleanItem", definition.getName());
        assertEquals(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "boolean"),
                     definition.getType());
        assertEquals(LifecyclePolicy.STATIC, definition.getLifecyclePolicy());
       
        definition = model.getDefinition("shortItem");
        assertNotNull(definition);
        assertEquals("shortItem", definition.getName());
        assertEquals(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "short"),
                     definition.getType());
       
        definition = model.getDefinition("intItem");
        assertNotNull(definition);
        assertEquals("intItem", definition.getName());
        assertEquals(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "int"),
                     definition.getType());
       
        definition = model.getDefinition("integerItem");
        assertNotNull(definition);
        assertEquals("integerItem", definition.getName());
        assertEquals(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "integer"),
                     definition.getType());
        // assertNull(definition.getDescription());
        assertEquals(LifecyclePolicy.PROCESS, definition.getLifecyclePolicy());
       
        definition = model.getDefinition("longItem");
        assertNotNull(definition);
        assertEquals("longItem", definition.getName());
        assertEquals(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "long"),
                     definition.getType());
        // assertEquals(definition.getName() + " description", definition.getDescription());
        assertEquals(LifecyclePolicy.BUS, definition.getLifecyclePolicy());
       
        definition = model.getDefinition("floatItem");
        assertNotNull(definition);
        assertEquals("floatItem", definition.getName());
        assertEquals(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "float"),
                     definition.getType());
       
        definition = model.getDefinition("doubleItem");
        assertNotNull(definition);
        assertEquals("doubleItem", definition.getName());
        assertEquals(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "double"),
                     definition.getType());
        // assertEquals(definition.getName() + " description", definition.getDescription());
        assertEquals(LifecyclePolicy.DYNAMIC, definition.getLifecyclePolicy());
       
        definition = model.getDefinition("stringItem");
        assertNotNull(definition);
        assertEquals("stringItem", definition.getName());
        assertEquals(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "string"),
                     definition.getType());
       
        definition = model.getDefinition("stringListItem");
        assertNotNull(definition);
        assertEquals("stringListItem", definition.getName());
        assertEquals(new QName(TYPES_NAMESPACE_URI, "stringListType"),
                     definition.getType());
        assertEquals(LifecyclePolicy.STATIC, definition.getLifecyclePolicy());
View Full Code Here

Examples of org.objectweb.celtix.configuration.ConfigurationMetadata

        }
        assertNotNull(buildMetadata("meta7.xml", false));
    }
   
    public void testDefaultValue() {       
        ConfigurationMetadata model = buildMetadata("meta8.xml");
        Collection<ConfigurationItemMetadata> definitions = model.getDefinitions();
        assertEquals(9, definitions.size());
       
        ConfigurationItemMetadata definition = null
        Object defaultValue = null;
      
        definition = model.getDefinition("booleanItem");
        defaultValue = definition.getDefaultValue();
        assertNotNull(defaultValue);
        assertEquals("java.lang.Boolean", defaultValue.getClass().getName());
        assertEquals(true, ((Boolean)defaultValue).booleanValue());
       
        definition = model.getDefinition("integerItem");
        defaultValue = definition.getDefaultValue();
        assertNotNull(defaultValue);
        assertEquals("java.math.BigInteger", defaultValue.getClass().getName());
        assertEquals(44959, ((BigInteger)defaultValue).intValue());
       
        definition = model.getDefinition("longItem");
        defaultValue = definition.getDefaultValue();
        assertNotNull(defaultValue);
        assertEquals("java.lang.Long", defaultValue.getClass().getName());
        assertEquals(-99, ((Long)defaultValue).longValue());
       
        definition = model.getDefinition("doubleItem");
        defaultValue = definition.getDefaultValue();
        assertNotNull(defaultValue);
        assertEquals("java.lang.Double", defaultValue.getClass().getName());
        assertTrue(Math.abs(1234.5678 - ((Double)defaultValue).doubleValue()) < 0.5E-5);
       
        definition = model.getDefinition("stringItem");
        defaultValue = definition.getDefaultValue();
        assertNotNull(defaultValue);
        assertEquals("java.lang.String", defaultValue.getClass().getName());
        assertEquals("\"Hello World!\"", (String)defaultValue);
       
        definition = model.getDefinition("stringListItem");
        defaultValue = definition.getDefaultValue();
        assertNotNull(defaultValue);

        assertEquals("org.objectweb.celtix.configuration.types.StringListType",
                     defaultValue.getClass().getName());
View Full Code Here

Examples of org.objectweb.celtix.configuration.ConfigurationMetadata

        cb = ConfigurationBuilderFactory.getBuilder(null);
       
        ConfigurationMetadataBuilder builder = new ConfigurationMetadataBuilder(true);
        InputStream is = DefaultResourceManager.instance()
            .getResourceAsStream("org/objectweb/celtix/bus/configuration/resources/leaf.xml");
        ConfigurationMetadata model = null;
        try {
            model = builder.build(is);
        } catch (IOException ex) {
            // ignore
        }
        cb.addModel(model);
        return cb.buildConfiguration(model.getNamespaceURI(), id, top);
    }
View Full Code Here

Examples of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata

  }

  @Override
  public synchronized void init(ProcessingEnvironment env) {
    super.init(env);
    this.metadata = new ConfigurationMetadata();
    this.typeUtils = new TypeUtils(env);
    try {
      this.fieldValuesParser = new JavaCompilerFieldValuesParser(env);
    }
    catch (Throwable ex) {
View Full Code Here

Examples of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata

        // We only want local files, not any classpath jars
        return metadata;
      }
      InputStream inputStream = manualMetadata.openInputStream();
      try {
        ConfigurationMetadata merged = new ConfigurationMetadata(metadata);
        try {
          merged.addAll(new JsonMarshaller().read(inputStream));
        }
        catch (Exception ex) {
          throw new IllegalStateException(ex);
        }
        return merged;
View Full Code Here

Examples of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata

  @Rule
  public TemporaryFolder temporaryFolder = new TemporaryFolder();

  @Test
  public void notAnnotated() throws Exception {
    ConfigurationMetadata metadata = compile(NotAnnotated.class);
    assertThat("No config metadata file should have been generated when "
        + "no metadata is discovered", metadata.getItems(), empty());
  }
View Full Code Here

Examples of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata

        + "no metadata is discovered", metadata.getItems(), empty());
  }

  @Test
  public void simpleProperties() throws Exception {
    ConfigurationMetadata metadata = compile(SimpleProperties.class);
    assertThat(metadata, containsGroup("simple").fromSource(SimpleProperties.class));
    assertThat(
        metadata,
        containsProperty("simple.the-name", String.class)
            .fromSource(SimpleProperties.class)
View Full Code Here

Examples of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata

    assertThat(metadata, not(containsProperty("simple.size")));
  }

  @Test
  public void simplePrefixValueProperties() throws Exception {
    ConfigurationMetadata metadata = compile(SimplePrefixValueProperties.class);
    assertThat(metadata,
        containsGroup("simple").fromSource(SimplePrefixValueProperties.class));
    assertThat(
        metadata,
        containsProperty("simple.name", String.class).fromSource(
View Full Code Here

Examples of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata

            SimplePrefixValueProperties.class));
  }

  @Test
  public void simpleTypeProperties() throws Exception {
    ConfigurationMetadata metadata = compile(SimpleTypeProperties.class);
    assertThat(metadata,
        containsGroup("simple.type").fromSource(SimpleTypeProperties.class));
    assertThat(metadata, containsProperty("simple.type.my-string", String.class));
    assertThat(metadata, containsProperty("simple.type.my-byte", Byte.class));
    assertThat(metadata,
        containsProperty("simple.type.my-primitive-byte", Byte.class));
    assertThat(metadata, containsProperty("simple.type.my-char", Character.class));
    assertThat(metadata,
        containsProperty("simple.type.my-primitive-char", Character.class));
    assertThat(metadata, containsProperty("simple.type.my-boolean", Boolean.class));
    assertThat(metadata,
        containsProperty("simple.type.my-primitive-boolean", Boolean.class));
    assertThat(metadata, containsProperty("simple.type.my-short", Short.class));
    assertThat(metadata,
        containsProperty("simple.type.my-primitive-short", Short.class));
    assertThat(metadata, containsProperty("simple.type.my-integer", Integer.class));
    assertThat(metadata,
        containsProperty("simple.type.my-primitive-integer", Integer.class));
    assertThat(metadata, containsProperty("simple.type.my-long", Long.class));
    assertThat(metadata,
        containsProperty("simple.type.my-primitive-long", Long.class));
    assertThat(metadata, containsProperty("simple.type.my-double", Double.class));
    assertThat(metadata,
        containsProperty("simple.type.my-primitive-double", Double.class));
    assertThat(metadata, containsProperty("simple.type.my-float", Float.class));
    assertThat(metadata,
        containsProperty("simple.type.my-primitive-float", Float.class));
    assertThat(metadata.getItems().size(), equalTo(18));
  }
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.