Search in sources :

Example 1 with CreateReleaseBundleRequest

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());
}
Also used : FileSpec(org.jfrog.filespecs.FileSpec) DownloadResponse(org.jfrog.build.client.DownloadResponse) JsonUtils.toJsonString(org.jfrog.build.extractor.clientConfiguration.util.JsonUtils.toJsonString) FilesGroup(org.jfrog.filespecs.entities.FilesGroup) CreateReleaseBundleRequest(org.jfrog.build.extractor.clientConfiguration.client.distribution.request.CreateReleaseBundleRequest) Test(org.testng.annotations.Test)

Example 2 with CreateReleaseBundleRequest

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"));
}
Also used : FileSpec(org.jfrog.filespecs.FileSpec) GetReleaseBundleStatusResponse(org.jfrog.build.extractor.clientConfiguration.client.distribution.response.GetReleaseBundleStatusResponse) Property(org.jfrog.filespecs.properties.Property) FilesGroup(org.jfrog.filespecs.entities.FilesGroup) CreateReleaseBundleRequest(org.jfrog.build.extractor.clientConfiguration.client.distribution.request.CreateReleaseBundleRequest) Test(org.testng.annotations.Test)

Aggregations

CreateReleaseBundleRequest (org.jfrog.build.extractor.clientConfiguration.client.distribution.request.CreateReleaseBundleRequest)2 FileSpec (org.jfrog.filespecs.FileSpec)2 FilesGroup (org.jfrog.filespecs.entities.FilesGroup)2 Test (org.testng.annotations.Test)2 DownloadResponse (org.jfrog.build.client.DownloadResponse)1 GetReleaseBundleStatusResponse (org.jfrog.build.extractor.clientConfiguration.client.distribution.response.GetReleaseBundleStatusResponse)1 JsonUtils.toJsonString (org.jfrog.build.extractor.clientConfiguration.util.JsonUtils.toJsonString)1 Property (org.jfrog.filespecs.properties.Property)1