Search in sources :

Example 1 with Property

use of org.jfrog.filespecs.properties.Property 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)1 GetReleaseBundleStatusResponse (org.jfrog.build.extractor.clientConfiguration.client.distribution.response.GetReleaseBundleStatusResponse)1 FileSpec (org.jfrog.filespecs.FileSpec)1 FilesGroup (org.jfrog.filespecs.entities.FilesGroup)1 Property (org.jfrog.filespecs.properties.Property)1 Test (org.testng.annotations.Test)1