Search in sources :

Example 36 with Parameters

use of org.junit.runners.Parameterized.Parameters in project cas by apereo.

the class X509SubjectPrincipalResolverTests method getTestParameters.

/**
 * Gets the unit test parameters.
 *
 * @return  Test parameter data.
 */
@Parameters
public static Collection<Object[]> getTestParameters() throws Exception {
    final Collection<Object[]> params = new ArrayList<>();
    // Test case #1
    // Use CN for principal ID
    params.add(new Object[] { new ClassPathResource("x509-ctop-resolver-hizzy.crt").getFile().getCanonicalPath(), "$CN", "Hizzogarthington I.S. Pleakinsense" });
    // Test case #2
    // Use email address for principal ID
    params.add(new Object[] { new ClassPathResource("x509-ctop-resolver-hizzy.crt").getFile().getCanonicalPath(), "$EMAILADDRESS", "hizzy@vt.edu" });
    // Test case #2
    // Use combination of ou and cn for principal ID
    params.add(new Object[] { new ClassPathResource("x509-ctop-resolver-hizzy.crt").getFile().getCanonicalPath(), "$OU $CN", "Middleware Hizzogarthington I.S. Pleakinsense" });
    // Test case #3
    // Use combination of serial number and cn for principal ID
    params.add(new Object[] { new ClassPathResource("x509-ctop-resolver-gazzo.crt").getFile().getCanonicalPath(), "$CN:$SERIALNUMBER", "Gazzaloddi P. Wishwashington:271828183" });
    // Test case #4
    // Build principal ID from multivalued attributes
    params.add(new Object[] { new ClassPathResource("x509-ctop-resolver-jacky.crt").getFile().getCanonicalPath(), "$UID@$DC.$DC", "jacky@vt.edu" });
    return params;
}
Also used : ArrayList(java.util.ArrayList) ClassPathResource(org.springframework.core.io.ClassPathResource) Parameters(org.junit.runners.Parameterized.Parameters)

Example 37 with Parameters

use of org.junit.runners.Parameterized.Parameters in project opennms by OpenNMS.

the class DataSourceConfigurationTest method data.

@Parameters
public static Collection<Object[]> data() throws Exception {
    DataSourceConfiguration config = new DataSourceConfiguration();
    ConnectionPool connectionPool = new ConnectionPool();
    connectionPool.setFactory("org.opennms.core.db.HikariCPConnectionFactory");
    connectionPool.setIdleTimeout(600);
    connectionPool.setLoginTimeout(3);
    connectionPool.setMinPool(50);
    connectionPool.setMaxPool(50);
    connectionPool.setMaxSize(50);
    config.setConnectionPool(connectionPool);
    JdbcDataSource opennmsDs = new JdbcDataSource();
    opennmsDs.setName("opennms");
    opennmsDs.setClassName("org.postgresql.Driver");
    opennmsDs.setUrl(System.getProperty("mock.db.url", "jdbc:postgresql://localhost:5432/") + "template1");
    opennmsDs.setUserName("opennms");
    opennmsDs.setPassword("opennms");
    config.addJdbcDataSource(opennmsDs);
    JdbcDataSource opennmsDeuceDs = new JdbcDataSource();
    opennmsDeuceDs.setName("opennms2");
    opennmsDeuceDs.setClassName("org.postgresql.Driver");
    opennmsDeuceDs.setUrl(System.getProperty("mock.db.url", "jdbc:postgresql://localhost:5432/") + "template1");
    opennmsDeuceDs.addParam(new Param("user", "opennms"));
    opennmsDeuceDs.addParam(new Param("password", "opennms"));
    config.addJdbcDataSource(opennmsDeuceDs);
    return Arrays.asList(new Object[][] { { config, new File("src/test/resources/org/opennms/core/db/opennms-datasources.xml") } });
}
Also used : ConnectionPool(org.opennms.netmgt.config.opennmsDataSources.ConnectionPool) JdbcDataSource(org.opennms.netmgt.config.opennmsDataSources.JdbcDataSource) Param(org.opennms.netmgt.config.opennmsDataSources.Param) DataSourceConfiguration(org.opennms.netmgt.config.opennmsDataSources.DataSourceConfiguration) File(java.io.File) Parameters(org.junit.runners.Parameterized.Parameters)

Example 38 with Parameters

use of org.junit.runners.Parameterized.Parameters in project jetty.project by eclipse.

the class TestABCase3 method data.

@Parameters
public static Collection<WebSocketFrame[]> data() {
    List<WebSocketFrame[]> data = new ArrayList<>();
    // @formatter:off
    data.add(new WebSocketFrame[] { new PingFrame().setFin(false) });
    data.add(new WebSocketFrame[] { new PingFrame().setRsv1(true) });
    data.add(new WebSocketFrame[] { new PingFrame().setRsv2(true) });
    data.add(new WebSocketFrame[] { new PingFrame().setRsv3(true) });
    data.add(new WebSocketFrame[] { new PongFrame().setFin(false) });
    data.add(new WebSocketFrame[] { new PingFrame().setRsv1(true) });
    data.add(new WebSocketFrame[] { new PongFrame().setRsv2(true) });
    data.add(new WebSocketFrame[] { new PongFrame().setRsv3(true) });
    data.add(new WebSocketFrame[] { new CloseInfo().asFrame().setFin(false) });
    data.add(new WebSocketFrame[] { new CloseInfo().asFrame().setRsv1(true) });
    data.add(new WebSocketFrame[] { new CloseInfo().asFrame().setRsv2(true) });
    data.add(new WebSocketFrame[] { new CloseInfo().asFrame().setRsv3(true) });
    // @formatter:on
    return data;
}
Also used : PongFrame(org.eclipse.jetty.websocket.common.frames.PongFrame) PingFrame(org.eclipse.jetty.websocket.common.frames.PingFrame) ArrayList(java.util.ArrayList) CloseInfo(org.eclipse.jetty.websocket.common.CloseInfo) Parameters(org.junit.runners.Parameterized.Parameters)

Example 39 with Parameters

use of org.junit.runners.Parameterized.Parameters in project jetty.project by eclipse.

the class ClientAnnotatedEndpointScanner_GoodSignaturesTest method data.

@Parameters
public static Collection<Case[]> data() throws Exception {
    List<Case[]> data = new ArrayList<>();
    Field fOpen = findFieldRef(AnnotatedEndpointMetadata.class, "onOpen");
    Field fClose = findFieldRef(AnnotatedEndpointMetadata.class, "onClose");
    Field fError = findFieldRef(AnnotatedEndpointMetadata.class, "onError");
    Field fText = findFieldRef(AnnotatedEndpointMetadata.class, "onText");
    Field fBinary = findFieldRef(AnnotatedEndpointMetadata.class, "onBinary");
    Field fBinaryStream = findFieldRef(AnnotatedEndpointMetadata.class, "onBinaryStream");
    Field fPong = findFieldRef(AnnotatedEndpointMetadata.class, "onPong");
    // @formatter:off
    // -- Open Events
    Case.add(data, BasicOpenSocket.class, fOpen);
    Case.add(data, BasicOpenSessionSocket.class, fOpen, Session.class);
    // -- Close Events
    Case.add(data, CloseSocket.class, fClose);
    Case.add(data, CloseReasonSocket.class, fClose, CloseReason.class);
    Case.add(data, CloseReasonSessionSocket.class, fClose, CloseReason.class, Session.class);
    Case.add(data, CloseSessionReasonSocket.class, fClose, Session.class, CloseReason.class);
    // -- Error Events
    Case.add(data, BasicErrorSocket.class, fError);
    Case.add(data, BasicErrorSessionSocket.class, fError, Session.class);
    Case.add(data, BasicErrorSessionThrowableSocket.class, fError, Session.class, Throwable.class);
    Case.add(data, BasicErrorThrowableSocket.class, fError, Throwable.class);
    Case.add(data, BasicErrorThrowableSessionSocket.class, fError, Throwable.class, Session.class);
    // -- Text Events
    Case.add(data, BasicTextMessageStringSocket.class, fText, String.class);
    // -- Binary Events
    Case.add(data, BasicBinaryMessageByteBufferSocket.class, fBinary, ByteBuffer.class);
    // -- Pong Events
    Case.add(data, BasicPongMessageSocket.class, fPong, PongMessage.class);
    // -- InputStream Events
    Case.add(data, BasicInputStreamSocket.class, fBinaryStream, InputStream.class);
    Case.add(data, BasicInputStreamWithThrowableSocket.class, fBinaryStream, InputStream.class);
    return data;
}
Also used : Field(java.lang.reflect.Field) ArrayList(java.util.ArrayList) Parameters(org.junit.runners.Parameterized.Parameters)

Example 40 with Parameters

use of org.junit.runners.Parameterized.Parameters in project hackpad by dropbox.

the class DoctestsTest method doctestValues.

@Parameters
public static Collection<Object[]> doctestValues() throws IOException {
    File[] doctests = getDoctestFiles();
    List<Object[]> result = new ArrayList<Object[]>();
    for (File f : doctests) {
        String contents = loadFile(f);
        result.add(new Object[] { f.getName(), contents, -1 });
        result.add(new Object[] { f.getName(), contents, 0 });
        result.add(new Object[] { f.getName(), contents, 9 });
    }
    return result;
}
Also used : File(java.io.File) Parameters(org.junit.runners.Parameterized.Parameters)

Aggregations

Parameters (org.junit.runners.Parameterized.Parameters)77 ArrayList (java.util.ArrayList)43 File (java.io.File)24 TestCaseContext (org.apache.asterix.testframework.context.TestCaseContext)6 Date (java.util.Date)5 SslContext (io.netty.handler.ssl.SslContext)4 IOException (java.io.IOException)4 ExpiredCRLException (org.apereo.cas.adaptors.x509.authentication.ExpiredCRLException)4 ThresholdExpiredCRLRevocationPolicy (org.apereo.cas.adaptors.x509.authentication.revocation.policy.ThresholdExpiredCRLRevocationPolicy)4 RunWith (org.junit.runner.RunWith)4 ClassPathResource (org.springframework.core.io.ClassPathResource)4 ZonedDateTime (java.time.ZonedDateTime)3 Configuration (org.apache.hadoop.conf.Configuration)3 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)3 RevokedCertificateException (org.apereo.cas.adaptors.x509.authentication.revocation.RevokedCertificateException)3 Parameterized (org.junit.runners.Parameterized)3 CollectionAgentDTO (org.opennms.netmgt.collection.dto.CollectionAgentDTO)3 FileFilter (java.io.FileFilter)2 InputStream (java.io.InputStream)2 Field (java.lang.reflect.Field)2