Search in sources :

Example 6 with SimpleConfig

use of org.apache.sling.caconfig.example.SimpleConfig in project sling by apache.

the class ConfigurationResolverCustomPersistence2Test method testNonExistingContentResource_Simple.

@Test
public void testNonExistingContentResource_Simple() {
    SimpleConfig cfg = underTest.get(null).as(SimpleConfig.class);
    assertNull(cfg.stringParam());
    assertEquals(5, cfg.intParam());
    assertEquals(false, cfg.boolParam());
}
Also used : SimpleConfig(org.apache.sling.caconfig.example.SimpleConfig) Test(org.junit.Test)

Example 7 with SimpleConfig

use of org.apache.sling.caconfig.example.SimpleConfig in project sling by apache.

the class ConfigurationResolverCustomPersistence2Test method testConfig_Simple.

@Test
public void testConfig_Simple() {
    context.build().resource("/conf/content/site1/settings/org.apache.sling.caconfig.example.SimpleConfig/jcr:content", "stringParam", "configValue1", "intParam", 111, "boolParam", true);
    SimpleConfig cfg = underTest.get(site1Page1).as(SimpleConfig.class);
    assertEquals("configValue1", cfg.stringParam());
    assertEquals(111, cfg.intParam());
    assertEquals(true, cfg.boolParam());
}
Also used : SimpleConfig(org.apache.sling.caconfig.example.SimpleConfig) Test(org.junit.Test)

Example 8 with SimpleConfig

use of org.apache.sling.caconfig.example.SimpleConfig in project sling by apache.

the class ConfigurationResolverCustomPersistence2Test method testConfig_SimpleWithName.

@Test
public void testConfig_SimpleWithName() {
    context.build().resource("/conf/content/site1/settings/sampleName/jcr:content", "stringParam", "configValue1.1", "intParam", 1111, "boolParam", true);
    SimpleConfig cfg = underTest.get(site1Page1).name("sampleName").as(SimpleConfig.class);
    assertEquals("configValue1.1", cfg.stringParam());
    assertEquals(1111, cfg.intParam());
    assertEquals(true, cfg.boolParam());
}
Also used : SimpleConfig(org.apache.sling.caconfig.example.SimpleConfig) Test(org.junit.Test)

Example 9 with SimpleConfig

use of org.apache.sling.caconfig.example.SimpleConfig in project sling by apache.

the class ConfigurationResolverCustomPersistence2Test method testNonExistingConfig_Simple.

@Test
public void testNonExistingConfig_Simple() {
    SimpleConfig cfg = underTest.get(site1Page1).as(SimpleConfig.class);
    assertNull(cfg.stringParam());
    assertEquals(5, cfg.intParam());
    assertEquals(false, cfg.boolParam());
}
Also used : SimpleConfig(org.apache.sling.caconfig.example.SimpleConfig) Test(org.junit.Test)

Example 10 with SimpleConfig

use of org.apache.sling.caconfig.example.SimpleConfig in project sling by apache.

the class ConfigurationResolverCustomPersistenceTest method testNonExistingContentResource_Simple.

@Test
public void testNonExistingContentResource_Simple() {
    SimpleConfig cfg = underTest.get(null).as(SimpleConfig.class);
    assertNull(cfg.stringParam());
    assertEquals(5, cfg.intParam());
    assertEquals(false, cfg.boolParam());
}
Also used : SimpleConfig(org.apache.sling.caconfig.example.SimpleConfig) Test(org.junit.Test)

Aggregations

SimpleConfig (org.apache.sling.caconfig.example.SimpleConfig)20 Test (org.junit.Test)20 NestedConfig (org.apache.sling.caconfig.example.NestedConfig)6 ListConfig (org.apache.sling.caconfig.example.ListConfig)4 Resource (org.apache.sling.api.resource.Resource)1 ConfigurationBuilder (org.apache.sling.caconfig.ConfigurationBuilder)1 WithoutAnnotationConfig (org.apache.sling.caconfig.example.WithoutAnnotationConfig)1