Search in sources :

Example 1 with StoreDataManager

use of org.commonjava.indy.data.StoreDataManager in project indy by Commonjava.

the class RepositoryDataManagerTCK method createTwoReposAndRetrieveAll.

@Test
public void createTwoReposAndRetrieveAll() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final RemoteRepository repo = new RemoteRepository("central", "http://repo1.maven.apache.org/maven2/");
    storeRemoteRepository(repo);
    final RemoteRepository repo2 = new RemoteRepository("test", "http://www.google.com");
    storeRemoteRepository(repo2);
    final List<RemoteRepository> repositories = manager.query().getAllRemoteRepositories(MAVEN_PKG_KEY);
    assertThat(repositories, notNullValue());
    assertThat(repositories.size(), equalTo(2));
    Collections.sort(repositories, new Comparator<RemoteRepository>() {

        @Override
        public int compare(final RemoteRepository r1, final RemoteRepository r2) {
            return r1.getName().compareTo(r2.getName());
        }
    });
    ArtifactStore r = repositories.get(0);
    assertThat(r.getName(), equalTo(repo.getName()));
    r = repositories.get(1);
    assertThat(r.getName(), equalTo(repo2.getName()));
}
Also used : ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) StoreDataManager(org.commonjava.indy.data.StoreDataManager) Test(org.junit.Test)

Example 2 with StoreDataManager

use of org.commonjava.indy.data.StoreDataManager in project indy by Commonjava.

the class GroupDataManagerTCK method createSameGroupTwiceAndRetrieveOne.

@Test
public void createSameGroupTwiceAndRetrieveOne() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final Group grp = new Group("test");
    store(grp, grp);
    final List<Group> result = manager.query().getAllGroups(MAVEN_PKG_KEY);
    assertThat(result, notNullValue());
    assertThat(result.size(), equalTo(1));
}
Also used : Group(org.commonjava.indy.model.core.Group) StoreDataManager(org.commonjava.indy.data.StoreDataManager) Test(org.junit.Test)

Example 3 with StoreDataManager

use of org.commonjava.indy.data.StoreDataManager in project indy by Commonjava.

the class GroupDataManagerTCK method createTwoGroupsAndAffectedByForOneLevel.

@Test
public void createTwoGroupsAndAffectedByForOneLevel() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final StoreKey central = new StoreKey(remote, "central");
    final StoreKey repo2 = new StoreKey(remote, "repo2");
    Group g1 = new Group("g1", central);
    Group g2 = new Group("g2", repo2);
    store(g1, g2);
    List<StoreKey> keys = asList(central, repo2);
    Set<StoreKey> gKeys = manager.query().getGroupsAffectedBy(keys).stream().map(Group::getKey).collect(Collectors.toSet());
    assertThat(gKeys.contains(g1.getKey()), equalTo(Boolean.TRUE));
    assertThat(gKeys.contains(g2.getKey()), equalTo(Boolean.TRUE));
}
Also used : Group(org.commonjava.indy.model.core.Group) StoreDataManager(org.commonjava.indy.data.StoreDataManager) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 4 with StoreDataManager

use of org.commonjava.indy.data.StoreDataManager in project indy by Commonjava.

the class GroupDataManagerTCK method createTwoGroupsAndRetrieveBoth.

@Test
public void createTwoGroupsAndRetrieveBoth() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final Group grp = new Group("test");
    final Group grp2 = new Group("test2");
    store(grp, grp2);
    final List<Group> result = manager.query().getAllGroups(MAVEN_PKG_KEY);
    assertThat(result, notNullValue());
    assertThat(result.size(), equalTo(2));
    Collections.sort(result, new Comparator<Group>() {

        @Override
        public int compare(final Group g1, final Group g2) {
            return g1.getName().compareTo(g2.getName());
        }
    });
    Group g = result.get(0);
    assertThat(g.getName(), equalTo(grp.getName()));
    g = result.get(1);
    assertThat(g.getName(), equalTo(grp2.getName()));
}
Also used : Group(org.commonjava.indy.model.core.Group) StoreDataManager(org.commonjava.indy.data.StoreDataManager) Test(org.junit.Test)

Example 5 with StoreDataManager

use of org.commonjava.indy.data.StoreDataManager in project indy by Commonjava.

the class RepositoryDataManagerTCK method createAndDeleteCentralRepoProxy.

@Test
public void createAndDeleteCentralRepoProxy() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final RemoteRepository repo = new RemoteRepository("central", "http://repo1.maven.apache.org/maven2/");
    storeRemoteRepository(repo, false);
    manager.deleteArtifactStore(repo.getKey(), summary, new EventMetadata());
    final ArtifactStore result = manager.query().getRemoteRepository(MAVEN_PKG_KEY, repo.getName());
    assertThat(result, nullValue());
}
Also used : ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) StoreDataManager(org.commonjava.indy.data.StoreDataManager) EventMetadata(org.commonjava.maven.galley.event.EventMetadata) Test(org.junit.Test)

Aggregations

StoreDataManager (org.commonjava.indy.data.StoreDataManager)16 Test (org.junit.Test)13 Group (org.commonjava.indy.model.core.Group)10 StoreKey (org.commonjava.indy.model.core.StoreKey)8 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)5 RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)5 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)4 WeftExecutorService (org.commonjava.cdi.util.weft.WeftExecutorService)3 DirectContentAccess (org.commonjava.indy.content.DirectContentAccess)3 KojiClient (com.redhat.red.build.koji.KojiClient)2 PoolWeftExecutorService (org.commonjava.cdi.util.weft.PoolWeftExecutorService)2 DownloadManager (org.commonjava.indy.content.DownloadManager)2 DefaultContentDigester (org.commonjava.indy.core.content.DefaultContentDigester)2 DefaultDirectContentAccess (org.commonjava.indy.core.content.DefaultDirectContentAccess)2 DefaultDownloadManager (org.commonjava.indy.core.content.DefaultDownloadManager)2 MemoryStoreDataManager (org.commonjava.indy.mem.data.MemoryStoreDataManager)2 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)2 CacheHandle (org.commonjava.indy.subsys.infinispan.CacheHandle)2 KojiClientException (com.redhat.red.build.koji.KojiClientException)1 KojiArchiveInfo (com.redhat.red.build.koji.model.xmlrpc.KojiArchiveInfo)1