Search in sources :

Example 1 with GetReleaseBundleStatusResponse

use of org.jfrog.build.extractor.clientConfiguration.client.distribution.response.GetReleaseBundleStatusResponse in project build-info by JFrogDev.

the class LocalDistributionManagerTest method createUpdateDeleteReleaseBundleTest.

@Test
public void createUpdateDeleteReleaseBundleTest() throws IOException {
    // Create release bundle
    distributionManager.createReleaseBundle(createRequestBuilder().build(), "");
    // Assert create
    GetReleaseBundleStatusResponse bundleInfo = distributionManager.getReleaseBundleStatus(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION);
    assertEquals(bundleInfo.getDescription(), "Create");
    assertEquals(bundleInfo.getReleaseNotes().getContent(), "Create content");
    assertEquals(bundleInfo.getReleaseNotes().getSyntax(), ReleaseNotes.Syntax.plain_text);
    // Update release bundle
    distributionManager.updateReleaseBundle(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION, updateRequestBuilder().build());
    // Assert update
    bundleInfo = distributionManager.getReleaseBundleStatus(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION);
    assertEquals(bundleInfo.getDescription(), "Update");
    assertEquals(bundleInfo.getReleaseNotes().getContent(), "Update content");
    // Delete release bundle
    distributionManager.deleteLocalReleaseBundle(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION);
    // Assert deletion
    bundleInfo = distributionManager.getReleaseBundleStatus(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION);
    assertNull(bundleInfo);
}
Also used : GetReleaseBundleStatusResponse(org.jfrog.build.extractor.clientConfiguration.client.distribution.response.GetReleaseBundleStatusResponse) Test(org.testng.annotations.Test)

Example 2 with GetReleaseBundleStatusResponse

use of org.jfrog.build.extractor.clientConfiguration.client.distribution.response.GetReleaseBundleStatusResponse in project build-info by JFrogDev.

the class LocalDistributionManagerTest method dryRunTest.

@Test
public void dryRunTest() throws IOException {
    // Create release bundle
    distributionManager.createReleaseBundle(createRequestBuilder().dryRun(true).build());
    // Assert release bundle doesn't created
    GetReleaseBundleStatusResponse bundleInfo = distributionManager.getReleaseBundleStatus(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION);
    assertNull(bundleInfo);
    // Create and sign release bundle
    distributionManager.createReleaseBundle(createRequestBuilder().signImmediately(true).build());
    // Distribute with dry run
    DistributeReleaseBundleRequest request = new DistributeReleaseBundleRequest();
    List<DistributionRules> distributionRules = Lists.newArrayList(new DistributionRules.Builder().siteName("*").build());
    request.setDistributionRules(distributionRules);
    request.setDryRun(true);
    DistributeReleaseBundleResponse response = distributionManager.distributeReleaseBundle(RELEASE_BUNDLE_NAME, RELEASE_BUNDLE_VERSION, true, request);
    // Assert no tracker ID returned and that the target site exist
    assertTrue(StringUtils.isBlank(response.getTrackerId()));
    List<DistributionStatusResponse.TargetArtifactory> sites = response.getSites();
    assertTrue(CollectionUtils.hasElements(sites));
}
Also used : DistributionRules(org.jfrog.build.extractor.clientConfiguration.client.distribution.types.DistributionRules) GetReleaseBundleStatusResponse(org.jfrog.build.extractor.clientConfiguration.client.distribution.response.GetReleaseBundleStatusResponse) DistributeReleaseBundleRequest(org.jfrog.build.extractor.clientConfiguration.client.distribution.request.DistributeReleaseBundleRequest) DistributeReleaseBundleResponse(org.jfrog.build.extractor.clientConfiguration.client.distribution.response.DistributeReleaseBundleResponse) Test(org.testng.annotations.Test)

Example 3 with GetReleaseBundleStatusResponse

use of org.jfrog.build.extractor.clientConfiguration.client.distribution.response.GetReleaseBundleStatusResponse 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

GetReleaseBundleStatusResponse (org.jfrog.build.extractor.clientConfiguration.client.distribution.response.GetReleaseBundleStatusResponse)3 Test (org.testng.annotations.Test)3 CreateReleaseBundleRequest (org.jfrog.build.extractor.clientConfiguration.client.distribution.request.CreateReleaseBundleRequest)1 DistributeReleaseBundleRequest (org.jfrog.build.extractor.clientConfiguration.client.distribution.request.DistributeReleaseBundleRequest)1 DistributeReleaseBundleResponse (org.jfrog.build.extractor.clientConfiguration.client.distribution.response.DistributeReleaseBundleResponse)1 DistributionRules (org.jfrog.build.extractor.clientConfiguration.client.distribution.types.DistributionRules)1 FileSpec (org.jfrog.filespecs.FileSpec)1 FilesGroup (org.jfrog.filespecs.entities.FilesGroup)1 Property (org.jfrog.filespecs.properties.Property)1