Search in sources :

Example 1 with UploadSpecValidator

use of org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator in project build-info by JFrogDev.

the class SpecsHelperTest method testGetUploadDownloadSpecFromStringPositiveCases.

/**
 * Tests positive scenarios of parsing a String to FileSpec object.
 */
@Test(dataProvider = "fileSpecWithValues")
public void testGetUploadDownloadSpecFromStringPositiveCases(String specFileName, String aql, String pattern, String target, String props, String recursive, String flat, String regexp, String build) throws IOException {
    SpecsHelper specsHelper = new SpecsHelper(new NullLog());
    String specString = FileUtils.readFileToString(getFileFromResources("positiveTestSpecs/" + specFileName));
    FileSpec spec = specsHelper.getDownloadUploadSpec(specString, new UploadSpecValidator()).getFiles()[0];
    assertSpecParams(aql, pattern, target, props, recursive, flat, regexp, build, spec);
}
Also used : UploadSpecValidator(org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator) NullLog(org.jfrog.build.api.util.NullLog) Test(org.testng.annotations.Test)

Example 2 with UploadSpecValidator

use of org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator in project build-info by JFrogDev.

the class SpecsHelperTest method testGetUploadDownloadSpecFromFilePositiveCases.

/**
 * Tests positive scenarios of parsing a File to FileSpec object.
 */
@Test(dataProvider = "fileSpecWithValues")
public void testGetUploadDownloadSpecFromFilePositiveCases(String specFileName, String aql, String pattern, String target, String props, String recursive, String flat, String regexp, String build) throws IOException {
    SpecsHelper specsHelper = new SpecsHelper(new NullLog());
    File fileSpec = getFileFromResources("positiveTestSpecs/" + specFileName);
    FileSpec spec = specsHelper.getDownloadUploadSpec(fileSpec, new UploadSpecValidator()).getFiles()[0];
    assertSpecParams(aql, pattern, target, props, recursive, flat, regexp, build, spec);
}
Also used : UploadSpecValidator(org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator) NullLog(org.jfrog.build.api.util.NullLog) File(java.io.File) Test(org.testng.annotations.Test)

Example 3 with UploadSpecValidator

use of org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator in project build-info by JFrogDev.

the class SpecsHelperTest method testGetUploadDownloadSpecFromStringNegativeCases.

/**
 * Tests negative scenarios of parsing a String to FileSpec object.
 */
@Test(dataProvider = "corruptedStringSpecs", expectedExceptions = { JsonMappingException.class, IllegalArgumentException.class })
public void testGetUploadDownloadSpecFromStringNegativeCases(String spec) throws IOException {
    SpecsHelper specsHelper = new SpecsHelper(new NullLog());
    specsHelper.getDownloadUploadSpec(spec, new UploadSpecValidator());
}
Also used : UploadSpecValidator(org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator) NullLog(org.jfrog.build.api.util.NullLog) Test(org.testng.annotations.Test)

Example 4 with UploadSpecValidator

use of org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator in project build-info by JFrogDev.

the class SpecsHelper method uploadArtifactsBySpec.

/**
 * Uploads and returns List of artifacts according to a provided by the user upload fileSpec
 *
 * @param uploadSpec The required spec represented as String
 * @param workspace File object that represents the workspace
 * @param buildProperties Upload properties
 * @param client ArtifactoryBuildInfoClient which will do the actual upload
 * @return Set of DeployDetails that was calculated from the given params
 * @throws IOException Thrown if any error occurs while reading the file, calculating the
 *                     checksums or in case of any file system exception
 * @throws NoSuchAlgorithmException Thrown if any of the given algorithms aren't supported
 */
public List<Artifact> uploadArtifactsBySpec(String uploadSpec, File workspace, Multimap<String, String> buildProperties, ArtifactoryBuildInfoClient client) throws IOException, NoSuchAlgorithmException {
    Spec spec = this.getDownloadUploadSpec(uploadSpec, new UploadSpecValidator());
    Set<DeployDetails> artifactsToDeploy = getDeployDetails(spec, workspace, buildProperties);
    deploy(client, artifactsToDeploy);
    return convertDeployDetailsToArtifacts(artifactsToDeploy);
}
Also used : DeployDetails(org.jfrog.build.client.DeployDetails) UploadSpecValidator(org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator)

Example 5 with UploadSpecValidator

use of org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator in project build-info by JFrogDev.

the class SpecsHelperTest method testGetUploadDownloadSpecFromFileNegativeCases.

/**
 * Tests negative scenarios of parsing a File to FileSpec object.
 */
@Test(dataProvider = "corruptedFileSpecs", expectedExceptions = { JsonMappingException.class, IllegalArgumentException.class })
public void testGetUploadDownloadSpecFromFileNegativeCases(String specFileName) throws IOException {
    SpecsHelper specsHelper = new SpecsHelper(new NullLog());
    File fileSpec = getFileFromResources("negativeTestSpecs/" + specFileName);
    specsHelper.getDownloadUploadSpec(fileSpec, new UploadSpecValidator());
}
Also used : UploadSpecValidator(org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator) NullLog(org.jfrog.build.api.util.NullLog) File(java.io.File) Test(org.testng.annotations.Test)

Aggregations

UploadSpecValidator (org.jfrog.build.extractor.clientConfiguration.util.spec.validator.UploadSpecValidator)5 NullLog (org.jfrog.build.api.util.NullLog)4 Test (org.testng.annotations.Test)4 File (java.io.File)2 DeployDetails (org.jfrog.build.client.DeployDetails)1