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);
}
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);
}
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());
}
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);
}
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());
}
Aggregations