use of org.commonjava.indy.promote.model.PathsPromoteRequest in project indy by Commonjava.
the class PromotionManagerTest method promoteAllByPath_PushTwoArtifactsToHostedRepo_VerifyCopiedToOtherHostedRepo.
@Test
public void promoteAllByPath_PushTwoArtifactsToHostedRepo_VerifyCopiedToOtherHostedRepo() throws Exception {
prepareHostedReposAndTwoPaths();
final PathsPromoteResult result = manager.promotePaths(new PathsPromoteRequest(source.getKey(), target.getKey()), FAKE_BASE_URL);
assertThat(result.getRequest().getSource(), equalTo(source.getKey()));
assertThat(result.getRequest().getTarget(), equalTo(target.getKey()));
final Set<String> pending = result.getPendingPaths();
assertThat(pending == null || pending.isEmpty(), equalTo(true));
final Set<String> completed = result.getCompletedPaths();
assertThat(completed, notNullValue());
assertThat(completed.size(), equalTo(2));
assertThat(result.getError(), nullValue());
verifyExistence(true, true, true, true);
}
use of org.commonjava.indy.promote.model.PathsPromoteRequest in project indy by Commonjava.
the class HostedMetadataRemergedOnPathPromoteTest 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);
}
use of org.commonjava.indy.promote.model.PathsPromoteRequest in project indy by Commonjava.
the class HostedMetadataRemergedOnPathPromoteWithOnlyArtifactTest 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);
}
use of org.commonjava.indy.promote.model.PathsPromoteRequest in project indy by Commonjava.
the class StoreAndPromoteFileToTrackedHostedRepoTest method run.
@Test
public void run() throws Exception {
String changelog = "Create test repo";
IndyFoloContentClientModule folo = client.module(IndyFoloContentClientModule.class);
IndyPromoteClientModule promote = client.module(IndyPromoteClientModule.class);
IndyFoloAdminClientModule foloAdmin = client.module(IndyFoloAdminClientModule.class);
// 0. Create tracking id and use it as promotion source
String trackingId = newName();
// 1. Create source and target repositories
HostedRepository source = new HostedRepository(MavenPackageTypeDescriptor.MAVEN_PKG_KEY, trackingId);
client.stores().create(source, changelog, HostedRepository.class);
HostedRepository target = new HostedRepository(MavenPackageTypeDescriptor.MAVEN_PKG_KEY, "target");
client.stores().create(target, changelog, HostedRepository.class);
// 2. Store the artifact to source repo
InputStream stream = new ByteArrayInputStream(bytes);
folo.store(trackingId, source.getKey(), path, stream);
// 3. Seal the record
foloAdmin.sealTrackingRecord(trackingId);
// 4. Promote to target repo (by path)
PathsPromoteRequest promoteRequest = new PathsPromoteRequest(source.getKey(), target.getKey());
promoteRequest.setFireEvents(true);
promote.promoteByPath(promoteRequest);
// 5. Check tracking record, the store is adjusted to target
TrackedContentDTO trackingContent = foloAdmin.getRawTrackingContent(trackingId);
List<TrackedContentEntryDTO> list = new ArrayList<>(trackingContent.getUploads());
TrackedContentEntryDTO trackedContent = list.get(0);
assertEquals(target.getKey(), trackedContent.getStoreKey());
}
use of org.commonjava.indy.promote.model.PathsPromoteRequest in project indy by Commonjava.
the class IndyPromoteClientModule method getPromotablePaths.
public Set<String> getPromotablePaths(final StoreType type, final String name) throws IndyClientException {
final StoreKey sk = new StoreKey(type, name);
final PathsPromoteResult result = promoteByPath(new PathsPromoteRequest(sk, sk).setDryRun(true));
return result.getPendingPaths();
}
Aggregations