KEYCLOAK-12689 - (tests)

This commit is contained in:
Dmitry Telegin 2020-02-14 18:07:37 +03:00 committed by Stian Thorgersen
parent e6b4685659
commit e134cae795
4 changed files with 54 additions and 1 deletions

View file

@ -57,6 +57,11 @@
<artifactId>quarkus-arc</artifactId> <artifactId>quarkus-arc</artifactId>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -74,6 +79,15 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<environmentVariables>
<KEYCLOAK_CAMEL_CASE_SCOPE_CAMEL_CASE_PROP>foobar</KEYCLOAK_CAMEL_CASE_SCOPE_CAMEL_CASE_PROP>
</environmentVariables>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

View file

@ -33,6 +33,11 @@ public class MicroProfileConfigProvider implements Config.ConfigProvider {
this.config = ConfigProvider.getConfig(); this.config = ConfigProvider.getConfig();
} }
// for testing only
MicroProfileConfigProvider(ClassLoader cl) {
this.config = ConfigProvider.getConfig(cl);
}
@Override @Override
public String getProvider(String spi) { public String getProvider(String spi) {
return scope(spi).get("provider"); return scope(spi).get("provider");

View file

@ -0,0 +1,35 @@
/*
* Copyright 2020 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.provider.quarkus;
import org.junit.Test;
import static org.junit.Assert.*;
public class MicroProfileConfigProviderTest {
public MicroProfileConfigProviderTest() {
}
@Test
public void testCamelCase() {
ClassLoader cl = this.getClass().getClassLoader().getParent();
MicroProfileConfigProvider provider = new MicroProfileConfigProvider(cl);
String value = provider.scope("camelCaseScope").get("camelCaseProp");
assertEquals(value, "foobar");
}
}

View file

@ -42,7 +42,6 @@
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<maven.test.skip>true</maven.test.skip>
<noDeps>true</noDeps> <noDeps>true</noDeps>
</properties> </properties>