Search in sources :

Example 71 with RemoteRepository

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

the class PomDownloadViaGroupListenerTest method run.

@Test
public void run() throws Exception {
    final String repo1 = "repo1";
    final String group1 = "group1";
    server.expect(server.formatUrl(repo1, path), 200, content);
    RemoteRepository remote1 = new RemoteRepository(repo1, server.formatUrl(repo1));
    client.stores().create(remote1, "adding remote", RemoteRepository.class);
    client.stores().create(new Group(group1, remote1.getKey()), "adding group", Group.class);
    InputStream is = client.content().get(group, group1, path);
    String s = IOUtils.toString(is);
    assertThat(s, equalTo(content));
    waitForEventPropagation();
    // Check .rel exist on group1
    boolean exists = client.content().exists(group, group1, pathRel, true);
    assertThat(exists, equalTo(true));
    // Check .rel exist on remote1
    exists = client.content().exists(remote, repo1, pathRel, true);
    assertThat(exists, equalTo(true));
    // Check .rel content is not empty
    InputStream ris = client.content().get(group, group1, pathRel);
    String rel = IOUtils.toString(ris);
    logger.debug(">>> " + rel);
    assertThat(StringUtils.isNotEmpty(rel), equalTo(true));
}
Also used : Group(org.commonjava.indy.model.core.Group) InputStream(java.io.InputStream) RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) AbstractIndyFunctionalTest(org.commonjava.indy.ftest.core.AbstractIndyFunctionalTest) Test(org.junit.Test)

Example 72 with RemoteRepository

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

the class RelDownloadBeforePomTest method run.

@Test
public void run() throws Exception {
    final String repo1 = "repo1";
    server.expect(server.formatUrl(repo1, path), 200, content);
    RemoteRepository remote1 = new RemoteRepository(repo1, server.formatUrl(repo1));
    client.stores().create(remote1, "adding remote", RemoteRepository.class);
    // Download .rel before even touching POM
    InputStream rel = client.content().get(remote, repo1, pathRel);
    assertThat(rel, notNullValue());
    String s = IOUtils.toString(rel);
    logger.debug(">>> " + s);
    assertThat(StringUtils.isNotEmpty(s), equalTo(true));
    // check POM is downloaded
    boolean exists = client.content().exists(remote, repo1, path, true);
    assertThat(exists, equalTo(true));
}
Also used : InputStream(java.io.InputStream) RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) AbstractIndyFunctionalTest(org.commonjava.indy.ftest.core.AbstractIndyFunctionalTest) Test(org.junit.Test)

Example 73 with RemoteRepository

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

the class RepositoryDataManagerTCK method createAndRetrieveCentralRepoProxy.

@Test
public void createAndRetrieveCentralRepoProxy() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final RemoteRepository repo = new RemoteRepository("central", "http://repo1.maven.apache.org/maven2/");
    storeRemoteRepository(repo, false);
    final RemoteRepository result = manager.query().storeType(RemoteRepository.class).getByName(repo.getName());
    assertThat(result.getName(), equalTo(repo.getName()));
    assertThat(result.getUrl(), equalTo(repo.getUrl()));
    assertThat(result.getUser(), nullValue());
    assertThat(result.getPassword(), nullValue());
}
Also used : RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) StoreDataManager(org.commonjava.indy.data.StoreDataManager) Test(org.junit.Test)

Example 74 with RemoteRepository

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

the class RepositoryDataManagerTCK method createCentralRepoProxyTwiceAndRetrieveOne.

@Test
public void createCentralRepoProxyTwiceAndRetrieveOne() throws Exception {
    final StoreDataManager manager = getFixtureProvider().getDataManager();
    final RemoteRepository repo = new RemoteRepository("central", "http://repo1.maven.apache.org/maven2/");
    storeRemoteRepository(repo, true);
    List<RemoteRepository> result = manager.query().packageType(MAVEN_PKG_KEY).storeType(RemoteRepository.class).getAll();
    assertThat(result, notNullValue());
    assertThat(result.size(), equalTo(1));
    storeRemoteRepository(repo, true);
    result = manager.query().packageType(MAVEN_PKG_KEY).storeType(RemoteRepository.class).getAll();
    assertThat(result, notNullValue());
    assertThat(result.size(), equalTo(1));
}
Also used : RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) StoreDataManager(org.commonjava.indy.data.StoreDataManager) Test(org.junit.Test)

Example 75 with RemoteRepository

use of org.commonjava.indy.model.core.RemoteRepository 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().packageType(MAVEN_PKG_KEY).storeType(RemoteRepository.class).getByName(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

RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)149 Test (org.junit.Test)99 InputStream (java.io.InputStream)52 Group (org.commonjava.indy.model.core.Group)48 AbstractContentManagementTest (org.commonjava.indy.ftest.core.AbstractContentManagementTest)32 StoreKey (org.commonjava.indy.model.core.StoreKey)31 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)27 ByteArrayInputStream (java.io.ByteArrayInputStream)22 File (java.io.File)17 ChangeSummary (org.commonjava.indy.audit.ChangeSummary)17 HostedRepository (org.commonjava.indy.model.core.HostedRepository)17 PathInfo (org.commonjava.indy.client.core.helper.PathInfo)16 IndyDataException (org.commonjava.indy.data.IndyDataException)14 Before (org.junit.Before)13 Category (org.junit.experimental.categories.Category)12 Date (java.util.Date)10 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)10 ConcreteResource (org.commonjava.maven.galley.model.ConcreteResource)10 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)9 HttpGet (org.apache.http.client.methods.HttpGet)9