Skip to content

Commit

Permalink
Eliminate usage of Guava
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Mar 18, 2024
1 parent df24a3a commit 43b3111
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
3 changes: 3 additions & 0 deletions publisher/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<action type="fix" dev="iakulenka" issue="4">
Fix issue with AEMaaCS: Use bundle ID instead of bundle instance to pass over bundle reference to ServletContainerBridge.
</action>
<action type="update" dev="sseifert">
Eliminate usage of Guava.
</action>
</release>

<release version="1.2.0" date="2019-06-03">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import org.glassfish.jersey.server.ServerProperties;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;

import io.wcm.caravan.jaxrs.publisher.JaxRsClassesProvider;
Expand All @@ -39,14 +38,13 @@
*/
class JaxRsApplication extends Application {

private static final Map<String, Object> DEFAULT_PROPERTIES = ImmutableMap.<String, Object>builder()
private static final Map<String, Object> DEFAULT_PROPERTIES = Map.of(
// look for implementations described by META-INF/services/*
.put(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, false)
ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, false,
// disable auto discovery on server, as it's handled via OSGI
.put(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true)
ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true,
// disable WADL generation by default
.put(ServerProperties.WADL_FEATURE_DISABLE, true)
.build();
ServerProperties.WADL_FEATURE_DISABLE, true);

private final Set<JaxRsComponent> localComponents;
private final Set<JaxRsComponent> globalComponents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

import com.google.common.collect.ImmutableSet;

import io.wcm.caravan.jaxrs.publisher.JaxRsClassesProvider;
import io.wcm.caravan.jaxrs.publisher.JaxRsComponent;

Expand All @@ -54,8 +52,8 @@ public class JaxRsApplicationTest {
@Test
public void test_getSingletons() throws Exception {

JaxRsApplication app = new JaxRsApplication(ImmutableSet.of(localComponent), ImmutableSet.of(globalComponent),
ImmutableSet.of(localClassesProvider), ImmutableSet.of(globalClassesProvider));
JaxRsApplication app = new JaxRsApplication(Set.of(localComponent), Set.of(globalComponent),
Set.of(localClassesProvider), Set.of(globalClassesProvider));
Set<Object> singletons = app.getSingletons();

assertEquals(2, singletons.size());
Expand All @@ -67,10 +65,10 @@ public void test_getSingletons() throws Exception {
public void test_getClasses_from_local_components() throws Exception {

when(localClassesProvider.getClasses())
.thenReturn(ImmutableSet.of(AdditionalResource.class));
.thenReturn(Set.of(AdditionalResource.class));

JaxRsApplication app = new JaxRsApplication(ImmutableSet.of(localComponent), ImmutableSet.of(globalComponent),
ImmutableSet.of(localClassesProvider), ImmutableSet.of(globalClassesProvider));
JaxRsApplication app = new JaxRsApplication(Set.of(localComponent), Set.of(globalComponent),
Set.of(localClassesProvider), Set.of(globalClassesProvider));
Set<Class<?>> additionalClasses = app.getClasses();

assertEquals(1, additionalClasses.size());
Expand All @@ -81,10 +79,10 @@ public void test_getClasses_from_local_components() throws Exception {
public void test_getClasses_from_global_components() throws Exception {

when(globalClassesProvider.getClasses())
.thenReturn(ImmutableSet.of(AdditionalResource.class));
.thenReturn(Set.of(AdditionalResource.class));

JaxRsApplication app = new JaxRsApplication(ImmutableSet.of(localComponent), ImmutableSet.of(globalComponent),
ImmutableSet.of(localClassesProvider), ImmutableSet.of(globalClassesProvider));
JaxRsApplication app = new JaxRsApplication(Set.of(localComponent), Set.of(globalComponent),
Set.of(localClassesProvider), Set.of(globalClassesProvider));
Set<Class<?>> additionalClasses = app.getClasses();

assertEquals(1, additionalClasses.size());
Expand Down

0 comments on commit 43b3111

Please sign in to comment.