View Javadoc

1   /*
2    * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package test.de.smartics.properties.spi.config.proxy;
17  
18  import org.junit.experimental.categories.Category;
19  import org.junit.experimental.theories.DataPoint;
20  
21  import test.de.smartics.properties.spi.config.proxy.examples.TestProperties;
22  import de.smartics.properties.api.config.domain.key.ApplicationId;
23  import de.smartics.properties.api.config.domain.key.ConfigurationKey;
24  import de.smartics.properties.api.config.domain.key.EnvironmentId;
25  import de.smartics.properties.impl.config.properties.PropertiesConfigurationProperties;
26  import de.smartics.properties.spi.config.proxy.PropertyConfigurationObjectBuilder;
27  import de.smartics.testdoc.annotations.Uut;
28  import de.smartics.testdoc.categories.type.ObjectBasics;
29  import de.smartics.util.test.theories.ObjectTheories;
30  
31  /**
32   * Tests {@link PropertyConfigurationObjectBuilder}.
33   */
34  @Category(ObjectBasics.class)
35  @Uut(type = PropertyConfigurationObjectBuilder.class)
36  public class PropertyConfigurationProxyObjectBasicsTest extends ObjectTheories
37  { // NOPMD
38  
39    // ********************************* Fields *********************************
40  
41    // --- constants ------------------------------------------------------------
42  
43    // --- members --------------------------------------------------------------
44  
45    // ****************************** Inner Classes *****************************
46  
47    // ********************************* Methods ********************************
48  
49    // --- prepare --------------------------------------------------------------
50  
51    private static PropertyConfigurationObjectBuilder builder =
52        new PropertyConfigurationObjectBuilder();
53  
54    private static PropertiesConfigurationProperties configurationProperties;
55  
56    static
57    {
58      final EnvironmentId environmentId = new EnvironmentId("test");
59      final ApplicationId applicationId =
60          new ApplicationId("groupId", "artefactId", "version");
61      final ConfigurationKey key =
62          new ConfigurationKey(environmentId, applicationId);
63      configurationProperties = new PropertiesConfigurationProperties(key);
64      configurationProperties.addClassPathProperties(TestProperties.class);
65    }
66  
67    // --- helper ---------------------------------------------------------------
68  
69    // --- tests ----------------------------------------------------------------
70  
71    @DataPoint
72    public static final TestProperties DEFAULT = builder.build(
73        TestProperties.class, configurationProperties);
74  
75    @DataPoint
76    public static final TestProperties OTHER = builder.build(
77        TestProperties.class, configurationProperties);
78  }