Search in sources :

Example 91 with StoreKey

use of org.commonjava.indy.model.core.StoreKey in project indy by Commonjava.

the class GroupDataManagerTCK method createAndRetrieveGroupWithTwoConstituents.

@Test
public void createAndRetrieveGroupWithTwoConstituents() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final Group grp = new Group("test", new StoreKey(StoreType.remote, "central"), new StoreKey(StoreType.remote, "repo2"));
    store(grp);
    final Group result = manager.query().packageType(MAVEN_PKG_KEY).storeType(Group.class).getByName(grp.getName());
    assertThat(result, notNullValue());
    assertThat(result.getName(), equalTo(grp.getName()));
    final List<StoreKey> repos = result.getConstituents();
    assertThat(repos, notNullValue());
    assertThat(repos.size(), equalTo(2));
    assertThat(repos.get(0), equalTo(new StoreKey(StoreType.remote, "central")));
    assertThat(repos.get(1), equalTo(new StoreKey(StoreType.remote, "repo2")));
}
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 92 with StoreKey

use of org.commonjava.indy.model.core.StoreKey in project indy by Commonjava.

the class GroupDataManagerTCK method createGroupAndRetrieveRepositoryConstituents.

@Test
public void createGroupAndRetrieveRepositoryConstituents() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final Group grp = new Group("test", new StoreKey(StoreType.remote, "central"), new StoreKey(StoreType.remote, "repo2"));
    store(grp);
    final List<ArtifactStore> result = manager.query().packageType(MAVEN_PKG_KEY).getOrderedConcreteStoresInGroup(grp.getName());
    assertThat(result, notNullValue());
    assertThat(result.size(), equalTo(2));
    ArtifactStore repo = result.get(0);
    assertThat(repo, notNullValue());
    assertThat(repo.getName(), equalTo("central"));
    repo = result.get(1);
    assertThat(repo, notNullValue());
    assertThat(repo.getName(), equalTo("repo2"));
}
Also used : Group(org.commonjava.indy.model.core.Group) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) StoreDataManager(org.commonjava.indy.data.StoreDataManager) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 93 with StoreKey

use of org.commonjava.indy.model.core.StoreKey in project indy by Commonjava.

the class GroupDataManagerTCK method createTwoGroupsAndAffectedByForTwoLevel.

@Test
public void createTwoGroupsAndAffectedByForTwoLevel() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final StoreKey central = new StoreKey(StoreType.remote, "central");
    Group g1 = new Group("g1", central);
    Group g2 = new Group("g2", g1.getKey());
    store(g1, g2);
    List<StoreKey> keys = Collections.singletonList(central);
    Set<StoreKey> gKeys = manager.query().getGroupsAffectedBy(keys).stream().map(Group::getKey).collect(Collectors.toSet());
    assertThat(gKeys.contains(g1.getKey()), equalTo(Boolean.TRUE));
    //FIXME: should this group:g2 be in result?
    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 94 with StoreKey

use of org.commonjava.indy.model.core.StoreKey in project indy by Commonjava.

the class GroupDataManagerTCK method createGroupAndRetrieveReposForThatGroupInOrder.

@Test
public void createGroupAndRetrieveReposForThatGroupInOrder() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final Group grp = new Group("test", new StoreKey(StoreType.remote, "repo2"), new StoreKey(StoreType.remote, "central"));
    store(grp);
    final List<ArtifactStore> repos = manager.query().packageType(MAVEN_PKG_KEY).getOrderedConcreteStoresInGroup(grp.getName());
    assertThat(repos, notNullValue());
    assertThat(repos.size(), equalTo(2));
    assertThat(repos.get(0).getName(), equalTo("repo2"));
    assertThat(repos.get(1).getName(), equalTo("central"));
}
Also used : Group(org.commonjava.indy.model.core.Group) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) StoreDataManager(org.commonjava.indy.data.StoreDataManager) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 95 with StoreKey

use of org.commonjava.indy.model.core.StoreKey in project indy by Commonjava.

the class StoreKeyTest method parseWithValidPackageType.

@Test
public void parseWithValidPackageType() {
    StoreKey key = StoreKey.fromString("maven:remote:central");
    assertThat(key.getPackageType(), equalTo(MAVEN_PKG_KEY));
    assertThat(key.getType(), equalTo(remote));
    assertThat(key.getName(), equalTo("central"));
    key = StoreKey.fromString("generic-http:remote:httprox_stuff");
    assertThat(key.getPackageType(), equalTo(GENERIC_PKG_KEY));
    assertThat(key.getType(), equalTo(remote));
    assertThat(key.getName(), equalTo("httprox_stuff"));
}
Also used : StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Aggregations

StoreKey (org.commonjava.indy.model.core.StoreKey)186 Test (org.junit.Test)92 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)40 StoreType (org.commonjava.indy.model.core.StoreType)39 InputStream (java.io.InputStream)33 IndyWorkflowException (org.commonjava.indy.IndyWorkflowException)32 RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)31 IndyDataException (org.commonjava.indy.data.IndyDataException)30 Group (org.commonjava.indy.model.core.Group)29 Transfer (org.commonjava.maven.galley.model.Transfer)27 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)24 Response (javax.ws.rs.core.Response)23 IOException (java.io.IOException)22 Logger (org.slf4j.Logger)21 ApiOperation (io.swagger.annotations.ApiOperation)20 ResponseUtils.formatResponse (org.commonjava.indy.bind.jaxrs.util.ResponseUtils.formatResponse)20 ArrayList (java.util.ArrayList)19 Path (javax.ws.rs.Path)19 ApiResponse (io.swagger.annotations.ApiResponse)18 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)18