Search in sources :

Example 11 with StoreDataManager

use of org.commonjava.indy.data.StoreDataManager 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 12 with StoreDataManager

use of org.commonjava.indy.data.StoreDataManager 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 13 with StoreDataManager

use of org.commonjava.indy.data.StoreDataManager 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 14 with StoreDataManager

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

the class ContentControllerTest method setup.

@Before
public void setup() throws Exception {
    contentMetadata.clear();
    fixture.initMissingComponents();
    final StoreDataManager storeManager = new MemoryStoreDataManager(true);
    final DownloadManager fileManager = new DefaultDownloadManager(storeManager, fixture.getTransferManager(), fixture.getLocationExpander());
    final DirectContentAccess dca = new DefaultDirectContentAccess(fileManager, Executors.newSingleThreadExecutor());
    final ContentManager contentManager = new DefaultContentManager(storeManager, fileManager, new IndyObjectMapper(true), new SpecialPathManagerImpl(), new MemoryNotFoundCache(), new DefaultContentDigester(dca, new CacheHandle<String, TransferMetadata>("content-metadata", contentMetadata)), Collections.<ContentGenerator>emptySet());
    final TemplatingEngine templates = new TemplatingEngine(new GStringTemplateEngine(), new DataFileManager(fixture.getTemp().newFolder("indy-home"), new DataFileEventManager()));
    content = new ContentController(storeManager, contentManager, templates, new IndyObjectMapper(true), new MimeTyper());
}
Also used : DefaultContentDigester(org.commonjava.indy.core.content.DefaultContentDigester) DataFileEventManager(org.commonjava.indy.subsys.datafile.change.DataFileEventManager) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) ContentManager(org.commonjava.indy.content.ContentManager) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) GStringTemplateEngine(groovy.text.GStringTemplateEngine) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) DownloadManager(org.commonjava.indy.content.DownloadManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) MimeTyper(org.commonjava.indy.util.MimeTyper) SpecialPathManagerImpl(org.commonjava.maven.galley.io.SpecialPathManagerImpl) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) DirectContentAccess(org.commonjava.indy.content.DirectContentAccess) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) CacheHandle(org.commonjava.indy.subsys.infinispan.CacheHandle) TemplatingEngine(org.commonjava.indy.subsys.template.TemplatingEngine) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) StoreDataManager(org.commonjava.indy.data.StoreDataManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) Before(org.junit.Before)

Aggregations

StoreDataManager (org.commonjava.indy.data.StoreDataManager)14 Test (org.junit.Test)12 Group (org.commonjava.indy.model.core.Group)8 StoreKey (org.commonjava.indy.model.core.StoreKey)6 RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)5 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)4 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)3 DirectContentAccess (org.commonjava.indy.content.DirectContentAccess)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 KojiClient (com.redhat.red.build.koji.KojiClient)1 GStringTemplateEngine (groovy.text.GStringTemplateEngine)1 ChangeSummary (org.commonjava.indy.audit.ChangeSummary)1 ContentDigester (org.commonjava.indy.content.ContentDigester)1 ContentManager (org.commonjava.indy.content.ContentManager)1 IndyLocationExpander (org.commonjava.indy.content.IndyLocationExpander)1