use of org.jfrog.build.extractor.clientConfiguration.client.distribution.request.CreateReleaseBundleRequest in project build-info by JFrogDev.
the class RemoteDistributionManagerTest method distributeWithMappingTest.
@Test
public void distributeWithMappingTest() throws IOException {
// Create a release bundle with path mapping
String fileName = uploadFile();
FileSpec fileSpec = new FileSpec();
FilesGroup filesGroup = new FilesGroup().setPattern(localRepo1 + "/data/(*)").setTarget(localRepo2 + "/data2/{1}");
fileSpec.addFilesGroup(filesGroup);
CreateReleaseBundleRequest request = new CreateReleaseBundleRequest.Builder(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION).spec(fileSpec).signImmediately(true).build();
distributionManager.createReleaseBundle(request);
// Distribute the release bundle
distributionManager.distributeReleaseBundle(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION, true, createDistributionRequest());
// Download the file from the new path
DownloadResponse downloadResponse = artifactoryManager.download(localRepo2 + "/data2/" + fileName);
assertTrue(StringUtils.isNotBlank(downloadResponse.getContent()));
// Delete release bundle
distributionManager.deleteReleaseBundle(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION, true, createDeletionRequest());
}
use of org.jfrog.build.extractor.clientConfiguration.client.distribution.request.CreateReleaseBundleRequest in project build-info by JFrogDev.
the class LocalDistributionManagerTest method addedPropsTest.
@Test
public void addedPropsTest() throws IOException {
// Create a release bundle with added props
String fileName = uploadFile();
FileSpec fileSpec = new FileSpec();
FilesGroup filesGroup = new FilesGroup().setTargetProps("key1=value1,value2").setPattern(localRepo1 + "/data/" + fileName);
fileSpec.addFilesGroup(filesGroup);
CreateReleaseBundleRequest request = new CreateReleaseBundleRequest.Builder(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION).spec(fileSpec).build();
distributionManager.createReleaseBundle(request);
// Assert added props
GetReleaseBundleStatusResponse bundleInfo = distributionManager.getReleaseBundleStatus(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION);
assertNotNull(bundleInfo);
List<Property> addedProps = bundleInfo.getSpec().getQueries().get(0).getAddedProps();
assertFalse(addedProps.isEmpty());
Property property = addedProps.get(0);
assertEquals(property.getKey(), "key1");
assertEquals(property.getValues(), Sets.newHashSet("value1", "value2"));
}
Aggregations