Skip to content

Commit

Permalink
Clean dependency tree
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Aleksandrov <[email protected]>
  • Loading branch information
dalexandrov committed Dec 1, 2023
1 parent 67362f9 commit 8484dc3
Show file tree
Hide file tree
Showing 17 changed files with 245 additions and 142 deletions.
16 changes: 1 addition & 15 deletions microprofile/config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,17 @@
<artifactId>jakarta.inject-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.helidon.microprofile.cdi</groupId>
<artifactId>helidon-microprofile-cdi</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.helidon.microprofile.testing</groupId>
<artifactId>helidon-microprofile-testing-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions microprofile/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.helidon.microprofile.testing</groupId>
<artifactId>helidon-microprofile-testing-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.helidon.common</groupId>
<artifactId>helidon-common-reactive</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
import static org.glassfish.jersey.CommonProperties.PROVIDER_DEFAULT_DISABLE;
import static org.glassfish.jersey.server.ServerProperties.WADL_FEATURE_DISABLE;

class JaxRsService implements HttpService {
public class JaxRsService implements HttpService {
/**
* If set to {@code "true"}, Jersey will ignore responses in exceptions.
*/
Expand All @@ -97,7 +97,8 @@ private JaxRsService(ResourceConfig resourceConfig,
this.application = getApplication(resourceConfig);
}

static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injectionManager) {
@SuppressWarnings("checkstyle:MissingJavadocMethod")
public static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injectionManager) {
resourceConfig.property(PROVIDER_DEFAULT_DISABLE, "ALL");
resourceConfig.property(WADL_FEATURE_DISABLE, "true");

Expand Down
70 changes: 70 additions & 0 deletions microprofile/tests/config/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Oracle and/or its affiliates.
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.
-->

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.helidon.microprofile.tests</groupId>
<artifactId>helidon-microprofile-tests-project</artifactId>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>helidon-microprofile-tests-config</artifactId>
<name>Helidon Microprofile Config Tests</name>

<description>
Microprofile config implementation.
</description>

<dependencies>
<dependency>
<groupId>io.helidon.microprofile.config</groupId>
<artifactId>helidon-microprofile-config</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.helidon.microprofile.cdi</groupId>
<artifactId>helidon-microprofile-cdi</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.helidon.microprofile.testing</groupId>
<artifactId>helidon-microprofile-testing-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
*
* 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 io.helidon.microprofile.config;

import java.util.List;
import java.util.Map;
import java.util.Objects;

import io.helidon.config.mp.MpConfigSources;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;

class ObjectMappingTest {
private static ClassLoader classLoader;
private static ConfigProviderResolver resolver;

@BeforeAll
static void initClass() {
classLoader = Thread.currentThread().getContextClassLoader();
resolver = ConfigProviderResolver.instance();
}

@Test
void testIt() {
// Removed use of system properties, as those stay around after test is finished
Map<String, String> configMap = Map.of("built.it", "configured",
"list.0.it", "first",
"list.1.it", "second");

resolver.registerConfig(resolver.getBuilder()
.withSources(MpConfigSources.create(configMap))
.build(),
classLoader);

// need to go through resolver to wrap config in our SE/MP wrapper
Config config = resolver.getConfig(classLoader);
io.helidon.config.Config helidonConfig = (io.helidon.config.Config) config;

try {
Built built = helidonConfig.get("built").as(Built.class).get();
assertThat(built.it, is("configured"));

List<Built> list = helidonConfig.get("list").asList(Built.class).get();
assertThat(list, hasSize(2));
assertThat(list, Matchers.contains(new Built("first"), new Built("second")));

} finally {
resolver.releaseConfig(config);
}
}

public static class Built {
private final String it;

private Built(Builder builder) {
this.it = builder.it;
}

private Built(String it) {
this.it = it;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Built built = (Built) o;
return it.equals(built.it);
}

@Override
public int hashCode() {
return Objects.hash(it);
}

public static class Builder {
private String it;

public Builder it(String it) {
this.it = it;
return this;
}

public Built build() {
return new Built(this);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
#
# 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.
#

# needed to run unit tests independently based on explicit beans using SeContainerInitializer
mp.initializer.allow=true
mp.initializer.warn=false

camelCase=yes
yamlProperty=no
Loading

0 comments on commit 8484dc3

Please sign in to comment.