use of org.junit.runners.Parameterized.Parameters in project jetty.project by eclipse.
the class ResourceTest method data.
@Parameters(name = "{0}")
public static Collection<Data[]> data() throws Exception {
UseCases cases = new UseCases("src/test/resources/");
File testDir = MavenTestingUtils.getTargetTestingDir(ResourceTest.class.getName());
FS.ensureEmpty(testDir);
File tmpFile = File.createTempFile("test", null, testDir);
cases.addCase(new Data(tmpFile.toString(), EXISTS, !DIR));
// Some resource references.
cases.addAllSimpleCases("resource.txt", EXISTS, !DIR);
cases.addAllSimpleCases("NoName.txt", !EXISTS, !DIR);
// Some addPath() forms
cases.addAllAddPathCases("resource.txt", EXISTS, !DIR);
cases.addAllAddPathCases("/resource.txt", EXISTS, !DIR);
cases.addAllAddPathCases("//resource.txt", EXISTS, !DIR);
cases.addAllAddPathCases("NoName.txt", !EXISTS, !DIR);
cases.addAllAddPathCases("/NoName.txt", !EXISTS, !DIR);
cases.addAllAddPathCases("//NoName.txt", !EXISTS, !DIR);
Data tdata1 = cases.addAllAddPathCases("TestData", EXISTS, DIR);
Data tdata2 = cases.addAllAddPathCases("TestData/", EXISTS, DIR);
cases.addCase(new Data(tdata1, "alphabet.txt", EXISTS, !DIR, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
cases.addCase(new Data(tdata2, "alphabet.txt", EXISTS, !DIR, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
cases.addCase(new Data("jar:file:/somejar.jar!/content/", !EXISTS, DIR));
cases.addCase(new Data("jar:file:/somejar.jar!/", !EXISTS, DIR));
String urlRef = cases.uriRef.toASCIIString();
Data zdata = new Data("jar:" + urlRef + "TestData/test.zip!/", EXISTS, DIR);
cases.addCase(zdata);
cases.addCase(new Data(zdata, "Unkown", !EXISTS, !DIR));
cases.addCase(new Data(zdata, "/Unkown/", !EXISTS, DIR));
cases.addCase(new Data(zdata, "subdir", EXISTS, DIR));
cases.addCase(new Data(zdata, "/subdir/", EXISTS, DIR));
cases.addCase(new Data(zdata, "alphabet", EXISTS, !DIR, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
cases.addCase(new Data(zdata, "/subdir/alphabet", EXISTS, !DIR, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
cases.addAllAddPathCases("/TestData/test/subdir/subsubdir/", EXISTS, DIR);
cases.addAllAddPathCases("//TestData/test/subdir/subsubdir/", EXISTS, DIR);
cases.addAllAddPathCases("/TestData//test/subdir/subsubdir/", EXISTS, DIR);
cases.addAllAddPathCases("/TestData/test//subdir/subsubdir/", EXISTS, DIR);
cases.addAllAddPathCases("/TestData/test/subdir//subsubdir/", EXISTS, DIR);
cases.addAllAddPathCases("TestData/test/subdir/subsubdir/", EXISTS, DIR);
cases.addAllAddPathCases("TestData/test/subdir/subsubdir//", EXISTS, DIR);
cases.addAllAddPathCases("TestData/test/subdir//subsubdir/", EXISTS, DIR);
cases.addAllAddPathCases("TestData/test//subdir/subsubdir/", EXISTS, DIR);
cases.addAllAddPathCases("/TestData/../TestData/test/subdir/subsubdir/", EXISTS, DIR);
return cases.data;
}
use of org.junit.runners.Parameterized.Parameters in project jsonschema2pojo by joelittlejohn.
the class CompilerWarningIT method parameters.
@Parameters(name = "{0}")
public static Collection<Object[]> parameters() {
JavaCompiler systemJavaCompiler = Compiler.systemJavaCompiler();
JavaCompiler eclipseCompiler = Compiler.eclipseCompiler();
return Arrays.asList(new Object[][] { { "includeAccessorsWithSystemJavaCompiler", systemJavaCompiler, config("includeDynamicAccessors", true), "/schema/dynamic/parentType.json", Matchers.empty() }, { "includeAccessorsWithEclipseCompiler", eclipseCompiler, config("includeDynamicAccessors", true), "/schema/dynamic/parentType.json", onlyCastExceptions() } });
}
use of org.junit.runners.Parameterized.Parameters in project camel by apache.
the class BulkApiJobIntegrationTest method getJobs.
// test jobs for testJobLifecycle
@Parameters(name = "operation = {1}")
public static Iterable<Object[]> getJobs() {
final List<JobInfo> result = new ArrayList<>();
// insert XML
final JobInfo insertXml = new JobInfo();
insertXml.setObject(Merchandise__c.class.getSimpleName());
insertXml.setContentType(ContentType.XML);
insertXml.setOperation(OperationEnum.INSERT);
result.add(insertXml);
// insert CSV
JobInfo insertCsv = new JobInfo();
insertCsv = new JobInfo();
insertCsv.setObject(Merchandise__c.class.getSimpleName());
insertCsv.setContentType(ContentType.CSV);
insertCsv.setOperation(OperationEnum.INSERT);
result.add(insertCsv);
// update CSV
final JobInfo updateCsv = new JobInfo();
updateCsv.setObject(Merchandise__c.class.getSimpleName());
updateCsv.setContentType(ContentType.CSV);
updateCsv.setOperation(OperationEnum.UPDATE);
result.add(updateCsv);
// upsert CSV
final JobInfo upsertCsv = new JobInfo();
upsertCsv.setObject(Merchandise__c.class.getSimpleName());
upsertCsv.setContentType(ContentType.CSV);
upsertCsv.setOperation(OperationEnum.UPSERT);
upsertCsv.setExternalIdFieldName("Name");
result.add(upsertCsv);
// delete CSV
final JobInfo deleteCsv = new JobInfo();
deleteCsv.setObject(Merchandise__c.class.getSimpleName());
deleteCsv.setContentType(ContentType.CSV);
deleteCsv.setOperation(OperationEnum.DELETE);
result.add(deleteCsv);
// hard delete CSV
final JobInfo hardDeleteCsv = new JobInfo();
hardDeleteCsv.setObject(Merchandise__c.class.getSimpleName());
hardDeleteCsv.setContentType(ContentType.CSV);
hardDeleteCsv.setOperation(OperationEnum.HARD_DELETE);
result.add(hardDeleteCsv);
// query CSV
final JobInfo queryCsv = new JobInfo();
queryCsv.setObject(Merchandise__c.class.getSimpleName());
queryCsv.setContentType(ContentType.CSV);
queryCsv.setOperation(OperationEnum.QUERY);
result.add(queryCsv);
return result.stream().map(j -> new Object[] { j, j.getOperation().name() }).collect(Collectors.toList());
}
use of org.junit.runners.Parameterized.Parameters in project cas by apereo.
the class CRLDistributionPointRevocationCheckerTests method getTestParameters.
/**
* Gets the unit test parameters.
*
* @return Test parameter data.
*/
@Parameters
public static Collection<Object[]> getTestParameters() throws Exception {
CacheManager.getInstance().removeAllCaches();
final Collection<Object[]> params = new ArrayList<>();
Cache cache;
final ThresholdExpiredCRLRevocationPolicy defaultPolicy = new ThresholdExpiredCRLRevocationPolicy(0);
final ThresholdExpiredCRLRevocationPolicy zeroThresholdPolicy = new ThresholdExpiredCRLRevocationPolicy(0);
// Test case #0
// Valid certificate on valid CRL data with encoded url
cache = new Cache("crlCache-0", 100, false, false, 20, 10);
CacheManager.getInstance().addCache(cache);
params.add(new Object[] { new CRLDistributionPointRevocationChecker(cache, defaultPolicy, null), new String[] { "uservalid-encoded-crl.crt" }, "test ca.crl", null });
// Test case #1
// Valid certificate on valid CRL data
cache = new Cache("crlCache-1", 100, false, false, 20, 10);
CacheManager.getInstance().addCache(cache);
params.add(new Object[] { new CRLDistributionPointRevocationChecker(cache, defaultPolicy, null, true), new String[] { "user-valid-distcrl.crt" }, "userCA-valid.crl", null });
// Test case #2
// Revoked certificate on valid CRL data
cache = new Cache("crlCache-2", 100, false, false, 20, 10);
CacheManager.getInstance().addCache(cache);
params.add(new Object[] { new CRLDistributionPointRevocationChecker(cache, defaultPolicy, null), new String[] { "user-revoked-distcrl.crt" }, "userCA-valid.crl", new RevokedCertificateException(ZonedDateTime.now(ZoneOffset.UTC), new BigInteger("1")) });
// Test case #3
// Valid certificate on expired CRL data
cache = new Cache("crlCache-3", 100, false, false, 20, 10);
CacheManager.getInstance().addCache(cache);
params.add(new Object[] { new CRLDistributionPointRevocationChecker(cache, zeroThresholdPolicy, null), new String[] { "user-valid-distcrl.crt" }, "userCA-expired.crl", new ExpiredCRLException("test", ZonedDateTime.now(ZoneOffset.UTC)) });
// Test case #4
// Valid certificate on expired CRL data with custom expiration
// policy to always allow expired CRL data
cache = new Cache("crlCache-4", 100, false, false, 20, 10);
CacheManager.getInstance().addCache(cache);
params.add(new Object[] { new CRLDistributionPointRevocationChecker(cache, crl -> {
}, null), new String[] { "user-valid-distcrl.crt" }, "userCA-expired.crl", null });
// Test case #5
// Valid certificate with no CRL distribution points defined but with
// "AllowRevocationPolicy" set to allow unavailable CRL data
cache = new Cache("crlCache-5", 100, false, false, 20, 10);
CacheManager.getInstance().addCache(cache);
final CRLDistributionPointRevocationChecker checker5 = new CRLDistributionPointRevocationChecker(cache, defaultPolicy, new AllowRevocationPolicy());
params.add(new Object[] { checker5, new String[] { "user-valid.crt" }, "userCA-expired.crl", null });
// Test case #6
// EJBCA test case
// Revoked certificate with CRL distribution point URI that is technically
// not a valid URI since the issuer DN in the query string is not encoded per
// the escaping of reserved characters in RFC 2396.
// Make sure we can convert given URI to valid URI and confirm it's revoked
cache = new Cache("crlCache-6", 100, false, false, 20, 10);
CacheManager.getInstance().addCache(cache);
params.add(new Object[] { new CRLDistributionPointRevocationChecker(cache, defaultPolicy, null), new String[] { "user-revoked-distcrl2.crt" }, "userCA-valid.crl", new RevokedCertificateException(ZonedDateTime.now(ZoneOffset.UTC), new BigInteger("1")) });
return params;
}
use of org.junit.runners.Parameterized.Parameters in project cas by apereo.
the class ResourceCRLRevocationCheckerTests method getTestParameters.
/**
* Gets the unit test parameters.
*
* @return Test parameter data.
*/
@Parameters
public static Collection<Object[]> getTestParameters() {
final Collection<Object[]> params = new ArrayList<>();
final ThresholdExpiredCRLRevocationPolicy zeroThresholdPolicy = new ThresholdExpiredCRLRevocationPolicy(0);
// Test case #1
// Valid certificate on valid CRL data
params.add(new Object[] { new ResourceCRLRevocationChecker(new ClassPathResource[] { new ClassPathResource("userCA-valid.crl") }, zeroThresholdPolicy), new String[] { "user-valid.crt" }, null });
// Test case #2
// Revoked certificate on valid CRL data
params.add(new Object[] { new ResourceCRLRevocationChecker(new ClassPathResource[] { new ClassPathResource("userCA-valid.crl"), new ClassPathResource("intermediateCA-valid.crl"), new ClassPathResource("rootCA-valid.crl") }, zeroThresholdPolicy), new String[] { "user-revoked.crt", "userCA.crt", "intermediateCA.crt", "rootCA.crt" }, new RevokedCertificateException(ZonedDateTime.now(ZoneOffset.UTC), new BigInteger("1")) });
// Test case #3
// Valid certificate on expired CRL data for head cert
params.add(new Object[] { new ResourceCRLRevocationChecker(new ClassPathResource[] { new ClassPathResource("userCA-expired.crl"), new ClassPathResource("intermediateCA-valid.crl"), new ClassPathResource("rootCA-valid.crl") }, zeroThresholdPolicy), new String[] { "user-valid.crt", "userCA.crt", "intermediateCA.crt", "rootCA.crt" }, new ExpiredCRLException("test", ZonedDateTime.now(ZoneOffset.UTC)) });
// Test case #4
// Valid certificate on expired CRL data for intermediate cert
params.add(new Object[] { new ResourceCRLRevocationChecker(new ClassPathResource[] { new ClassPathResource("userCA-valid.crl"), new ClassPathResource("intermediateCA-expired.crl"), new ClassPathResource("rootCA-valid.crl") }, zeroThresholdPolicy), new String[] { "user-valid.crt", "userCA.crt", "intermediateCA.crt", "rootCA.crt" }, new ExpiredCRLException("test", ZonedDateTime.now(ZoneOffset.UTC)) });
// Test case #5
// Valid certificate on expired CRL data with custom expiration
// policy to always allow expired CRL data
params.add(new Object[] { new ResourceCRLRevocationChecker(new ClassPathResource[] { new ClassPathResource("userCA-expired.crl") }, crl -> {
}), new String[] { "user-valid.crt" }, null });
return params;
}
Aggregations