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.api.core.security.Base64PropertyValueSecurity;
26  import de.smartics.properties.impl.config.domain.key.envapp.EnvAppConfigurationKey;
27  import de.smartics.properties.impl.config.properties.PropertiesConfigurationProperties;
28  import de.smartics.properties.spi.config.proxy.PropertyConfigurationObjectBuilder;
29  import de.smartics.testdoc.annotations.Uut;
30  import de.smartics.testdoc.categories.type.ObjectBasics;
31  import de.smartics.util.test.theories.ObjectTheories;
32  
33  /**
34   * Tests {@link PropertyConfigurationObjectBuilder}.
35   */
36  @Category(ObjectBasics.class)
37  @Uut(type = PropertyConfigurationObjectBuilder.class)
38  public class PropertyConfigurationProxyObjectBasicsTest extends ObjectTheories
39  { // NOPMD
40  
41    // ********************************* Fields *********************************
42  
43    // --- constants ------------------------------------------------------------
44  
45    // --- members --------------------------------------------------------------
46  
47    // ****************************** Inner Classes *****************************
48  
49    // ********************************* Methods ********************************
50  
51    // --- prepare --------------------------------------------------------------
52  
53    private static PropertyConfigurationObjectBuilder builder =
54        new PropertyConfigurationObjectBuilder();
55  
56    private static PropertiesConfigurationProperties configurationProperties;
57  
58    static
59    {
60      final EnvironmentId environmentId = new EnvironmentId("test");
61      final ApplicationId applicationId =
62          new ApplicationId("groupId", "artefactId", "version");
63      final ConfigurationKey<?> key =
64          new EnvAppConfigurationKey(environmentId, applicationId);
65      configurationProperties =
66          new PropertiesConfigurationProperties(key,
67              new Base64PropertyValueSecurity());
68      configurationProperties.addClassPathProperties(TestProperties.class);
69    }
70  
71    // --- helper ---------------------------------------------------------------
72  
73    // --- tests ----------------------------------------------------------------
74  
75    @DataPoint
76    public static final TestProperties DEFAULT = builder.build(
77        TestProperties.class, configurationProperties);
78  
79    @DataPoint
80    public static final TestProperties OTHER = builder.build(
81        TestProperties.class, configurationProperties);
82  }