Search in sources :

Example 21 with PathInfo

use of org.commonjava.indy.client.core.helper.PathInfo in project indy by Commonjava.

the class AbstractContentTimeoutWorkingTest method setupRepo.

@Before
public void setupRepo() throws Exception {
    final String repoId = "test-repo";
    final String pomPath = "org/foo/bar/1.0/bar-1.0.pom";
    final String pomUrl = server.formatUrl(repoId, pomPath);
    // mocking up a http server that expects access to a .pom
    final String datetime = (new Date()).toString();
    server.expect(pomUrl, 200, String.format("pom %s", datetime));
    // set up remote repository pointing to the test http server, and timeout little later
    final String changelog = "Timeout Testing: " + name.getMethodName();
    final RemoteRepository repository = createRemoteRepository(repoId);
    client.stores().create(repository, changelog, RemoteRepository.class);
    // ensure the pom exist before the timeout checking
    final PathInfo result = client.content().getInfo(remote, repoId, pomPath);
    assertThat("no result", result, notNullValue());
    assertThat("doesn't exist", result.exists(), equalTo(true));
    // force storage
    client.content().get(remote, repoId, pomPath).close();
    pomFile = Paths.get(fixture.getBootOptions().getIndyHome(), "var/lib/indy/storage", MAVEN_PKG_KEY, remote.singularEndpointName() + "-" + repoId, pomPath).toFile();
    assertThat("pom doesn't exist: " + pomFile, this.pomFile.exists(), equalTo(true));
}
Also used : RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) PathInfo(org.commonjava.indy.client.core.helper.PathInfo) Date(java.util.Date) Before(org.junit.Before)

Aggregations

PathInfo (org.commonjava.indy.client.core.helper.PathInfo)21 Test (org.junit.Test)19 AbstractContentManagementTest (org.commonjava.indy.ftest.core.AbstractContentManagementTest)17 RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)16 ByteArrayInputStream (java.io.ByteArrayInputStream)12 InputStream (java.io.InputStream)12 File (java.io.File)10 Category (org.junit.experimental.categories.Category)8 Date (java.util.Date)7 Group (org.commonjava.indy.model.core.Group)4 HostedRepository (org.commonjava.indy.model.core.HostedRepository)4 CountDownLatch (java.util.concurrent.CountDownLatch)2 DelayedDownload (org.commonjava.indy.ftest.core.fixture.DelayedDownload)2 InputTimer (org.commonjava.indy.ftest.core.fixture.InputTimer)2 ReluctantInputStream (org.commonjava.indy.ftest.core.fixture.ReluctantInputStream)2 StoreKey (org.commonjava.indy.model.core.StoreKey)2 Before (org.junit.Before)2 HttpResponse (org.apache.http.HttpResponse)1 IndyClientException (org.commonjava.indy.client.core.IndyClientException)1 HttpResources (org.commonjava.indy.client.core.helper.HttpResources)1