Search in sources :

Example 36 with PathsPromoteRequest

use of org.commonjava.indy.promote.model.PathsPromoteRequest in project indy by Commonjava.

the class PromoteRemoteReDownloadTest method run.

@Test
public void run() throws Exception {
    PathsPromoteResult result = client.module(IndyPromoteClientModule.class).promoteByPath(new PathsPromoteRequest(source.getKey(), target.getKey(), PATH));
    Set<String> pending = result.getPendingPaths();
    assertThat(pending == null || pending.isEmpty(), equalTo(true));
    Set<String> completed = result.getCompletedPaths();
    assertThat(completed, notNullValue());
    assertThat(completed.size(), equalTo(1));
    assertThat(result.getError(), nullValue());
}
Also used : PathsPromoteResult(org.commonjava.indy.promote.model.PathsPromoteResult) PathsPromoteRequest(org.commonjava.indy.promote.model.PathsPromoteRequest) IndyPromoteClientModule(org.commonjava.indy.promote.client.IndyPromoteClientModule) AbstractIndyFunctionalTest(org.commonjava.indy.ftest.core.AbstractIndyFunctionalTest) Test(org.junit.Test)

Example 37 with PathsPromoteRequest

use of org.commonjava.indy.promote.model.PathsPromoteRequest in project indy by Commonjava.

the class HostedMetadataRemergedOnPathPromoteSnapshotTest method run.

@Test
@Category(EventDependent.class)
public void run() throws Exception {
    // verify our initial state
    assertMetadataContent(a, PATH, aPreContent);
    PathsPromoteRequest request = new PathsPromoteRequest(b.getKey(), a.getKey(), new String[] { PATH, bPomPath });
    // Pre-existing maven-metadata.xml should NOT cause a failure!
    request.setFailWhenExists(true);
    PathsPromoteResult response = promote.promoteByPath(request);
    assertThat(response.succeeded(), equalTo(true));
    waitForEventPropagation();
    // Group G's metadata path P should reflect values in A and B
    assertMetadataContent(g, PATH, AFTER_PROMOTE_CONTENT);
    // Promotion to repo A should trigger re-merge of maven-metadata.xml, adding the version from repo B to that in A.
    assertMetadataContent(a, PATH, AFTER_PROMOTE_CONTENT);
}
Also used : PathsPromoteResult(org.commonjava.indy.promote.model.PathsPromoteResult) PathsPromoteRequest(org.commonjava.indy.promote.model.PathsPromoteRequest) Category(org.junit.experimental.categories.Category) Test(org.junit.Test) AbstractContentManagementTest(org.commonjava.indy.ftest.core.AbstractContentManagementTest)

Example 38 with PathsPromoteRequest

use of org.commonjava.indy.promote.model.PathsPromoteRequest in project indy by Commonjava.

the class HostedMetadataRemergedOnPathPromoteToReadonlyHostedTest method run.

@Test
@Category(EventDependent.class)
public void run() throws Exception {
    // verify our initial state
    assertMetadataContent(a, PATH, aPreContent);
    PathsPromoteRequest request = new PathsPromoteRequest(b.getKey(), a.getKey(), bPomPath);
    // Pre-existing maven-metadata.xml should NOT cause a failure!
    request.setFailWhenExists(true);
    PathsPromoteResult response = promote.promoteByPath(request);
    assertThat(response.succeeded(), equalTo(true));
    waitForEventPropagation();
    // Promotion to repo A should trigger re-merge of maven-metadata.xml, adding the version from repo B to that in A.
    assertMetadataContent(a, PATH, AFTER_PROMOTE_CONTENT);
}
Also used : PathsPromoteResult(org.commonjava.indy.promote.model.PathsPromoteResult) PathsPromoteRequest(org.commonjava.indy.promote.model.PathsPromoteRequest) Category(org.junit.experimental.categories.Category) Test(org.junit.Test) AbstractContentManagementTest(org.commonjava.indy.ftest.core.AbstractContentManagementTest)

Example 39 with PathsPromoteRequest

use of org.commonjava.indy.promote.model.PathsPromoteRequest in project indy by Commonjava.

the class PromoteMetadataShouldSkipWithReadonlyTest method run.

@Test
@Category(EventDependent.class)
public void run() throws Exception {
    PathsPromoteRequest request = new PathsPromoteRequest(source.getKey(), target.getKey(), ARTIFACT_PATH, HTTP_META_PATH, MD5_META_PATH);
    request.setFailWhenExists(true);
    PathsPromoteResult response = promote.promoteByPath(request);
    assertThat(response.succeeded(), equalTo(true));
    assertThat(response.getSkippedPaths().contains(HTTP_META_PATH), equalTo(true));
    assertThat(response.getSkippedPaths().contains(MD5_META_PATH), equalTo(true));
    assertThat(response.getSkippedPaths().contains(ARTIFACT_PATH), equalTo(true));
    waitForEventPropagation();
}
Also used : PathsPromoteResult(org.commonjava.indy.promote.model.PathsPromoteResult) PathsPromoteRequest(org.commonjava.indy.promote.model.PathsPromoteRequest) Category(org.junit.experimental.categories.Category) Test(org.junit.Test) AbstractContentManagementTest(org.commonjava.indy.ftest.core.AbstractContentManagementTest)

Example 40 with PathsPromoteRequest

use of org.commonjava.indy.promote.model.PathsPromoteRequest in project indy by Commonjava.

the class PromoteWithExcludeFilterTest method run.

@Test
public void run() throws Exception {
    // Promote b1 to target
    PathsPromoteResult result = client.module(IndyPromoteClientModule.class).promoteByPath(new PathsPromoteRequest(b1.getKey(), target.getKey()));
    assertThat(result.getError(), nullValue());
    String g1Metadata = getMetadataString(g1.getKey());
    String gBuildsMetadata = getMetadataString(gBuilds.getKey());
    /*
        System.out.println( "g1 >>>\n" + g1Metadata );
        System.out.println( "g-builds >>>\n" + gBuildsMetadata );
*/
    assertThat(client.content().exists(g1.getKey(), METADATA_PATH), equalTo(true));
    assertThat(client.content().exists(gBuilds.getKey(), METADATA_PATH), equalTo(true));
    // Promote b2 to target
    result = client.module(IndyPromoteClientModule.class).promoteByPath(new PathsPromoteRequest(b2.getKey(), target.getKey()));
    assertThat(result.getError(), nullValue());
    g1Metadata = getMetadataString(g1.getKey());
    gBuildsMetadata = getMetadataString(gBuilds.getKey());
    /*
        System.out.println( "g1 >>>\n" + g1Metadata );
        System.out.println( "g-builds >>>\n" + gBuildsMetadata );
*/
    assertThat(client.content().exists(g1.getKey(), METADATA_PATH), equalTo(true));
    assertThat(client.content().exists(gBuilds.getKey(), METADATA_PATH), equalTo(true));
    // g_builds metadata is updated but g1 is excluded during metadata clean-up
    assertThat(g1Metadata.contains("<latest>2.0</latest>"), equalTo(false));
    assertThat(gBuildsMetadata.contains("<latest>2.0</latest>"), equalTo(true));
}
Also used : PathsPromoteResult(org.commonjava.indy.promote.model.PathsPromoteResult) PathsPromoteRequest(org.commonjava.indy.promote.model.PathsPromoteRequest) IndyPromoteClientModule(org.commonjava.indy.promote.client.IndyPromoteClientModule) Test(org.junit.Test)

Aggregations

PathsPromoteRequest (org.commonjava.indy.promote.model.PathsPromoteRequest)47 PathsPromoteResult (org.commonjava.indy.promote.model.PathsPromoteResult)40 Test (org.junit.Test)34 IndyPromoteClientModule (org.commonjava.indy.promote.client.IndyPromoteClientModule)15 Category (org.junit.experimental.categories.Category)10 InputStream (java.io.InputStream)8 StoreKey (org.commonjava.indy.model.core.StoreKey)8 IndyWorkflowException (org.commonjava.indy.IndyWorkflowException)7 ByteArrayInputStream (java.io.ByteArrayInputStream)6 HashSet (java.util.HashSet)6 IndyDataException (org.commonjava.indy.data.IndyDataException)6 AbstractContentManagementTest (org.commonjava.indy.ftest.core.AbstractContentManagementTest)6 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)6 IOException (java.io.IOException)5 HostedRepository (org.commonjava.indy.model.core.HostedRepository)5 PromotionValidationException (org.commonjava.indy.promote.validate.PromotionValidationException)5 Transfer (org.commonjava.maven.galley.model.Transfer)5 ExecutionException (java.util.concurrent.ExecutionException)4 ChangeSummary (org.commonjava.indy.audit.ChangeSummary)4 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)4