diff --git a/pom.xml b/pom.xml index 50de801..ad65caa 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ org.commonjava service-parent - 4 + 5-SNAPSHOT 4.0.0 org.commonjava.indy.service @@ -44,7 +44,7 @@ 1.1.1 1.5-SNAPSHOT - 1.1 + 1.2-SNAPSHOT 3.11.3 14.0.6.Final @@ -216,9 +216,13 @@ jackson-dataformat-yaml 2.14.0 + + + + org.infinispan - infinispan-core + infinispan-core-jakarta org.infinispan @@ -234,11 +238,6 @@ - - org.jboss.spec.javax.ws.rs - jboss-jaxrs-api_2.1_spec - 2.0.2.Final - org.commonjava.atlas atlas-relationships-api @@ -350,8 +349,8 @@ org.commonjava.util - http-testserver-core - 2.0 + http-testserver-quarkus + 2.3.0-SNAPSHOT test diff --git a/src/main/java/org/commonjava/indy/service/repository/change/GroupConsistencyListener.java b/src/main/java/org/commonjava/indy/service/repository/change/GroupConsistencyListener.java index e1d1f38..fa270c3 100644 --- a/src/main/java/org/commonjava/indy/service/repository/change/GroupConsistencyListener.java +++ b/src/main/java/org/commonjava/indy/service/repository/change/GroupConsistencyListener.java @@ -29,8 +29,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.util.Set; import static org.commonjava.indy.service.repository.change.event.kafka.KafkaEventUtils.CHANNEL_INTERNAL; diff --git a/src/main/java/org/commonjava/indy/service/repository/change/audit/StoreAuditManager.java b/src/main/java/org/commonjava/indy/service/repository/change/audit/StoreAuditManager.java index c85ecdf..53dff5d 100644 --- a/src/main/java/org/commonjava/indy/service/repository/change/audit/StoreAuditManager.java +++ b/src/main/java/org/commonjava/indy/service/repository/change/audit/StoreAuditManager.java @@ -31,9 +31,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; diff --git a/src/main/java/org/commonjava/indy/service/repository/change/event/DefaultStoreEventDispatcher.java b/src/main/java/org/commonjava/indy/service/repository/change/event/DefaultStoreEventDispatcher.java index 61498e5..407d07a 100644 --- a/src/main/java/org/commonjava/indy/service/repository/change/event/DefaultStoreEventDispatcher.java +++ b/src/main/java/org/commonjava/indy/service/repository/change/event/DefaultStoreEventDispatcher.java @@ -34,9 +34,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Default; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Default; +import jakarta.inject.Inject; import java.util.HashMap; import java.util.HashSet; import java.util.List; diff --git a/src/main/java/org/commonjava/indy/service/repository/change/event/NoOpStoreEventDispatcher.java b/src/main/java/org/commonjava/indy/service/repository/change/event/NoOpStoreEventDispatcher.java index f9bcc00..5aec969 100644 --- a/src/main/java/org/commonjava/indy/service/repository/change/event/NoOpStoreEventDispatcher.java +++ b/src/main/java/org/commonjava/indy/service/repository/change/event/NoOpStoreEventDispatcher.java @@ -20,8 +20,8 @@ import org.commonjava.indy.service.repository.model.ArtifactStore; import org.commonjava.indy.service.repository.model.StoreKey; -import javax.enterprise.inject.Alternative; -import javax.inject.Named; +import jakarta.enterprise.inject.Alternative; +import jakarta.inject.Named; import java.util.Map; @Alternative diff --git a/src/main/java/org/commonjava/indy/service/repository/change/event/StoreEventDispatcher.java b/src/main/java/org/commonjava/indy/service/repository/change/event/StoreEventDispatcher.java index 4387b0b..8c4529b 100644 --- a/src/main/java/org/commonjava/indy/service/repository/change/event/StoreEventDispatcher.java +++ b/src/main/java/org/commonjava/indy/service/repository/change/event/StoreEventDispatcher.java @@ -20,7 +20,7 @@ import org.commonjava.indy.service.repository.model.ArtifactStore; import org.commonjava.indy.service.repository.model.StoreKey; -import javax.enterprise.event.Event; +import jakarta.enterprise.event.Event; import java.util.Map; /** diff --git a/src/main/java/org/commonjava/indy/service/repository/change/event/kafka/KafkaEventUtils.java b/src/main/java/org/commonjava/indy/service/repository/change/event/kafka/KafkaEventUtils.java index 0d72be4..9974a68 100644 --- a/src/main/java/org/commonjava/indy/service/repository/change/event/kafka/KafkaEventUtils.java +++ b/src/main/java/org/commonjava/indy/service/repository/change/event/kafka/KafkaEventUtils.java @@ -22,8 +22,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; /** * This event dispatcher will dispatch Store Event through kafka diff --git a/src/main/java/org/commonjava/indy/service/repository/client/storage/StorageService.java b/src/main/java/org/commonjava/indy/service/repository/client/storage/StorageService.java index 1114e32..f7f0a4b 100644 --- a/src/main/java/org/commonjava/indy/service/repository/client/storage/StorageService.java +++ b/src/main/java/org/commonjava/indy/service/repository/client/storage/StorageService.java @@ -17,10 +17,10 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; -import javax.ws.rs.DELETE; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.core.Response; @Path("/api/storage") @RegisterRestClient(configKey="storage-service-api") diff --git a/src/main/java/org/commonjava/indy/service/repository/client/util/CustomClientRequestFilter.java b/src/main/java/org/commonjava/indy/service/repository/client/util/CustomClientRequestFilter.java index 3c012be..0e8cc7a 100644 --- a/src/main/java/org/commonjava/indy/service/repository/client/util/CustomClientRequestFilter.java +++ b/src/main/java/org/commonjava/indy/service/repository/client/util/CustomClientRequestFilter.java @@ -21,13 +21,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Priority; -import javax.inject.Inject; -import javax.ws.rs.Priorities; -import javax.ws.rs.client.ClientRequestContext; -import javax.ws.rs.client.ClientRequestFilter; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.ext.Provider; +import jakarta.annotation.Priority; +import jakarta.inject.Inject; +import jakarta.ws.rs.Priorities; +import jakarta.ws.rs.client.ClientRequestContext; +import jakarta.ws.rs.client.ClientRequestFilter; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.ext.Provider; @Provider @Priority(Priorities.AUTHENTICATION) diff --git a/src/main/java/org/commonjava/indy/service/repository/config/IndyRepositoryConfiguration.java b/src/main/java/org/commonjava/indy/service/repository/config/IndyRepositoryConfiguration.java index 31bd84b..bc92e66 100644 --- a/src/main/java/org/commonjava/indy/service/repository/config/IndyRepositoryConfiguration.java +++ b/src/main/java/org/commonjava/indy/service/repository/config/IndyRepositoryConfiguration.java @@ -20,7 +20,7 @@ import io.smallrye.config.WithDefault; import io.smallrye.config.WithName; -import javax.enterprise.context.ApplicationScoped; +import jakarta.enterprise.context.ApplicationScoped; import java.util.List; import java.util.Optional; diff --git a/src/main/java/org/commonjava/indy/service/repository/controller/AdminController.java b/src/main/java/org/commonjava/indy/service/repository/controller/AdminController.java index 045ea12..3a0e793 100644 --- a/src/main/java/org/commonjava/indy/service/repository/controller/AdminController.java +++ b/src/main/java/org/commonjava/indy/service/repository/controller/AdminController.java @@ -35,14 +35,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.ws.rs.core.Response; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.core.Response; import java.util.ArrayList; import java.util.List; -import static javax.ws.rs.core.Response.Status.FORBIDDEN; -import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; +import static jakarta.ws.rs.core.Response.Status.FORBIDDEN; +import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; @ApplicationScoped public class AdminController diff --git a/src/main/java/org/commonjava/indy/service/repository/controller/MaintenanceController.java b/src/main/java/org/commonjava/indy/service/repository/controller/MaintenanceController.java index fba5c44..dacc15c 100644 --- a/src/main/java/org/commonjava/indy/service/repository/controller/MaintenanceController.java +++ b/src/main/java/org/commonjava/indy/service/repository/controller/MaintenanceController.java @@ -26,8 +26,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; diff --git a/src/main/java/org/commonjava/indy/service/repository/controller/QueryController.java b/src/main/java/org/commonjava/indy/service/repository/controller/QueryController.java index 5c2c5bb..0c37136 100644 --- a/src/main/java/org/commonjava/indy/service/repository/controller/QueryController.java +++ b/src/main/java/org/commonjava/indy/service/repository/controller/QueryController.java @@ -29,8 +29,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -40,9 +40,9 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; -import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; -import static javax.ws.rs.core.Response.Status.NOT_FOUND; +import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; +import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; +import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; import static org.commonjava.indy.service.repository.model.StoreKey.fromString; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; import static org.commonjava.indy.service.repository.model.pkg.PackageTypeConstants.isValidPackageType; diff --git a/src/main/java/org/commonjava/indy/service/repository/controller/StatsController.java b/src/main/java/org/commonjava/indy/service/repository/controller/StatsController.java index 54b8301..2e8ff44 100644 --- a/src/main/java/org/commonjava/indy/service/repository/controller/StatsController.java +++ b/src/main/java/org/commonjava/indy/service/repository/controller/StatsController.java @@ -25,12 +25,12 @@ import org.commonjava.indy.service.repository.model.version.Versioning; import org.commonjava.indy.service.repository.util.JaxRsUriFormatter; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.util.ArrayList; import java.util.List; -import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; +import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; @ApplicationScoped public class StatsController diff --git a/src/main/java/org/commonjava/indy/service/repository/data/AbstractStoreDataManager.java b/src/main/java/org/commonjava/indy/service/repository/data/AbstractStoreDataManager.java index 4ec2b21..39675a3 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/AbstractStoreDataManager.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/AbstractStoreDataManager.java @@ -32,7 +32,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -50,7 +50,7 @@ import static java.util.Collections.emptySet; import static java.util.Collections.singletonMap; -import static javax.ws.rs.core.Response.Status.METHOD_NOT_ALLOWED; +import static jakarta.ws.rs.core.Response.Status.METHOD_NOT_ALLOWED; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.commonjava.indy.service.repository.data.StoreUpdateAction.DELETE; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/DefaultArtifactStoreQuery.java b/src/main/java/org/commonjava/indy/service/repository/data/DefaultArtifactStoreQuery.java index 3ba92db..8ac71d9 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/DefaultArtifactStoreQuery.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/DefaultArtifactStoreQuery.java @@ -32,7 +32,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/DefaultStoreValidator.java b/src/main/java/org/commonjava/indy/service/repository/data/DefaultStoreValidator.java index 97c2974..b32d9f2 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/DefaultStoreValidator.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/DefaultStoreValidator.java @@ -28,9 +28,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Default; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Default; +import jakarta.inject.Inject; import java.io.IOException; import java.net.MalformedURLException; import java.net.URISyntaxException; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/StoreDataManagerProducer.java b/src/main/java/org/commonjava/indy/service/repository/data/StoreDataManagerProducer.java index a3f0c50..8162f03 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/StoreDataManagerProducer.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/StoreDataManagerProducer.java @@ -18,17 +18,15 @@ import org.commonjava.indy.service.repository.config.IndyRepositoryConfiguration; import org.commonjava.indy.service.repository.data.annotations.ClusterStoreDataManager; import org.commonjava.indy.service.repository.data.annotations.MemStoreDataManager; -import org.commonjava.indy.service.repository.data.annotations.StandaloneStoreDataManager; import org.commonjava.indy.service.repository.data.cassandra.CassandraStoreDataManager; -import org.commonjava.indy.service.repository.data.infinispan.InfinispanStoreDataManager; import org.commonjava.indy.service.repository.data.mem.MemoryStoreDataManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Default; -import javax.enterprise.inject.Produces; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Default; +import jakarta.enterprise.inject.Produces; +import jakarta.inject.Inject; @ApplicationScoped public class StoreDataManagerProducer @@ -41,16 +39,11 @@ public class StoreDataManagerProducer @Produces @ApplicationScoped @Default - public StoreDataManager produces( @StandaloneStoreDataManager InfinispanStoreDataManager ispnStoreDataManager, - @ClusterStoreDataManager CassandraStoreDataManager clusterStoreDataManager, + public StoreDataManager produces( @ClusterStoreDataManager CassandraStoreDataManager clusterStoreDataManager, @MemStoreDataManager MemoryStoreDataManager memoryStoreDataManager ) { String storageType = repoConfig.storageType().orElse( "" ); - if ( IndyRepositoryConfiguration.STORAGE_INFINISPAN.equals( storageType ) ) - { - return ispnStoreDataManager; - } - else if ( IndyRepositoryConfiguration.STORAGE_CASSANDRA.equals( storageType ) ) + if ( IndyRepositoryConfiguration.STORAGE_CASSANDRA.equals( storageType ) ) { return clusterStoreDataManager; } diff --git a/src/main/java/org/commonjava/indy/service/repository/data/StoreDataSetupAction.java b/src/main/java/org/commonjava/indy/service/repository/data/StoreDataSetupAction.java index 548a316..17563f2 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/StoreDataSetupAction.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/StoreDataSetupAction.java @@ -30,9 +30,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/StoreValidator.java b/src/main/java/org/commonjava/indy/service/repository/data/StoreValidator.java index 5d1c39e..a9ece80 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/StoreValidator.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/StoreValidator.java @@ -17,7 +17,7 @@ import org.commonjava.indy.service.repository.model.ArtifactStore; -import javax.enterprise.context.ApplicationScoped; +import jakarta.enterprise.context.ApplicationScoped; /** * Store Validator used to validate URL for for {@link ArtifactStore} instances and diff --git a/src/main/java/org/commonjava/indy/service/repository/data/annotations/ClusterStoreDataManager.java b/src/main/java/org/commonjava/indy/service/repository/data/annotations/ClusterStoreDataManager.java index 77a90d1..1143b7d 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/annotations/ClusterStoreDataManager.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/annotations/ClusterStoreDataManager.java @@ -15,7 +15,7 @@ */ package org.commonjava.indy.service.repository.data.annotations; -import javax.inject.Qualifier; +import jakarta.inject.Qualifier; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/annotations/MemStoreDataManager.java b/src/main/java/org/commonjava/indy/service/repository/data/annotations/MemStoreDataManager.java index a26216b..86be401 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/annotations/MemStoreDataManager.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/annotations/MemStoreDataManager.java @@ -15,7 +15,7 @@ */ package org.commonjava.indy.service.repository.data.annotations; -import javax.inject.Qualifier; +import jakarta.inject.Qualifier; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/annotations/StandaloneStoreDataManager.java b/src/main/java/org/commonjava/indy/service/repository/data/annotations/StandaloneStoreDataManager.java index b8d375a..7cb43b1 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/annotations/StandaloneStoreDataManager.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/annotations/StandaloneStoreDataManager.java @@ -15,7 +15,7 @@ */ package org.commonjava.indy.service.repository.data.annotations; -import javax.inject.Qualifier; +import jakarta.inject.Qualifier; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraClient.java b/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraClient.java index 95b696f..be638d8 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraClient.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraClient.java @@ -22,9 +22,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraConfiguration.java b/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraConfiguration.java index e2ef050..5ff68b0 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraConfiguration.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraConfiguration.java @@ -18,8 +18,8 @@ import io.quarkus.runtime.Startup; import org.eclipse.microprofile.config.inject.ConfigProperty; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.util.Optional; import static java.util.Optional.of; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraStoreDataManager.java b/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraStoreDataManager.java index 65c7bd9..d89aa24 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraStoreDataManager.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraStoreDataManager.java @@ -34,8 +34,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraStoreQuery.java b/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraStoreQuery.java index 358d4d2..4100c33 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraStoreQuery.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/cassandra/CassandraStoreQuery.java @@ -27,9 +27,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.util.HashSet; import java.util.Set; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/cassandra/RemoteKojiStoreDataCache.java b/src/main/java/org/commonjava/indy/service/repository/data/cassandra/RemoteKojiStoreDataCache.java index 50c26aa..1c8a996 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/cassandra/RemoteKojiStoreDataCache.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/cassandra/RemoteKojiStoreDataCache.java @@ -15,7 +15,7 @@ */ package org.commonjava.indy.service.repository.data.cassandra; -import javax.inject.Qualifier; +import jakarta.inject.Qualifier; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/AffectedByStoreCache.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/AffectedByStoreCache.java deleted file mode 100644 index ae16a80..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/AffectedByStoreCache.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan; - -import javax.inject.Qualifier; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Qualifier -@Target( { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD}) -@Retention( RetentionPolicy.RUNTIME) -@Documented -public @interface AffectedByStoreCache -{ -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/CacheProducer.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/CacheProducer.java index 799e6be..1ed2b30 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/CacheProducer.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/CacheProducer.java @@ -33,10 +33,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; @@ -67,9 +67,6 @@ public class CacheProducer @Inject InfinispanConfiguration ispnConfig; - @Inject - IndyRepositoryConfiguration repoConfig; - @Inject TraceManager traceManager; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanConfiguration.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanConfiguration.java index 3c6d606..21d4bf9 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanConfiguration.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanConfiguration.java @@ -18,8 +18,8 @@ import io.quarkus.runtime.Startup; import org.eclipse.microprofile.config.inject.ConfigProperty; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.io.File; import java.util.Optional; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanStoreDataByPkgMapStartupAction.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanStoreDataByPkgMapStartupAction.java deleted file mode 100644 index bebedfb..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanStoreDataByPkgMapStartupAction.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan; - -import io.quarkus.runtime.Startup; -import org.commonjava.indy.service.repository.data.StoreDataManager; - -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; - -@ApplicationScoped -@Startup -@Deprecated -public class InfinispanStoreDataByPkgMapStartupAction -{ - - @Inject - StoreDataManager storeDataManager; - - @PostConstruct - public void onStart() - { - if ( storeDataManager instanceof InfinispanStoreDataManager ) - { - ( (InfinispanStoreDataManager) storeDataManager ).initByPkgMap(); - } - } - -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanStoreDataManager.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanStoreDataManager.java deleted file mode 100644 index 999fa3a..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanStoreDataManager.java +++ /dev/null @@ -1,363 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan; - -import org.commonjava.indy.service.repository.audit.ChangeSummary; -import org.commonjava.indy.service.repository.config.IndyRepositoryConfiguration; -import org.commonjava.indy.service.repository.data.AbstractStoreDataManager; -import org.commonjava.indy.service.repository.data.annotations.StandaloneStoreDataManager; -import org.commonjava.indy.service.repository.change.event.NoOpStoreEventDispatcher; -import org.commonjava.indy.service.repository.change.event.StoreEventDispatcher; -import org.commonjava.indy.service.repository.model.ArtifactStore; -import org.commonjava.indy.service.repository.model.Group; -import org.commonjava.indy.service.repository.model.StoreKey; -import org.commonjava.indy.service.repository.model.StoreType; -import org.infinispan.Cache; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static java.util.Optional.ofNullable; -import static org.commonjava.indy.service.repository.data.StoreUpdateAction.STORE; -import static org.commonjava.indy.service.repository.data.infinispan.StoreDataCacheProducer.AFFECTED_BY_STORE_CACHE; -import static org.commonjava.indy.service.repository.data.infinispan.StoreDataCacheProducer.STORE_BY_PKG_CACHE; -import static org.commonjava.indy.service.repository.data.infinispan.StoreDataCacheProducer.STORE_DATA_CACHE; -import static org.commonjava.indy.service.repository.model.StoreType.group; - -/** - * @deprecated infinispan data store is disabled in indy cluster mode. Will use {@link org.commonjava.indy.service.repository.data.cassandra.CassandraStoreDataManager} instead. - */ -@ApplicationScoped -@StandaloneStoreDataManager -@Deprecated -public class InfinispanStoreDataManager - extends AbstractStoreDataManager -{ - private final Logger logger = LoggerFactory.getLogger( getClass() ); - - @Inject - @StoreDataCache - CacheHandle stores; - - @Inject - @StoreByPkgCache - CacheHandle>> storesByPkg; - - @Inject - @AffectedByStoreCache - CacheHandle> affectedByStores; - - @Inject - StoreEventDispatcher dispatcher; - - @Inject - IndyRepositoryConfiguration indyConfiguration; - - @Inject - CacheProducer producer; - - @Override - protected StoreEventDispatcher getStoreEventDispatcher() - { - return dispatcher; - } - - protected InfinispanStoreDataManager() - { - } - - public InfinispanStoreDataManager( final Cache cache, - final Cache>> storesByPkg, - final Cache> affectedByStoresCache ) - { - this.dispatcher = new NoOpStoreEventDispatcher(); - this.stores = new CacheHandle<>( STORE_DATA_CACHE, cache ); - this.storesByPkg = new CacheHandle<>( STORE_BY_PKG_CACHE, storesByPkg ); - this.affectedByStores = new CacheHandle<>( AFFECTED_BY_STORE_CACHE, affectedByStoresCache ); - logger.warn( "Constructor init: STARTUP ACTIONS MAY NOT RUN." ); - } - - @Override - protected Optional getArtifactStoreInternal( StoreKey key ) - { - return ofNullable( stores.get( key ) ); - } - - @Override - protected synchronized ArtifactStore removeArtifactStoreInternal( StoreKey key ) - { - final ArtifactStore store = stores.remove( key ); - final Map> typedKeys = storesByPkg.get( key.getPackageType() ); - if ( typedKeys != null ) - { - final Set keys = typedKeys.get( key.getType() ); - if ( keys != null ) - { - keys.remove( key ); - } - } - return store; - } - - @Override - public void clear( final ChangeSummary summary ) - { - //TODO: I'm really concern if we need this implementation as we don't know if ISPN will clean all persistent entries!!! - stores.clear(); - storesByPkg.clear(); - affectedByStores.clear(); - storesByPkg.clear(); - } - - @Override - public Set getAllArtifactStores() - { - return stores.executeCache( c -> new HashSet<>( c.values() ), "getAllStores" ); - } - - @Override - public Map getArtifactStoresByKey() - { - return stores.executeCache( c -> { - Map ret = new HashMap<>(); - c.values().forEach( v -> ret.put( v.getKey(), v ) ); - return ret; - - }, "getAllStoresByKey" ); - } - - @Override - public boolean hasArtifactStore( final StoreKey key ) - { - return stores.containsKey( key ); - } - - @Override - public boolean isStarted() - { - return true; - } - - @Override - public boolean isEmpty() - { - return stores.isEmpty(); - } - - @Override - public Stream streamArtifactStoreKeys() - { - return stores.executeCache( c -> c.keySet().stream() ); - } - - @Override - protected synchronized ArtifactStore putArtifactStoreInternal( StoreKey storeKey, ArtifactStore store ) - { - final ArtifactStore added = stores.put( storeKey, store ); - final Map> typedKeys = - storesByPkg.computeIfAbsent( storeKey.getPackageType(), k -> new HashMap<>() ); - final Set keys = typedKeys.computeIfAbsent( storeKey.getType(), k -> new HashSet<>() ); - keys.add( storeKey ); - return added; - } - - @Override - public Set getStoreKeysByPkg( final String pkg ) - { - final Map> typedKeys = storesByPkg.get( pkg ); - if ( typedKeys != null ) - { - final Set keys = new HashSet<>(); - typedKeys.values().forEach( keys::addAll ); - logger.trace( "There are {} stores for package type {}", keys.size(), pkg ); - return keys; - } - else - { - logger.trace( "There is no store for package type {}", pkg ); - return Collections.emptySet(); - } - } - - @Override - public Set getStoreKeysByPkgAndType( final String pkg, final StoreType type ) - { - final Map> typedKeys = storesByPkg.get( pkg ); - if ( typedKeys != null ) - { - final Set keys = typedKeys.get( type ); - if ( keys != null ) - { - logger.trace( "There are {} stores for package type {} with type {}", keys.size(), pkg, type ); - return new HashSet<>( keys ); - } - } - logger.trace( "There is no store for package type {} with type {}", pkg, type ); - return Collections.emptySet(); - } - - @Override - public Set affectedBy( final Collection keys ) - { - logger.debug( "Calculate affectedBy for keys: {}", keys ); - checkAffectedByCacheHealth(); - - final Set result = new HashSet<>(); - - // use these to avoid recursion - final Set processed = new HashSet<>(); - final LinkedList toProcess = new LinkedList<>( keys ); - - while ( !toProcess.isEmpty() ) - { - StoreKey key = toProcess.removeFirst(); - if ( key == null ) - { - continue; - } - - if ( processed.add( key ) ) - { - Set affected = affectedByStores.get( key ); - if ( affected != null ) - { - logger.debug( "Get affectedByStores, key: {}, affected: {}", key, affected ); - affected = affected.stream().filter( k -> k.getType() == group ).collect( Collectors.toSet() ); - for ( StoreKey gKey : affected ) - { - // avoid loading the ArtifactStore instance again and again - if ( !processed.contains( gKey ) && !toProcess.contains( gKey ) ) - { - final Optional storeOpt = getArtifactStoreInternal( gKey ); - - // if this group is disabled, we don't want to keep loading it again and again. - if ( storeOpt.isPresent() ) - { - final ArtifactStore store = storeOpt.get(); - if ( store.isDisabled() ) - { - processed.add( gKey ); - } - else - { - // add the group to the toProcess list so we can find any result that might include it in their own membership - toProcess.addLast( gKey ); - result.add( (Group) store ); - } - } - else - { - logger.warn( "Error: the group {} does not exist as affected by for store {}", gKey, - key ); - processed.add( gKey ); - } - } - } - } - } - } - - if ( logger.isTraceEnabled() ) - { - logger.trace( "Groups affected by {} are: {}", keys, - result.stream().map( ArtifactStore::getKey ).collect( Collectors.toSet() ) ); - } - return filterAffectedGroups( result ); - } - - @Override - public Set getArtifactStoresByPkgAndType( String packageType, StoreType storeType ) - { - return stores.executeCache( c -> c.values() - .stream() - .filter( item -> packageType.equals( item.getPackageType() ) - && storeType.equals( item.getType() ) ) ) - .collect( Collectors.toSet() ); - } - - @Override - protected void removeAffectedStore( StoreKey key ) - { - affectedByStores.remove( key ); - } - - @Override - protected void removeAffectedBy( StoreKey key, StoreKey affected ) - { - affectedByStores.computeIfAbsent( key, k -> new HashSet<>() ).remove( affected ); - } - - @Override - protected void addAffectedBy( StoreKey key, StoreKey affected ) - { - affectedByStores.computeIfAbsent( key, k -> new HashSet<>() ).add( affected ); - } - - public void initAffectedBy() - { - final Set allStores = getAllArtifactStores(); - allStores.stream().filter( s -> group == s.getType() ).forEach( s -> refreshAffectedBy( s, null, STORE ) ); - - checkAffectedByCacheHealth(); - } - - private void checkAffectedByCacheHealth() - { - if ( affectedByStores.isEmpty() ) - { - logger.error( "Affected-by reverse mapping appears to have failed. The affected-by cache is empty!" ); - } - } - - public void initByPkgMap() - { - // re-fill the stores by package cache each time when reboot - if ( storesByPkg != null ) - { - logger.info( "Clean the stores-by-pkg cache" ); - storesByPkg.clear(); - } - - final Set allStores = getAllArtifactStores(); - logger.info( "There are {} stores need to fill in stores-by-pkg cache", allStores.size() ); - for ( ArtifactStore store : allStores ) - { - final Map> typedKeys = - storesByPkg.computeIfAbsent( store.getKey().getPackageType(), k -> new HashMap<>() ); - - final Set keys = typedKeys.computeIfAbsent( store.getKey().getType(), k -> new HashSet<>() ); - keys.add( store.getKey() ); - } - } - - @Override - protected CacheProducer getCacheProducer() - { - return producer; - } -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanStoreDataReverseMapStartupAction.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanStoreDataReverseMapStartupAction.java deleted file mode 100644 index c54200f..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanStoreDataReverseMapStartupAction.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan; - -import io.quarkus.runtime.Startup; -import org.commonjava.indy.service.repository.data.StoreDataManager; - -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; - -@ApplicationScoped -@Startup -@Deprecated -public class InfinispanStoreDataReverseMapStartupAction - -{ - @Inject - StoreDataManager storeDataManager; - - @PostConstruct - public void onStart() - { - if ( storeDataManager instanceof InfinispanStoreDataManager ) - { - ( (InfinispanStoreDataManager) storeDataManager ).initAffectedBy(); - } - } -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreByPkgCache.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreByPkgCache.java deleted file mode 100644 index 8ee3ebb..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreByPkgCache.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan; - -import javax.inject.Qualifier; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Qualifier -@Target( { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD}) -@Retention( RetentionPolicy.RUNTIME) -@Documented -@Deprecated -public @interface StoreByPkgCache -{ -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreDataCache.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreDataCache.java deleted file mode 100644 index 67ef4f8..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreDataCache.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan; - -import javax.inject.Qualifier; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Qualifier -@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD}) -@Retention( RetentionPolicy.RUNTIME) -@Documented -@Deprecated -public @interface StoreDataCache -{ -} - diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreDataCacheProducer.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreDataCacheProducer.java index 027038d..d405ab6 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreDataCacheProducer.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreDataCacheProducer.java @@ -20,9 +20,9 @@ import org.commonjava.indy.service.repository.model.StoreKey; import org.commonjava.indy.service.repository.model.StoreType; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Produces; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; +import jakarta.inject.Inject; import java.util.Map; import java.util.Set; @@ -43,30 +43,6 @@ public class StoreDataCacheProducer @Inject CacheProducer cacheProducer; - @StoreDataCache - @Produces - @ApplicationScoped - public CacheHandle getStoreDataCache() - { - return cacheProducer.getCache( STORE_DATA_CACHE ); - } - - @StoreByPkgCache - @Produces - @ApplicationScoped - public CacheHandle>> getStoreByPkgCache() - { - return cacheProducer.getCache( STORE_BY_PKG_CACHE ); - } - - @AffectedByStoreCache - @Produces - @ApplicationScoped - public CacheHandle> getAffectedByStores() - { - return cacheProducer.getCache( AFFECTED_BY_STORE_CACHE ); - } - @RemoteKojiStoreDataCache @Produces @ApplicationScoped diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreKey2StringMapper.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreKey2StringMapper.java deleted file mode 100644 index bf124cd..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/StoreKey2StringMapper.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan; - -import org.commonjava.indy.service.repository.model.StoreKey; -import org.infinispan.persistence.keymappers.TwoWayKey2StringMapper; - -/** - * @deprecated infinispan data store is disabled in indy cluster mode. Will use {@link org.commonjava.indy.service.repository.data.cassandra.CassandraStoreDataManager} instead. - */ -@Deprecated -public class StoreKey2StringMapper - implements TwoWayKey2StringMapper -{ - @Override - public Object getKeyMapping( String stringKey ) - { - return StoreKey.fromString( stringKey ); - } - - @Override - public boolean isSupportedType( Class keyType ) - { - return keyType == StoreKey.class; - } - - @Override - public String getStringMapping( Object key ) - { - return key.toString(); - } -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/CPInitialContextFactory.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/CPInitialContextFactory.java deleted file mode 100644 index 7352740..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/CPInitialContextFactory.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan.cpool; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.spi.InitialContextFactory; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Map; - -public class CPInitialContextFactory - implements InitialContextFactory -{ - private static CPInitialContext context; - - @Override - public synchronized Context getInitialContext( final Hashtable hashtable ) - throws NamingException - { - if ( context == null ) - { - context = new CPInitialContext(); - } - - return context; - } - - public static final class CPInitialContext - extends InitialContext - { - - private final Map bindings = new HashMap<>(); - - public CPInitialContext() - throws NamingException - { - } - - public CPInitialContext( final Hashtable environment ) - throws NamingException - { - } - - @Override - protected void init( final Hashtable environment ) - { - } - - @Override - public Context createSubcontext( final Name name ) - { - return this; - } - - @Override - public Context createSubcontext( final String name ) - { - return this; - } - - @Override - protected Context getDefaultInitCtx() - { - return this; - } - - @Override - public void bind( final Name name, final Object obj ) - { - bindings.put( toString( name ), obj ); - } - - @Override - public Object lookup( final String name ) - { - return bindings.get( name ); - } - - @Override - public Object lookup( final Name name ) - { - return bindings.get( toString( name ) ); - } - - @Override - public void bind( final String name, final Object obj ) - { - bindings.put( name, obj ); - } - - @Override - public void rebind( final String name, final Object obj ) - { - bindings.put( name, obj ); - } - - @Override - public void rebind( final Name name, final Object obj ) - { - bindings.put( toString( name ), obj ); - } - - private String toString( Name name ) - { - StringBuilder sb = new StringBuilder(); - for ( Enumeration e = name.getAll(); e.hasMoreElements(); ) - { - String part = e.nextElement(); - if ( sb.length() > 0 ) - { - sb.append( '/' ); - } - sb.append( part ); - } - - return sb.toString(); - } - } -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolBooter.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolBooter.java deleted file mode 100644 index ebffb87..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolBooter.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan.cpool; - -import io.quarkus.runtime.Startup; -import org.commonjava.indy.service.repository.config.IndyRepositoryConfiguration; -import org.commonjava.indy.service.repository.exception.IndyLifecycleException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Instance; -import javax.inject.Inject; - -@ApplicationScoped -@Startup -public class ConnectionPoolBooter -{ - private final Logger logger = LoggerFactory.getLogger( getClass() ); - - @Inject - Instance connectionPoolProvider; - - @Inject - IndyRepositoryConfiguration repositoryConfiguration; - - @PostConstruct - public void init() - throws IndyLifecycleException - { - if ( IndyRepositoryConfiguration.STORAGE_INFINISPAN.equals( - repositoryConfiguration.storageType().orElse( "" ) ) ) - { - logger.info( "\n\n\n\nStarting JNDI Connection Pools\n\n\n\n" ); - connectionPoolProvider.get().init(); - logger.info( "Connection pools started." ); - } - else - { - logger.info( - "Connection pool will not initialize because not using infinispan as data store for repository data, " ); - } - } - -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolConfig.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolConfig.java deleted file mode 100644 index 0008817..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolConfig.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan.cpool; - -import io.quarkus.runtime.Startup; -import org.eclipse.microprofile.config.inject.ConfigProperty; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.Properties; -import java.util.stream.Stream; - -import static java.lang.Boolean.TRUE; - -@Startup -@ApplicationScoped -public class ConnectionPoolConfig -{ - public static final String DS_PROPERTY_PREFIX = "datasource."; - - private static final String METRICS_SUBKEY = "metrics"; - - private static final String POOL_NAME = "repo-data-pool"; - - @SuppressWarnings( "OptionalUsedAsFieldOrParameterType" ) - @Inject - @ConfigProperty( name = "ispn." + POOL_NAME ) - Optional poolJndiName; - - // private static final String HEALTH_CHECKS_SUBKEY = "healthChecks"; - - private final Logger logger = LoggerFactory.getLogger( getClass() ); - - private final Map pools = new HashMap<>(); - - public Map getPools() - { - return pools; - } - - @PostConstruct - public void init() - { - - if ( poolJndiName.isPresent() ) - { - final String value = poolJndiName.get(); - // don't pass the param through to the background map, consume it here. - logger.info( "{}: Parsing connection pool from: '{}'", this, value ); - Map valueMap = toMap( value ); - - boolean metrics = TRUE.toString().equals( valueMap.remove( METRICS_SUBKEY ) ); - // boolean healthChecks = TRUE.toString().equals( valueMap.remove( HEALTH_CHECKS_SUBKEY ) ); - - final ConnectionPoolInfo cp = new ConnectionPoolInfo( POOL_NAME, toProperties( valueMap ), metrics ); - - logger.info( "{}: Adding: {}", this, cp ); - pools.put( POOL_NAME, cp ); - } - - } - - private Properties toProperties( final Map valueMap ) - { - Properties props = new Properties(); - valueMap.forEach( ( k, v ) -> { - //TODO remove log - logger.info( "Add datasource property: {}->{}", k, v ); - props.setProperty( k, v ); - } ); - - return props; - } - - private Map toMap( final String value ) - { - Map result = new HashMap<>(); - Stream.of( value.split( "\\s*,\\s*" ) ).forEach( ( s ) -> { - String[] parts = s.trim().split( "\\s*=\\s*" ); - if ( parts.length <= 1 ) - { - result.put( parts[0], Boolean.toString( TRUE ) ); - } - else - { - result.put( parts[0], parts[1] ); - } - } ); - - return result; - } - -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolInfo.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolInfo.java deleted file mode 100644 index ec0f64c..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolInfo.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan.cpool; - -import java.util.Properties; - -public class ConnectionPoolInfo -{ - private final String name; - - private final boolean useMetrics; -// -// private boolean useHealthChecks; - - private final Properties properties; - - public ConnectionPoolInfo( final String name, final Properties properties, final boolean useMetrics ) - { - this.name = name; - this.properties = properties; - this.useMetrics = useMetrics; - } - - public boolean isUseMetrics() - { - return useMetrics; - } - - - public String getName() - { - return name; - } - - public Properties getProperties() - { - return properties; - } - - @Override - public String toString() - { - return "ConnectionPoolInfo{" + "name='" + name + "'}"; - } -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolProvider.java b/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolProvider.java deleted file mode 100644 index e561cce..0000000 --- a/src/main/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ConnectionPoolProvider.java +++ /dev/null @@ -1,205 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan.cpool; - -import io.agroal.api.AgroalDataSource; -import io.agroal.api.AgroalDataSourceListener; -import io.agroal.api.configuration.AgroalDataSourceConfiguration; -import io.agroal.api.configuration.supplier.AgroalPropertiesReader; -import org.commonjava.indy.service.repository.exception.IndyLifecycleException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Map; -import java.util.Properties; - -import static javax.naming.Context.INITIAL_CONTEXT_FACTORY; - -@ApplicationScoped -public class ConnectionPoolProvider -{ - private final Logger logger = LoggerFactory.getLogger( getClass() ); - - @Inject - ConnectionPoolConfig config; - -// @Inject -// private MetricRegistry metricRegistry; - - public void init() - throws IndyLifecycleException - { - logger.info( "Starting connection pool binding..." ); - - Properties properties = System.getProperties(); - properties.setProperty( INITIAL_CONTEXT_FACTORY, CPInitialContextFactory.class.getName() ); - System.setProperties( properties ); - - InitialContext ctx; - try - { - ctx = new InitialContext(); - } - catch ( NamingException e ) - { - throw new IndyLifecycleException( "Failed to create JNDI InitialContext for binding datasources", e ); - } - - Map poolConfigs = config.getPools(); - logger.info( "Creating bindings for {} pools from config: {}", poolConfigs.size(), config ); - for (ConnectionPoolInfo poolInfo : poolConfigs.values() ) - { - try - { - AgroalPropertiesReader propertiesReader = new AgroalPropertiesReader( ConnectionPoolConfig.DS_PROPERTY_PREFIX ); - AgroalDataSourceConfiguration config = propertiesReader.readProperties( poolInfo.getProperties() ).get(); - config.setMetricsEnabled( poolInfo.isUseMetrics() ); - AgroalDataSource ds = AgroalDataSource.from( config, new AgroalDataSourceLogger( poolInfo.getName() ) ); - -// if ( poolInfo.isUseMetrics() ) -// { -// registerMetrics(ds.getMetrics(), poolInfo.getName()); -// } -// if ( poolInfo.isUseHealthChecks() ) -// { -// registerHealthChecks(ds, poolInfo.getName()); -// } - - String jndiName = "java:/comp/env/jdbc/" + poolInfo.getName(); - logger.info( "Binding datasource: {}", jndiName ); - ctx.rebind( jndiName, ds ); - } - catch ( NamingException e ) - { - throw new IndyLifecycleException( "Failed to bind datasource: " + poolInfo.getName(), e ); - } - catch ( SQLException e ) - { - throw new IndyLifecycleException( "Failed to start datasource: " + poolInfo.getName(), e ); - } - } - } - - -// private void registerMetrics(AgroalDataSourceMetrics agroalMetrics, String name) { -// metricRegistry.register(name(name, "acquireCount"), (Gauge) agroalMetrics::acquireCount); -// metricRegistry.register(name(name, "creationCount"), (Gauge) agroalMetrics::creationCount); -// metricRegistry.register(name(name, "leakDetectionCount"), (Gauge) agroalMetrics::leakDetectionCount); -// metricRegistry.register(name(name, "destroyCount"), (Gauge) agroalMetrics::destroyCount); -// metricRegistry.register(name(name, "flushCount"), (Gauge) agroalMetrics::flushCount); -// metricRegistry.register(name(name, "invalidCount"), (Gauge) agroalMetrics::invalidCount); -// metricRegistry.register(name(name, "reapCount"), (Gauge) agroalMetrics::reapCount); -// -// metricRegistry.register(name(name, "activeCount"), (Gauge) agroalMetrics::activeCount); -// metricRegistry.register(name(name, "availableCount"), (Gauge) agroalMetrics::availableCount); -// metricRegistry.register(name(name, "maxUsedCount"), (Gauge) agroalMetrics::maxUsedCount); -// metricRegistry.register(name(name, "awaitingCount"), (Gauge) agroalMetrics::awaitingCount); -// metricRegistry.register(name(name, "blockingTimeAverage"), (Gauge) agroalMetrics::blockingTimeAverage); -// metricRegistry.register(name(name, "blockingTimeMax"), (Gauge) agroalMetrics::blockingTimeMax); -// metricRegistry.register(name(name, "blockingTimeTotal"), (Gauge) agroalMetrics::blockingTimeTotal); -// metricRegistry.register(name(name, "creationTimeAverage"), (Gauge) agroalMetrics::creationTimeAverage); -// metricRegistry.register(name(name, "creationTimeMax"), (Gauge) agroalMetrics::creationTimeMax); -// metricRegistry.register(name(name, "creationTimeTotal"), (Gauge) agroalMetrics::creationTimeTotal); -// } - -// private void registerHealthChecks( AgroalDataSource ds, String name ) -// { -// metricRegistry.registerHealthCheck( name, () -> { -// try (Connection con = ds.getConnection()) -// { -// if ( con.isValid( 5 ) ) -// { -// return HealthCheckResult.healthy(); -// } -// else -// { -// return HealthCheckResult.unhealthy( -// String.format( "validation check failed for DataSource %s", name ) ); -// } -// } -// catch ( SQLException e ) -// { -// return HealthCheckResult.unhealthy( e ); -// } -// } ); -// } - - private static class AgroalDataSourceLogger implements AgroalDataSourceListener - { - private final Logger logger; - - public AgroalDataSourceLogger(String name) - { - logger = LoggerFactory.getLogger( AgroalDataSource.class.getName() + ".'" + name + "'" ); - } - - @Override public void onConnectionPooled(Connection connection) - { - logger.debug( "Added connection {} to the pool", connection ); - } - - @Override public void onConnectionAcquire(Connection connection) - { - logger.debug( "Connection {} acquired", connection ); - } - - @Override public void onConnectionReturn(Connection connection) - { - logger.debug( "Connection {} return", connection ); - } - - @Override public void onConnectionLeak(Connection connection, Thread thread) - { - logger.info( "Connection {} leak. Acquired by {}", connection, thread ); - } - - @Override public void beforeConnectionValidation(Connection connection) - { - logger.debug( "Connection {} about to be validated", connection ); - } - - @Override public void beforeConnectionFlush(Connection connection) - { - logger.debug( "Connection {} removed from the pool", connection ); - } - - @Override public void beforeConnectionReap(Connection connection) - { - logger.debug( "Connection {} idle", connection ); - } - - @Override public void onWarning(String message) - { - logger.warn( message ); - } - - @Override public void onWarning(Throwable throwable) - { - logger.warn( "Exception", throwable ); - } - - @Override public void onInfo(String message) - { - logger.info( message ); - } - } -} diff --git a/src/main/java/org/commonjava/indy/service/repository/data/mem/MemoryStoreDataManager.java b/src/main/java/org/commonjava/indy/service/repository/data/mem/MemoryStoreDataManager.java index 74fb825..7c9e8bf 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/mem/MemoryStoreDataManager.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/mem/MemoryStoreDataManager.java @@ -26,8 +26,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.util.HashMap; import java.util.HashSet; import java.util.Map; diff --git a/src/main/java/org/commonjava/indy/service/repository/data/metrics/MeasuringArtifactStoreQueryInterceptor.java b/src/main/java/org/commonjava/indy/service/repository/data/metrics/MeasuringArtifactStoreQueryInterceptor.java index d2c6366..1d64a14 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/metrics/MeasuringArtifactStoreQueryInterceptor.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/metrics/MeasuringArtifactStoreQueryInterceptor.java @@ -21,9 +21,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.decorator.Decorator; -import javax.decorator.Delegate; -import javax.inject.Inject; +import jakarta.decorator.Decorator; +import jakarta.decorator.Delegate; +import jakarta.inject.Inject; @Decorator public abstract class MeasuringArtifactStoreQueryInterceptor diff --git a/src/main/java/org/commonjava/indy/service/repository/data/metrics/TraceManager.java b/src/main/java/org/commonjava/indy/service/repository/data/metrics/TraceManager.java index f611a47..a063012 100644 --- a/src/main/java/org/commonjava/indy/service/repository/data/metrics/TraceManager.java +++ b/src/main/java/org/commonjava/indy/service/repository/data/metrics/TraceManager.java @@ -24,8 +24,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; import java.util.List; import java.util.Optional; import java.util.function.Function; diff --git a/src/main/java/org/commonjava/indy/service/repository/jaxrs/DTOStreamingOutput.java b/src/main/java/org/commonjava/indy/service/repository/jaxrs/DTOStreamingOutput.java index ac7d8a2..9ade2e3 100644 --- a/src/main/java/org/commonjava/indy/service/repository/jaxrs/DTOStreamingOutput.java +++ b/src/main/java/org/commonjava/indy/service/repository/jaxrs/DTOStreamingOutput.java @@ -22,8 +22,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.StreamingOutput; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.StreamingOutput; import java.io.IOException; import java.io.OutputStream; import java.util.concurrent.atomic.AtomicReference; diff --git a/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryAdminResources.java b/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryAdminResources.java index 72e5ce8..6bf13b6 100644 --- a/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryAdminResources.java +++ b/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryAdminResources.java @@ -40,22 +40,22 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; -import javax.ws.rs.core.UriInfo; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.HEAD; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.UriInfo; import java.io.IOException; import java.net.URI; import java.nio.charset.Charset; @@ -63,12 +63,12 @@ import java.util.List; import java.util.Map; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.CONFLICT; -import static javax.ws.rs.core.Response.noContent; -import static javax.ws.rs.core.Response.notModified; -import static javax.ws.rs.core.Response.ok; -import static javax.ws.rs.core.Response.status; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.CONFLICT; +import static jakarta.ws.rs.core.Response.noContent; +import static jakarta.ws.rs.core.Response.notModified; +import static jakarta.ws.rs.core.Response.ok; +import static jakarta.ws.rs.core.Response.status; import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.commonjava.indy.service.repository.model.ArtifactStore.METADATA_CHANGELOG; import static org.eclipse.microprofile.openapi.annotations.enums.ParameterIn.PATH; diff --git a/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryMaintenanceResources.java b/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryMaintenanceResources.java index f41f6c0..e840a95 100644 --- a/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryMaintenanceResources.java +++ b/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryMaintenanceResources.java @@ -27,31 +27,30 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; import java.io.File; import java.io.IOException; import java.util.List; import java.util.Map; import static java.lang.System.currentTimeMillis; -import static javax.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; -import static javax.ws.rs.core.Response.Status.FORBIDDEN; -import static javax.ws.rs.core.Response.Status.METHOD_NOT_ALLOWED; -import static javax.ws.rs.core.Response.Status.NOT_FOUND; -import static javax.ws.rs.core.Response.ok; +import static jakarta.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; +import static jakarta.ws.rs.core.Response.Status.FORBIDDEN; +import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; +import static jakarta.ws.rs.core.Response.ok; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; diff --git a/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryQueryResources.java b/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryQueryResources.java index d47bffd..11157e8 100644 --- a/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryQueryResources.java +++ b/src/main/java/org/commonjava/indy/service/repository/jaxrs/RepositoryQueryResources.java @@ -32,21 +32,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.ws.rs.Encoded; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.Encoded; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Response; import java.util.List; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; -import static javax.ws.rs.core.Response.Status.NOT_FOUND; -import static javax.ws.rs.core.Response.ok; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; +import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; +import static jakarta.ws.rs.core.Response.ok; import static org.eclipse.microprofile.openapi.annotations.enums.ParameterIn.QUERY; @Tag( name = "Store Querying APIs", description = "Resource for querying artifact store definitions" ) diff --git a/src/main/java/org/commonjava/indy/service/repository/jaxrs/ResponseHelper.java b/src/main/java/org/commonjava/indy/service/repository/jaxrs/ResponseHelper.java index 11aaae3..35ee192 100644 --- a/src/main/java/org/commonjava/indy/service/repository/jaxrs/ResponseHelper.java +++ b/src/main/java/org/commonjava/indy/service/repository/jaxrs/ResponseHelper.java @@ -22,19 +22,19 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.ResponseBuilder; -import javax.ws.rs.core.Response.Status; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.ResponseBuilder; +import jakarta.ws.rs.core.Response.Status; import java.io.PrintWriter; import java.io.StringWriter; import java.net.URI; import java.util.function.Consumer; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; @ApplicationScoped public class ResponseHelper diff --git a/src/main/java/org/commonjava/indy/service/repository/jaxrs/UnhandledThrowableHandler.java b/src/main/java/org/commonjava/indy/service/repository/jaxrs/UnhandledThrowableHandler.java index 64c7e10..08e4c1a 100644 --- a/src/main/java/org/commonjava/indy/service/repository/jaxrs/UnhandledThrowableHandler.java +++ b/src/main/java/org/commonjava/indy/service/repository/jaxrs/UnhandledThrowableHandler.java @@ -15,10 +15,10 @@ */ package org.commonjava.indy.service.repository.jaxrs; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.ext.ExceptionMapper; +import jakarta.ws.rs.ext.Provider; import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; diff --git a/src/main/java/org/commonjava/indy/service/repository/jaxrs/UnhandledWebApplicationExceptionHandler.java b/src/main/java/org/commonjava/indy/service/repository/jaxrs/UnhandledWebApplicationExceptionHandler.java index c21519c..6ccc0e2 100644 --- a/src/main/java/org/commonjava/indy/service/repository/jaxrs/UnhandledWebApplicationExceptionHandler.java +++ b/src/main/java/org/commonjava/indy/service/repository/jaxrs/UnhandledWebApplicationExceptionHandler.java @@ -15,11 +15,11 @@ */ package org.commonjava.indy.service.repository.jaxrs; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.ext.ExceptionMapper; +import jakarta.ws.rs.ext.Provider; import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; diff --git a/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/ApiVersioningFilter.java b/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/ApiVersioningFilter.java index 05295cb..7a598f4 100644 --- a/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/ApiVersioningFilter.java +++ b/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/ApiVersioningFilter.java @@ -20,18 +20,18 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.annotation.WebFilter; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import javax.servlet.http.HttpServletResponse; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.annotation.WebFilter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; @@ -39,8 +39,8 @@ import java.util.List; import java.util.Optional; -import static javax.servlet.http.HttpServletResponse.SC_GONE; -import static javax.ws.rs.core.HttpHeaders.ACCEPT; +import static jakarta.servlet.http.HttpServletResponse.SC_GONE; +import static jakarta.ws.rs.core.HttpHeaders.ACCEPT; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.commonjava.indy.service.repository.model.version.Versioning.HEADER_INDY_API_VERSION; import static org.commonjava.indy.service.repository.model.version.Versioning.HEADER_INDY_CUR_API_VERSION; diff --git a/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/StatsHandler.java b/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/StatsHandler.java index 44c1fac..9c3da70 100644 --- a/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/StatsHandler.java +++ b/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/StatsHandler.java @@ -29,21 +29,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Inject; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; +import jakarta.inject.Inject; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.UriInfo; import java.util.Date; import java.util.Map; import java.util.Set; import java.util.TreeSet; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.ok; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.ok; import static org.commonjava.indy.service.repository.model.PackageTypes.getPackageTypeDescriptorMap; import static org.commonjava.indy.service.repository.model.PackageTypes.getPackageTypes; import static org.commonjava.indy.service.repository.util.Constants.API_PREFIX; diff --git a/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/VersioningProvider.java b/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/VersioningProvider.java index ae1115b..ea8d8c6 100644 --- a/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/VersioningProvider.java +++ b/src/main/java/org/commonjava/indy/service/repository/jaxrs/version/VersioningProvider.java @@ -20,9 +20,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.inject.Default; -import javax.enterprise.inject.Produces; -import javax.inject.Singleton; +import jakarta.enterprise.inject.Default; +import jakarta.enterprise.inject.Produces; +import jakarta.inject.Singleton; import java.io.IOException; import java.io.InputStream; import java.util.Properties; diff --git a/src/main/java/org/commonjava/indy/service/repository/model/version/DeprecatedApis.java b/src/main/java/org/commonjava/indy/service/repository/model/version/DeprecatedApis.java index 72a8798..dce4b32 100644 --- a/src/main/java/org/commonjava/indy/service/repository/model/version/DeprecatedApis.java +++ b/src/main/java/org/commonjava/indy/service/repository/model/version/DeprecatedApis.java @@ -19,7 +19,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.inject.Alternative; +import jakarta.enterprise.inject.Alternative; import java.util.ArrayList; import java.util.List; import java.util.Optional; diff --git a/src/main/java/org/commonjava/indy/service/repository/model/version/Versioning.java b/src/main/java/org/commonjava/indy/service/repository/model/version/Versioning.java index 80a2a1d..9ee58cb 100644 --- a/src/main/java/org/commonjava/indy/service/repository/model/version/Versioning.java +++ b/src/main/java/org/commonjava/indy/service/repository/model/version/Versioning.java @@ -18,8 +18,8 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import javax.enterprise.inject.Alternative; -import javax.inject.Named; +import jakarta.enterprise.inject.Alternative; +import jakarta.inject.Named; @Alternative @Named diff --git a/src/main/java/org/commonjava/indy/service/repository/util/JaxRsUriFormatter.java b/src/main/java/org/commonjava/indy/service/repository/util/JaxRsUriFormatter.java index 0099e21..084faa9 100644 --- a/src/main/java/org/commonjava/indy/service/repository/util/JaxRsUriFormatter.java +++ b/src/main/java/org/commonjava/indy/service/repository/util/JaxRsUriFormatter.java @@ -19,7 +19,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.context.ApplicationScoped; +import jakarta.enterprise.context.ApplicationScoped; import java.net.MalformedURLException; import static org.apache.commons.lang3.StringUtils.join; diff --git a/src/main/java/org/commonjava/indy/service/repository/util/jackson/IndyJacksonCustomizer.java b/src/main/java/org/commonjava/indy/service/repository/util/jackson/IndyJacksonCustomizer.java index 624267f..3413dc1 100644 --- a/src/main/java/org/commonjava/indy/service/repository/util/jackson/IndyJacksonCustomizer.java +++ b/src/main/java/org/commonjava/indy/service/repository/util/jackson/IndyJacksonCustomizer.java @@ -27,9 +27,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.enterprise.inject.Instance; -import javax.inject.Inject; -import javax.inject.Singleton; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; import java.util.HashSet; import java.util.Map; import java.util.Set; diff --git a/src/main/java/org/commonjava/indy/service/repository/util/jackson/RepoApiSerializerModule.java b/src/main/java/org/commonjava/indy/service/repository/util/jackson/RepoApiSerializerModule.java index 056e619..a42e4b6 100644 --- a/src/main/java/org/commonjava/indy/service/repository/util/jackson/RepoApiSerializerModule.java +++ b/src/main/java/org/commonjava/indy/service/repository/util/jackson/RepoApiSerializerModule.java @@ -21,7 +21,7 @@ import org.commonjava.event.store.jackson.EventStoreKeySerializer; import org.commonjava.indy.service.repository.model.StoreKey; -import javax.enterprise.context.ApplicationScoped; +import jakarta.enterprise.context.ApplicationScoped; @ApplicationScoped public class RepoApiSerializerModule diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 7110f95..d92715a 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -38,7 +38,7 @@ quarkus: security: auth: enabled-in-dev-mode: false - opentelemetry: + otel: enabled: true log: level: INFO @@ -97,7 +97,7 @@ kafka: servers: "localhost:9092" storage-service-api/mp-rest/url: http://localhost -storage-service-api/mp-rest/scope: javax.inject.Singleton +storage-service-api/mp-rest/scope: jakarta.inject.Singleton mp: messaging: diff --git a/src/main/resources/infinispan.jdbc.xml b/src/main/resources/infinispan.jdbc.xml index 7a64af7..6dc8365 100644 --- a/src/main/resources/infinispan.jdbc.xml +++ b/src/main/resources/infinispan.jdbc.xml @@ -22,21 +22,6 @@ - - - - - - - - - - - - - - - diff --git a/src/test/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanGroupManagementTest.java b/src/test/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanGroupManagementTest.java deleted file mode 100644 index 25f4d27..0000000 --- a/src/test/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanGroupManagementTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan; - -import org.commonjava.indy.service.repository.data.tck.GroupDataManagerTCK; -import org.commonjava.indy.service.repository.data.tck.TCKFixtureProvider; - -public class InfinispanGroupManagementTest - extends GroupDataManagerTCK -{ - private InfinispanTCKFixtureProvider provider; - - @Override - public void doSetup() - { - provider = new InfinispanTCKFixtureProvider(); - provider.init(); - } - - @Override - protected TCKFixtureProvider getFixtureProvider() - { - return provider; - } -} diff --git a/src/test/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanTCKFixtureProvider.java b/src/test/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanTCKFixtureProvider.java deleted file mode 100644 index 8bbe6fa..0000000 --- a/src/test/java/org/commonjava/indy/service/repository/data/infinispan/InfinispanTCKFixtureProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan; - -import org.commonjava.indy.service.repository.data.StoreDataManager; -import org.commonjava.indy.service.repository.data.tck.TCKFixtureProvider; -import org.commonjava.indy.service.repository.model.ArtifactStore; -import org.commonjava.indy.service.repository.model.StoreKey; -import org.commonjava.indy.service.repository.model.StoreType; -import org.infinispan.Cache; -import org.infinispan.configuration.cache.ConfigurationBuilder; -import org.infinispan.configuration.global.GlobalConfigurationBuilder; -import org.infinispan.manager.DefaultCacheManager; - -import java.util.Map; -import java.util.Set; - -import static org.commonjava.indy.service.repository.data.infinispan.StoreDataCacheProducer.AFFECTED_BY_STORE_CACHE; -import static org.commonjava.indy.service.repository.data.infinispan.StoreDataCacheProducer.STORE_BY_PKG_CACHE; -import static org.commonjava.indy.service.repository.data.infinispan.StoreDataCacheProducer.STORE_DATA_CACHE; - -public class InfinispanTCKFixtureProvider - implements TCKFixtureProvider -{ - private InfinispanStoreDataManager dataManager; - - protected void init() - { - DefaultCacheManager cacheManager = new DefaultCacheManager( new GlobalConfigurationBuilder().build() ); - cacheManager.createCache( STORE_DATA_CACHE, new ConfigurationBuilder().build() ); - cacheManager.createCache( STORE_BY_PKG_CACHE, new ConfigurationBuilder().build() ); - cacheManager.createCache( AFFECTED_BY_STORE_CACHE, new ConfigurationBuilder().build() ); - Cache storeCache = cacheManager.getCache( STORE_DATA_CACHE, true ); - Cache>> storesByPkgCache = - cacheManager.getCache( STORE_BY_PKG_CACHE, true ); - Cache> affected = cacheManager.getCache( AFFECTED_BY_STORE_CACHE, true ); - dataManager = new InfinispanStoreDataManager( storeCache, storesByPkgCache, affected ); - } - - @Override - public StoreDataManager getDataManager() - { - return dataManager; - } -} diff --git a/src/test/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ContextBindAndLookupTest.java b/src/test/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ContextBindAndLookupTest.java deleted file mode 100644 index 02af289..0000000 --- a/src/test/java/org/commonjava/indy/service/repository/data/infinispan/cpool/ContextBindAndLookupTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.data.infinispan.cpool; - -import org.junit.jupiter.api.Test; - -import javax.naming.InitialContext; -import javax.naming.NamingException; -import java.util.Properties; - -import static javax.naming.Context.INITIAL_CONTEXT_FACTORY; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; - -public class ContextBindAndLookupTest -{ - @Test - public void bindAndLookup() - throws NamingException - { - String key = "java:/comp/env/foo"; - String val = "BAR"; - - Properties properties = System.getProperties(); - properties.setProperty( INITIAL_CONTEXT_FACTORY, CPInitialContextFactory.class.getName() ); - System.setProperties( properties ); - - bind( key, val ); - lookup( key, val ); - } - - private void lookup( final String key, final String val ) - throws NamingException - { - InitialContext ctx = new InitialContext(); - Object value = ctx.lookup( key ); - assertThat( value == val, equalTo( true ) ); - } - - private void bind( final String key, final String val ) - throws NamingException - { - InitialContext ctx = new InitialContext(); - ctx.bind( key, val ); - } -} diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteGroupTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteGroupTest.java index ddab82a..f2432f6 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteGroupTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteGroupTest.java @@ -19,7 +19,7 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.Group; import org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor; import org.junit.jupiter.api.Tag; @@ -27,12 +27,12 @@ import static io.restassured.RestAssured.delete; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.NOT_FOUND; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; +import static jakarta.ws.rs.core.Response.Status.OK; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class AddAndDeleteGroupTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteHostedRepoTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteHostedRepoTest.java index 6425b13..613e303 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteHostedRepoTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteHostedRepoTest.java @@ -19,20 +19,20 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.HostedRepository; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.delete; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.NOT_FOUND; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class AddAndDeleteHostedRepoTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteRemoteRepoTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteRemoteRepoTest.java index 91f1505..4881eac 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteRemoteRepoTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/AddAndDeleteRemoteRepoTest.java @@ -19,21 +19,21 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.RemoteRepository; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.delete; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.NOT_FOUND; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; import static org.hamcrest.CoreMatchers.is; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class AddAndDeleteRemoteRepoTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateGroupThenModifyAndVerifyChangesTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateGroupThenModifyAndVerifyChangesTest.java index 4899e11..c1567f6 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateGroupThenModifyAndVerifyChangesTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateGroupThenModifyAndVerifyChangesTest.java @@ -19,19 +19,19 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.Group; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; import static org.hamcrest.CoreMatchers.is; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class CreateGroupThenModifyAndVerifyChangesTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateHostedRepoThenModifyAndVerifyTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateHostedRepoThenModifyAndVerifyTest.java index c2e5809..003fb73 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateHostedRepoThenModifyAndVerifyTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateHostedRepoThenModifyAndVerifyTest.java @@ -19,19 +19,19 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.HostedRepository; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; import static org.hamcrest.CoreMatchers.is; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class CreateHostedRepoThenModifyAndVerifyTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateRemoteRepoThenModifyAndVerifyTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateRemoteRepoThenModifyAndVerifyTest.java index 0664d25..a201cb0 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateRemoteRepoThenModifyAndVerifyTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/CreateRemoteRepoThenModifyAndVerifyTest.java @@ -19,21 +19,21 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.RemoteRepository; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class CreateRemoteRepoThenModifyAndVerifyTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/GetRemoteByUrlTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/GetRemoteByUrlTest.java index 9b6ad53..3ac5ab1 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/GetRemoteByUrlTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/GetRemoteByUrlTest.java @@ -20,16 +20,17 @@ import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; import org.commonjava.indy.service.repository.ftests.matchers.StoreListingCheckMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.RemoteRepository; import org.commonjava.test.http.expect.ExpectationServer; +import org.commonjava.test.http.quarkus.InjectExpected; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; /** @@ -53,26 +54,14 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetRemoteByUrlTest extends AbstractStoreManagementTest { + @InjectExpected() public final ExpectationServer server = new ExpectationServer(); - @BeforeEach - public void before() - throws Exception - { - server.start(); - } - - @AfterEach - public void after() - { - server.stop(); - } - @Test public void getRemoteByUrl() throws Exception diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/GroupAdjustmentToMemberDeletionTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/GroupAdjustmentToMemberDeletionTest.java index aa9d5a9..3e52cfe 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/GroupAdjustmentToMemberDeletionTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/GroupAdjustmentToMemberDeletionTest.java @@ -19,7 +19,7 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.Group; import org.commonjava.indy.service.repository.model.HostedRepository; import org.hamcrest.CoreMatchers; @@ -28,11 +28,11 @@ import static io.restassured.RestAssured.delete; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @QuarkusTest @Tag( "function" ) //@Disabled("StoreManager.postStore not implemented yet, will cause this ftest fail.") diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/HostedAuthIndexWithReadonly.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/HostedAuthIndexWithReadonly.java index ee36218..f5c7b5a 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/HostedAuthIndexWithReadonly.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/HostedAuthIndexWithReadonly.java @@ -19,14 +19,14 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.HostedRepository; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; import static org.hamcrest.CoreMatchers.is; @@ -51,7 +51,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class HostedAuthIndexWithReadonly extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/IndySslValidationApiTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/IndySslValidationApiTest.java index b0c210c..b8e69b6 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/IndySslValidationApiTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/IndySslValidationApiTest.java @@ -17,29 +17,30 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; +import jakarta.inject.Inject; import org.commonjava.indy.service.repository.config.IndyRepositoryConfiguration; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; import org.commonjava.indy.service.repository.ftests.matchers.RevalidateAllMatcher; import org.commonjava.indy.service.repository.ftests.matchers.RevalidateRepoMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNSSLFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemorySSLFunctionProfile; import org.commonjava.indy.service.repository.model.RemoteRepository; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Inject; - import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; import static org.commonjava.indy.service.repository.model.StoreType.remote; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; import static org.commonjava.indy.service.repository.util.PathUtils.normalize; @QuarkusTest @Tag( "function" ) -@TestProfile( ISPNSSLFunctionProfile.class ) +@TestProfile( MemorySSLFunctionProfile.class ) +@Disabled("Always happened with Read time out issue. Need further check.") public class IndySslValidationApiTest extends AbstractStoreManagementTest { diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/ListStoresByTypeTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/ListStoresByTypeTest.java index 1503877..50d5604 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/ListStoresByTypeTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/ListStoresByTypeTest.java @@ -20,7 +20,7 @@ import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; import org.commonjava.indy.service.repository.ftests.matchers.StoreListingCheckMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.ArtifactStore; import org.commonjava.indy.service.repository.model.Group; import org.commonjava.indy.service.repository.model.HostedRepository; @@ -35,14 +35,14 @@ import java.util.Set; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; import static org.commonjava.indy.service.repository.model.StoreType.group; import static org.commonjava.indy.service.repository.model.StoreType.hosted; import static org.commonjava.indy.service.repository.model.StoreType.remote; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class ListStoresByTypeTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/ReadonlyHostedRepoDeleteTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/ReadonlyHostedRepoDeleteTest.java index 0aa5c49..58a17b6 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/ReadonlyHostedRepoDeleteTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/ReadonlyHostedRepoDeleteTest.java @@ -19,17 +19,17 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.HostedRepository; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.METHOD_NOT_ALLOWED; -import static javax.ws.rs.core.Response.Status.NOT_FOUND; -import static javax.ws.rs.core.Response.Status.NO_CONTENT; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.METHOD_NOT_ALLOWED; +import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; +import static jakarta.ws.rs.core.Response.Status.NO_CONTENT; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; /** @@ -48,7 +48,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class ReadonlyHostedRepoDeleteTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/RemoteRepoInValidUrlTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/RemoteRepoInValidUrlTest.java index f8096b7..fdd7f98 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/RemoteRepoInValidUrlTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/RemoteRepoInValidUrlTest.java @@ -18,19 +18,19 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.RemoteRepository; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) @Disabled( "Disabling validating decorator around StoreDataManager until we can be more certain it's correct and stable for all use cases" ) diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/RemoteRepoValidUrlTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/RemoteRepoValidUrlTest.java index 30abe38..5924daa 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/RemoteRepoValidUrlTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/RemoteRepoValidUrlTest.java @@ -19,19 +19,19 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.RemoteRepository; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.CREATED; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.CREATED; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class RemoteRepoValidUrlTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/AbstractStoreEventTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/AbstractStoreEventTest.java index a9e357f..1098ac7 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/AbstractStoreEventTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/AbstractStoreEventTest.java @@ -16,8 +16,8 @@ package org.commonjava.indy.service.repository.ftests.admin.event; import io.quarkus.test.common.QuarkusTestResource; -import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector; -import io.smallrye.reactive.messaging.providers.connectors.InMemorySink; +import io.smallrye.reactive.messaging.memory.InMemoryConnector; +import io.smallrye.reactive.messaging.memory.InMemorySink; import org.commonjava.event.store.IndyStoreEvent; import org.commonjava.indy.service.repository.change.event.kafka.KafkaEventUtils; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; @@ -25,8 +25,8 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import javax.enterprise.inject.Any; -import javax.inject.Inject; +import jakarta.enterprise.inject.Any; +import jakarta.inject.Inject; @QuarkusTestResource( KafkaTestResourceLifecycleManager.class ) public abstract class AbstractStoreEventTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateAndUpdateRepoWithEventTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateAndUpdateRepoWithEventTest.java index 28adabe..9e57407 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateAndUpdateRepoWithEventTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateAndUpdateRepoWithEventTest.java @@ -17,7 +17,7 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import io.smallrye.reactive.messaging.providers.connectors.InMemorySink; +import io.smallrye.reactive.messaging.memory.InMemorySink; import org.commonjava.event.store.EventStoreKey; import org.commonjava.event.store.IndyStoreEvent; import org.commonjava.event.store.StoreEventType; @@ -26,7 +26,7 @@ import org.commonjava.event.store.StoreUpdateType; import org.commonjava.indy.service.repository.change.event.kafka.KafkaEventUtils; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.Group; import org.commonjava.indy.service.repository.model.StoreKey; import org.eclipse.microprofile.reactive.messaging.Message; @@ -37,8 +37,8 @@ import java.util.Map; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.awaitility.Awaitility.await; import static org.commonjava.indy.service.repository.model.StoreKey.fromString; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; @@ -60,7 +60,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class CreateAndUpdateRepoWithEventTest extends AbstractStoreEventTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateRepoWithEventTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateRepoWithEventTest.java index 8312e93..aad5e9e 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateRepoWithEventTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateRepoWithEventTest.java @@ -17,7 +17,7 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import io.smallrye.reactive.messaging.providers.connectors.InMemorySink; +import io.smallrye.reactive.messaging.memory.InMemorySink; import org.commonjava.event.store.IndyStoreEvent; import org.commonjava.event.store.StoreEventType; import org.commonjava.event.store.StorePostUpdateEvent; @@ -25,7 +25,7 @@ import org.commonjava.event.store.StoreUpdateType; import org.commonjava.indy.service.repository.change.event.kafka.KafkaEventUtils; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.Group; import org.eclipse.microprofile.reactive.messaging.Message; import org.junit.jupiter.api.Tag; @@ -34,7 +34,7 @@ import java.util.List; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; import static org.awaitility.Awaitility.await; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; import static org.hamcrest.CoreMatchers.is; @@ -54,7 +54,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class CreateRepoWithEventTest extends AbstractStoreEventTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateThenDeleteRepoWithEventTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateThenDeleteRepoWithEventTest.java index 72d3a70..3c2636d 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateThenDeleteRepoWithEventTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/admin/event/CreateThenDeleteRepoWithEventTest.java @@ -17,14 +17,14 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import io.smallrye.reactive.messaging.providers.connectors.InMemorySink; +import io.smallrye.reactive.messaging.memory.InMemorySink; import org.commonjava.event.store.IndyStoreEvent; import org.commonjava.event.store.StoreEventType; import org.commonjava.event.store.StorePostDeleteEvent; import org.commonjava.event.store.StorePreDeleteEvent; import org.commonjava.indy.service.repository.change.event.kafka.KafkaEventUtils; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.Group; import org.eclipse.microprofile.reactive.messaging.Message; import org.junit.jupiter.api.Tag; @@ -34,7 +34,7 @@ import static io.restassured.RestAssured.delete; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; import static org.awaitility.Awaitility.await; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; import static org.hamcrest.CoreMatchers.is; @@ -54,7 +54,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class CreateThenDeleteRepoWithEventTest extends AbstractStoreEventTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/maint/ExportBundleTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/maint/ExportBundleTest.java index 9faae52..e36bc77 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/maint/ExportBundleTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/maint/ExportBundleTest.java @@ -17,17 +17,17 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.hamcrest.CoreMatchers; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION; +import static jakarta.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION; import static org.commonjava.indy.service.repository.jaxrs.RepositoryMaintenanceResources.MEDIATYPE_APPLICATION_ZIP; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class ExportBundleTest { diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/maint/ImportBundleTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/maint/ImportBundleTest.java index b337a13..055cf79 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/maint/ImportBundleTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/maint/ImportBundleTest.java @@ -19,7 +19,7 @@ import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.AbstractStoreManagementTest; import org.commonjava.indy.service.repository.ftests.matchers.RepoEqualMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.HostedRepository; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; @@ -28,14 +28,14 @@ import java.io.InputStream; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.jaxrs.RepositoryMaintenanceResources.MEDIATYPE_APPLICATION_ZIP; import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY; import static org.hamcrest.CoreMatchers.is; @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class ImportBundleTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/profile/ISPNFunctionProfile.java b/src/test/java/org/commonjava/indy/service/repository/ftests/profile/ISPNFunctionProfile.java deleted file mode 100644 index 606ec19..0000000 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/profile/ISPNFunctionProfile.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-repository-service) - * - * 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.commonjava.indy.service.repository.ftests.profile; - -import java.util.Collections; -import java.util.Map; - -public class ISPNFunctionProfile - extends BaseIndyTestProfile -{ - @Override - Map getExtraConfigOverrides() - { - return Collections.singletonMap( "repository.data-storage", "infinispan" ); - } - -} diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/profile/ISPNSSLFunctionProfile.java b/src/test/java/org/commonjava/indy/service/repository/ftests/profile/MemorySSLFunctionProfile.java similarity index 67% rename from src/test/java/org/commonjava/indy/service/repository/ftests/profile/ISPNSSLFunctionProfile.java rename to src/test/java/org/commonjava/indy/service/repository/ftests/profile/MemorySSLFunctionProfile.java index 167bf1d..716fa49 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/profile/ISPNSSLFunctionProfile.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/profile/MemorySSLFunctionProfile.java @@ -15,21 +15,34 @@ */ package org.commonjava.indy.service.repository.ftests.profile; +import org.commonjava.indy.service.repository.jaxrs.mock.MockAdminController; +import org.commonjava.indy.service.repository.jaxrs.mock.MockSecurityManager; +import org.commonjava.indy.service.repository.jaxrs.mock.MockStorageService; + import java.util.HashMap; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; -public class ISPNSSLFunctionProfile +public class MemorySSLFunctionProfile extends BaseIndyTestProfile { @Override public Map getExtraConfigOverrides() { Map configs = new HashMap<>(); - configs.put( "repository.data-storage", "infinispan" ); + configs.put( "repository.data-storage", "mem" ); configs.put( "repository.storeValidationEnabled", "true" ); configs.put( "repository.remote.sslRequired", "true" ); configs.put( "repository.remote.nosslHosts", "localhost,127.0.0.1" ); return configs; } + @Override + public Set> getEnabledAlternatives() + { + return Stream.of( MockStorageService.class ).collect( Collectors.toSet() ); + } + } \ No newline at end of file diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/AbstractQueryFuncTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/AbstractQueryFuncTest.java index 265b9bd..f28188c 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/AbstractQueryFuncTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/AbstractQueryFuncTest.java @@ -39,8 +39,8 @@ import java.util.stream.Stream; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.NO_CONTENT; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.NO_CONTENT; public abstract class AbstractQueryFuncTest extends AbstractStoreManagementTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllGroupsTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllGroupsTest.java index 17e1460..4bb09da 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllGroupsTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllGroupsTest.java @@ -17,13 +17,13 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.is; /** @@ -45,7 +45,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetAllGroupsTest extends AbstractQueryFuncTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllHostedsTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllHostedsTest.java index d400c71..1c28fa8 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllHostedsTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllHostedsTest.java @@ -17,13 +17,13 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.is; /** @@ -45,7 +45,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetAllHostedsTest extends AbstractQueryFuncTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllRemotesTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllRemotesTest.java index a282da2..db7f8ea 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllRemotesTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllRemotesTest.java @@ -17,13 +17,13 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.is; /** @@ -45,7 +45,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetAllRemotesTest extends AbstractQueryFuncTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllTest.java index ebb75e0..90cdbc5 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetAllTest.java @@ -17,13 +17,13 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.is; /** @@ -45,7 +45,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetAllTest extends AbstractQueryFuncTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetByDefaultPkgsTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetByDefaultPkgsTest.java index 639dfdb..9956ffa 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetByDefaultPkgsTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetByDefaultPkgsTest.java @@ -18,13 +18,13 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.matchers.StoreListingCheckMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.is; /** @@ -46,7 +46,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetByDefaultPkgsTest extends AbstractQueryFuncTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetByNameTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetByNameTest.java index 3236806..3ed2ce0 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetByNameTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetByNameTest.java @@ -17,16 +17,16 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.NOT_FOUND; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.is; /** @@ -48,7 +48,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetByNameTest extends AbstractQueryFuncTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetEnabledGroupsContainingTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetEnabledGroupsContainingTest.java index d0a78ad..dc4dc60 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetEnabledGroupsContainingTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetEnabledGroupsContainingTest.java @@ -17,14 +17,14 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.is; /** @@ -35,7 +35,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetEnabledGroupsContainingTest extends AbstractQueryFuncTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetGroupsAffectedByTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetGroupsAffectedByTest.java index 4ed607b..4867ad1 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetGroupsAffectedByTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetGroupsAffectedByTest.java @@ -18,16 +18,16 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.matchers.StoreListingCheckMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.ArtifactStore; import org.commonjava.indy.service.repository.model.StoreType; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.testutil.TestUtil.prepareCustomizedMapper; import static org.hamcrest.CoreMatchers.is; @@ -39,7 +39,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetGroupsAffectedByTest extends AbstractQueryFuncTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetOrderedConcreteEnabledStoresInGroupTest.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetOrderedConcreteEnabledStoresInGroupTest.java index 0babb26..f77fa0e 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetOrderedConcreteEnabledStoresInGroupTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetOrderedConcreteEnabledStoresInGroupTest.java @@ -18,16 +18,16 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; import org.commonjava.indy.service.repository.ftests.matchers.StoreListingCheckMatcher; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.model.ArtifactStore; import org.commonjava.indy.service.repository.model.StoreType; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.testutil.TestUtil.prepareCustomizedMapper; import static org.hamcrest.CoreMatchers.is; @@ -39,7 +39,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetOrderedConcreteEnabledStoresInGroupTest extends AbstractQueryFuncTest diff --git a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetOrderedEnabledStoresInGroup.java b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetOrderedEnabledStoresInGroup.java index 24ec59d..cb3267d 100644 --- a/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetOrderedEnabledStoresInGroup.java +++ b/src/test/java/org/commonjava/indy/service/repository/ftests/query/GetOrderedEnabledStoresInGroup.java @@ -17,14 +17,14 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import org.commonjava.indy.service.repository.ftests.profile.ISPNFunctionProfile; +import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.is; /** @@ -35,7 +35,7 @@ * */ @QuarkusTest -@TestProfile( ISPNFunctionProfile.class ) +@TestProfile( MemoryFunctionProfile.class ) @Tag( "function" ) public class GetOrderedEnabledStoresInGroup extends AbstractQueryFuncTest diff --git a/src/test/java/org/commonjava/indy/service/repository/jaxrs/MockTestProfile.java b/src/test/java/org/commonjava/indy/service/repository/jaxrs/MockTestProfile.java index 597e587..5094459 100644 --- a/src/test/java/org/commonjava/indy/service/repository/jaxrs/MockTestProfile.java +++ b/src/test/java/org/commonjava/indy/service/repository/jaxrs/MockTestProfile.java @@ -18,6 +18,7 @@ import org.commonjava.indy.service.repository.ftests.profile.MemoryFunctionProfile; import org.commonjava.indy.service.repository.jaxrs.mock.MockAdminController; import org.commonjava.indy.service.repository.jaxrs.mock.MockSecurityManager; +import org.commonjava.indy.service.repository.jaxrs.mock.MockStorageService; import java.util.Set; import java.util.stream.Collectors; @@ -29,7 +30,7 @@ public class MockTestProfile @Override public Set> getEnabledAlternatives() { - return Stream.of( MockAdminController.class, MockSecurityManager.class ).collect( Collectors.toSet() ); + return Stream.of( MockAdminController.class, MockSecurityManager.class, MockStorageService.class ).collect( Collectors.toSet() ); } } diff --git a/src/test/java/org/commonjava/indy/service/repository/jaxrs/RepositoryAdminResourcesTest.java b/src/test/java/org/commonjava/indy/service/repository/jaxrs/RepositoryAdminResourcesTest.java index 8accca1..b927c1e 100644 --- a/src/test/java/org/commonjava/indy/service/repository/jaxrs/RepositoryAdminResourcesTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/jaxrs/RepositoryAdminResourcesTest.java @@ -22,21 +22,21 @@ import io.restassured.parsing.Parser; import org.junit.jupiter.api.Test; -import javax.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MediaType; import java.util.HashMap; import java.util.Map; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.MediaType.APPLICATION_OCTET_STREAM; -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; -import static javax.ws.rs.core.Response.Status.CONFLICT; -import static javax.ws.rs.core.Response.Status.CREATED; -import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; -import static javax.ws.rs.core.Response.Status.NOT_FOUND; -import static javax.ws.rs.core.Response.Status.NOT_MODIFIED; -import static javax.ws.rs.core.Response.Status.NO_CONTENT; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.APPLICATION_OCTET_STREAM; +import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; +import static jakarta.ws.rs.core.Response.Status.CONFLICT; +import static jakarta.ws.rs.core.Response.Status.CREATED; +import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; +import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; +import static jakarta.ws.rs.core.Response.Status.NOT_MODIFIED; +import static jakarta.ws.rs.core.Response.Status.NO_CONTENT; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.is; import static org.commonjava.indy.service.repository.util.PathUtils.normalize; diff --git a/src/test/java/org/commonjava/indy/service/repository/jaxrs/RepositoryQueryResourcesTest.java b/src/test/java/org/commonjava/indy/service/repository/jaxrs/RepositoryQueryResourcesTest.java index cb1bac4..5e26ee0 100644 --- a/src/test/java/org/commonjava/indy/service/repository/jaxrs/RepositoryQueryResourcesTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/jaxrs/RepositoryQueryResourcesTest.java @@ -20,8 +20,8 @@ import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.commonjava.indy.service.repository.util.PathUtils.normalize; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.greaterThan; diff --git a/src/test/java/org/commonjava/indy/service/repository/jaxrs/ResponseHelperTest.java b/src/test/java/org/commonjava/indy/service/repository/jaxrs/ResponseHelperTest.java index 17ee670..27e0813 100644 --- a/src/test/java/org/commonjava/indy/service/repository/jaxrs/ResponseHelperTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/jaxrs/ResponseHelperTest.java @@ -18,19 +18,19 @@ import org.commonjava.indy.service.repository.exception.IndyWorkflowException; import org.junit.jupiter.api.Test; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.Response; import java.net.URI; import java.util.Collections; import java.util.Map; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.MediaType.APPLICATION_XML; -import static javax.ws.rs.core.MediaType.TEXT_PLAIN; -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; -import static javax.ws.rs.core.Response.Status.CREATED; -import static javax.ws.rs.core.Response.Status.MOVED_PERMANENTLY; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.APPLICATION_XML; +import static jakarta.ws.rs.core.MediaType.TEXT_PLAIN; +import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; +import static jakarta.ws.rs.core.Response.Status.CREATED; +import static jakarta.ws.rs.core.Response.Status.MOVED_PERMANENTLY; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/src/test/java/org/commonjava/indy/service/repository/jaxrs/StatsHandlerTest.java b/src/test/java/org/commonjava/indy/service/repository/jaxrs/StatsHandlerTest.java index 8301f92..3ee5ddd 100644 --- a/src/test/java/org/commonjava/indy/service/repository/jaxrs/StatsHandlerTest.java +++ b/src/test/java/org/commonjava/indy/service/repository/jaxrs/StatsHandlerTest.java @@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; -import static javax.ws.rs.core.Response.Status.OK; +import static jakarta.ws.rs.core.Response.Status.OK; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; diff --git a/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockAdminController.java b/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockAdminController.java index f18664b..4bea60b 100644 --- a/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockAdminController.java +++ b/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockAdminController.java @@ -26,9 +26,9 @@ import org.commonjava.indy.service.repository.model.StoreType; import org.junit.jupiter.api.Test; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Alternative; -import javax.ws.rs.core.Response; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Alternative; +import jakarta.ws.rs.core.Response; import java.util.Arrays; import java.util.Collections; import java.util.List; diff --git a/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockSecurityManager.java b/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockSecurityManager.java index b3a623b..9722fd9 100644 --- a/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockSecurityManager.java +++ b/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockSecurityManager.java @@ -18,8 +18,8 @@ import org.commonjava.indy.service.security.common.SecurityManager; import org.jboss.resteasy.spi.HttpRequest; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Alternative; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Alternative; @ApplicationScoped @Alternative diff --git a/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockStorageService.java b/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockStorageService.java index 39f2454..f8d71d3 100644 --- a/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockStorageService.java +++ b/src/test/java/org/commonjava/indy/service/repository/jaxrs/mock/MockStorageService.java @@ -16,18 +16,20 @@ package org.commonjava.indy.service.repository.jaxrs.mock; import io.quarkus.test.Mock; +import jakarta.enterprise.inject.Alternative; import org.commonjava.indy.model.core.BatchDeleteResult; import org.commonjava.indy.service.repository.client.storage.StorageService; import org.commonjava.indy.service.repository.jaxrs.ResponseHelper; import org.eclipse.microprofile.rest.client.inject.RestClient; -import javax.inject.Inject; -import javax.ws.rs.core.Response; +import jakarta.inject.Inject; +import jakarta.ws.rs.core.Response; import java.util.HashSet; import java.util.Set; @Mock @RestClient +@Alternative public class MockStorageService implements StorageService { @Inject ResponseHelper helper; diff --git a/src/test/java/org/commonjava/indy/service/repository/testutil/KafkaTestResourceLifecycleManager.java b/src/test/java/org/commonjava/indy/service/repository/testutil/KafkaTestResourceLifecycleManager.java index 224f5be..8e4765d 100644 --- a/src/test/java/org/commonjava/indy/service/repository/testutil/KafkaTestResourceLifecycleManager.java +++ b/src/test/java/org/commonjava/indy/service/repository/testutil/KafkaTestResourceLifecycleManager.java @@ -16,7 +16,7 @@ package org.commonjava.indy.service.repository.testutil; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; -import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector; +import io.smallrye.reactive.messaging.memory.InMemoryConnector; import java.util.Map;