</bean>
<bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="java.util.Date"/>
<property name="diskExpiryThreadIntervalSeconds" value="600"/>
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache" lazy-init="true"
destroy-method="dispose">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="java.util.Date"/>
<property name="diskExpiryThreadIntervalSeconds" value="600"/>
<property name="diskPersistent" value="true"/>
<property name="diskStorePath" value="${appserver.base}/tmp/urlcache"/>
<context:property-placeholder system-properties-mode="OVERRIDE"/>
<bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="java.util.Date"/>
<property name="diskExpiryThreadIntervalSeconds" value="600"/>
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
@Inject
@Named(value = "cache#namespaces")
- private Cache<String, Collection<String>> namespacesCache;
+ private Cache<String, List<String>> namespacesCache;
@Inject
private IndexManagerFactory indexManagerFactory;
import org.apache.archiva.redback.configuration.UserConfiguration;
import org.apache.archiva.redback.configuration.UserConfigurationException;
import org.apache.archiva.redback.configuration.UserConfigurationKeys;
+import org.apache.archiva.redback.users.User;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
LDAP_MAPPER.addBooleanMapping( LDAP_BIND_AUTHENTICATOR_ENABLED, LdapConfiguration::isBindAuthenticatorEnabled );
}
- private Cache usersCache;
+ private Cache<String, User> usersCache;
@Inject
public DefaultRedbackRuntimeConfigurationAdmin( ArchivaConfiguration archivaConfiguration,//
@Named( value = "userConfiguration#redback" ) //
UserConfiguration userConfiguration,
- @Named( value = "cache#users" ) Cache usersCache )
+ @Named( value = "cache#users" ) Cache<String, User> usersCache )
{
this.archivaConfiguration = archivaConfiguration;
this.userConfiguration = userConfiguration;
<bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache" lazy-init="true"
destroy-method="dispose">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="java.util.Date"/>
<property name="diskExpiryThreadIntervalSeconds" value="600"/>
<property name="diskPersistent" value="false"/>
<property name="diskStorePath" value="${appserver.base}/tmp/urlcache"/>
* </li>
* </ul>
*
- * @author Martin Stockhammer <martin_s@apache.org>
+ * @author Martin Schreier <martin_s@apache.org>
* @since 3.0
*/
@Schema( name = "MavenManagedRepositoryService", description = "Managing and configuration of managed maven repositories" )
permissions = { OPERATION_MANAGE_CONFIGURATION, OPERATION_DELETE_NAMESPACE },
resource = "{id}"
)
- @Operation( summary = "Removes a group and all subfolders from the repository",
+ @Operation( summary = "Removes a maven group and all containing artifacts and sub groups from the repository",
security = {
@SecurityRequirement(
name = OPERATION_MANAGE_CONFIGURATION
import org.apache.archiva.redback.policy.PasswordRule;
import org.apache.archiva.redback.rbac.RBACManager;
import org.apache.archiva.redback.role.RoleManager;
+import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.RBACManagerImplementationInformation;
@Inject
@Named(value = "cache#users")
- private Cache usersCache;
+ private Cache<String, User> usersCache;
@Inject
private LdapUserMapper ldapUserMapper;
*/
@Inject
@Named(value = "cache#namespaces")
- private Cache<String, Collection<String>> namespacesCache;
+ private Cache<String, List<String>> namespacesCache;
private List<ChecksumAlgorithm> algorithms = Arrays.asList(ChecksumAlgorithm.SHA256, ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 );
<bean name="browse#versionMetadata" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String" />
+ <constructor-arg index="1" value="org.apache.archiva.metadata.model.ProjectVersionMetadata"/>
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<property name="memoryEvictionPolicy" value="LRU"/>
- <property name="name" value="userPermissions"/>
+ <property name="name" value="versionMetadata"/>
<property name="timeToIdleSeconds" value="300"/>
<property name="timeToLiveSeconds" value="600"/>
</bean>
* Native REST tests do not use the JAX-RS client and can be used with a remote
* REST API service. The tests
*
- * @author Martin Stockhammer <martin_s@apache.org>
+ * @author Martin Schreier <martin_s@apache.org>
*/
@Tag( "rest-native" )
@Tag( "rest-v2" )
+++ /dev/null
-package org.apache.archiva.rest.v2.svc;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import io.restassured.path.json.JsonPath;
-import io.restassured.response.Response;
-import org.apache.archiva.rest.api.v2.model.MavenManagedRepository;
-import org.apache.archiva.rest.api.v2.svc.RestConfiguration;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.MethodOrderer;
-import org.junit.jupiter.api.Order;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.api.TestMethodOrder;
-
-import java.util.List;
-
-import static io.restassured.RestAssured.given;
-import static io.restassured.http.ContentType.JSON;
-import static org.junit.jupiter.api.Assertions.*;
-
-/**
- * @author Martin Stockhammer <martin_s@apache.org>
- */
-@TestInstance( TestInstance.Lifecycle.PER_CLASS )
-@Tag( "rest-native" )
-@TestMethodOrder( MethodOrderer.OrderAnnotation.class )
-@DisplayName( "Native REST tests for V2 ManagedRepositoryService" )
-public class NativeMavenManagedRepositoryServiceTest extends AbstractNativeRestServices
-{
- @Override
- protected String getServicePath( )
- {
- return "/repositories/maven/managed";
- }
-
- @BeforeAll
- void setup( ) throws Exception
- {
- super.setupNative( );
- }
-
- @AfterAll
- void destroy( ) throws Exception
- {
- super.shutdownNative( );
- }
-
- @Test
- @Order( 1 )
- void testGetRepositories( )
- {
- String token = getAdminToken( );
- Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON )
- .when( )
- .get( "" )
- .then( ).statusCode( 200 ).extract( ).response( );
- JsonPath json = response.getBody( ).jsonPath( );
- assertEquals( 2, json.getInt( "pagination.total_count" ) );
- assertEquals( 0, json.getInt( "pagination.offset" ) );
- assertEquals( Integer.valueOf( RestConfiguration.DEFAULT_PAGE_LIMIT ), json.getInt( "pagination.limit" ) );
- List<MavenManagedRepository> repositories = json.getList( "data", MavenManagedRepository.class );
- assertEquals( "internal", repositories.get( 0 ).getId( ) );
- assertEquals( "snapshots", repositories.get( 1 ).getId( ) );
- }
-
-
-
-}
--- /dev/null
+package org.apache.archiva.rest.v2.svc.maven;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import io.restassured.path.json.JsonPath;
+import io.restassured.response.Response;
+import org.apache.archiva.rest.api.v2.model.MavenManagedRepository;
+import org.apache.archiva.rest.api.v2.svc.RestConfiguration;
+import org.apache.archiva.rest.v2.svc.AbstractNativeRestServices;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.TestMethodOrder;
+
+import java.util.List;
+
+import static io.restassured.RestAssured.given;
+import static io.restassured.http.ContentType.JSON;
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+@TestInstance( TestInstance.Lifecycle.PER_CLASS )
+@Tag( "rest-native" )
+@TestMethodOrder( MethodOrderer.OrderAnnotation.class )
+@DisplayName( "Native REST tests for V2 ManagedRepositoryService" )
+public class NativeMavenManagedRepositoryServiceTest extends AbstractNativeRestServices
+{
+ @Override
+ protected String getServicePath( )
+ {
+ return "/repositories/maven/managed";
+ }
+
+ @BeforeAll
+ void setup( ) throws Exception
+ {
+ super.setupNative( );
+ }
+
+ @AfterAll
+ void destroy( ) throws Exception
+ {
+ super.shutdownNative( );
+ }
+
+ @Test
+ @Order( 1 )
+ void testGetRepositories( )
+ {
+ String token = getAdminToken( );
+ Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON )
+ .when( )
+ .get( "" )
+ .then( ).statusCode( 200 ).extract( ).response( );
+ JsonPath json = response.getBody( ).jsonPath( );
+ assertEquals( 2, json.getInt( "pagination.total_count" ) );
+ assertEquals( 0, json.getInt( "pagination.offset" ) );
+ assertEquals( Integer.valueOf( RestConfiguration.DEFAULT_PAGE_LIMIT ), json.getInt( "pagination.limit" ) );
+ List<MavenManagedRepository> repositories = json.getList( "data", MavenManagedRepository.class );
+ assertEquals( "internal", repositories.get( 0 ).getId( ) );
+ assertEquals( "snapshots", repositories.get( 1 ).getId( ) );
+ }
+
+
+
+}
<!-- for change configuration of the users cache -->
<bean name="cache#users" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String" />
+ <constructor-arg index="1" value="org.apache.archiva.redback.users.User" />
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache" lazy-init="true"
destroy-method="dispose">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="java.util.Date"/>
<property name="diskExpiryThreadIntervalSeconds" value="600"/>
<property name="diskPersistent" value="true"/>
<property name="diskStorePath" value="${appserver.base}/tmp/urlcache"/>
<bean name="cache#keys" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String" />
+ <constructor-arg index="1" value="org.apache.archiva.redback.keys.AuthenticationKey"/>
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<bean name="cache#operations" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="org.apache.archiva.redback.rbac.Operation" />
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<bean name="cache#permissions" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="org.apache.archiva.redback.rbac.Permission" />
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<bean name="cache#resources" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="org.apache.archiva.redback.rbac.Resource" />
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<bean name="cache#roles" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="org.apache.archiva.redback.rbac.Role" />
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<bean name="cache#effectiveRoleSet" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="java.util.HashSet" />
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<bean name="cache#userAssignments" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="org.apache.archiva.redback.rbac.UserAssignment" />
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<bean name="cache#userPermissions" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="java.util.HashMap" />
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<bean name="cache#ldapRoles" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="org.apache.archiva.redback.rbac.Role"/>
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<bean name="cache#namespaces" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String" />
+ <constructor-arg index="1" value="java.util.ArrayList"/>
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
*/
import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@XmlRootElement( name = "projectVersionMetadata" )
public class ProjectVersionMetadata
- extends FacetedMetadata
+ extends FacetedMetadata implements Serializable
{
+
+ private static final long serialVersionUID = 5506968284780639002L;
/**
* id is the version
*/
*/
@Inject
@Named( value = "cache#namespaces" )
- private Cache<String, Collection<String>> namespacesCache;
+ private Cache<String, List<String>> namespacesCache;
@Override
public ProjectVersionMetadata resolveProjectVersion( RepositorySession session, String repoId, String namespace,
try
{
- Collection<String> namespaces = namespacesCache.get( repoId );
+ List<String> namespaces = namespacesCache.get( repoId );
if ( namespaces != null )
{
return namespaces;
{
MetadataRepository metadataRepository = session.getRepository();
String cacheKey = repoId + "-" + namespace;
- Collection<String> namespaces = namespacesCache.get( cacheKey );
+ List<String> namespaces = namespacesCache.get( cacheKey );
if ( namespaces == null )
{
namespaces = metadataRepository.getChildNamespaces( session, repoId, namespace );
Collection<String> exclusions = new ArrayList<>( projects );
String cacheKey = repoId + "-" + namespace;
- Collection<String> namespaces = namespacesCache.get( cacheKey );
+ List<String> namespaces = namespacesCache.get( cacheKey );
if ( namespaces == null )
{
namespaces = metadataRepository.getChildNamespaces( session, repoId, namespace );
<bean name="cache#namespaces" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
init-method="initialize">
+ <constructor-arg index="0" value="java.lang.String" />
+ <constructor-arg index="1" value="java.util.ArrayList"/>
<property name="diskPersistent" value="false"/>
<property name="eternal" value="false"/>
<property name="maxElementsInMemory" value="1000"/>
<property name="memoryEvictionPolicy" value="LRU"/>
- <property name="name" value="usersCache"/>
+ <property name="name" value="namespaces"/>
<property name="timeToIdleSeconds" value="600"/>
<property name="timeToLiveSeconds" value="600"/>
</bean>