1 package org.apache.archiva.repository;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.admin.model.beans.ManagedRepository;
23 import org.apache.archiva.admin.model.beans.RemoteRepository;
24 import org.apache.archiva.repository.ManagedRepositoryContent;
25 import org.apache.archiva.repository.RemoteRepositoryContent;
26 import org.junit.Rule;
27 import org.junit.rules.TestName;
28 import org.junit.runner.RunWith;
29 import org.springframework.context.ApplicationContext;
30 import org.springframework.test.context.ContextConfiguration;
31 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
34 import javax.inject.Inject;
37 * AbstractRepositoryLayerTestCase
41 @RunWith( SpringJUnit4ClassRunner.class )
42 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
43 public abstract class AbstractRepositoryLayerTestCase
46 public TestName name = new TestName();
49 protected ApplicationContext applicationContext;
51 protected ManagedRepository createRepository( String id, String name, File location )
53 ManagedRepository repo = new ManagedRepository();
56 repo.setLocation( location.getAbsolutePath() );
60 protected RemoteRepository createRemoteRepository( String id, String name, String url )
62 RemoteRepository repo = new RemoteRepository();
69 protected ManagedRepositoryContent createManagedRepositoryContent( String id, String name, File location,
73 ManagedRepository repo = new ManagedRepository();
76 repo.setLocation( location.getAbsolutePath() );
77 repo.setLayout( layout );
79 ManagedRepositoryContent repoContent =
80 applicationContext.getBean( "managedRepositoryContent#" + layout, ManagedRepositoryContent.class );
81 repoContent.setRepository( repo );
86 protected RemoteRepositoryContent createRemoteRepositoryContent( String id, String name, String url, String layout )
89 RemoteRepository repo = new RemoteRepository();
93 repo.setLayout( layout );
95 RemoteRepositoryContent repoContent =
96 applicationContext.getBean( "remoteRepositoryContent#" + layout, RemoteRepositoryContent.class );
97 repoContent.setRepository( repo );