Search in sources :

Example 16 with Parameters

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

the class CollectionAgentDTOTest method data.

@Parameters
public static Collection<Object[]> data() throws ParseException {
    CollectionAgentDTO collectionAgentDTO = new CollectionAgentDTO();
    collectionAgentDTO.setType(42);
    collectionAgentDTO.setAddress(InetAddressUtils.getInetAddress("192.168.1.1"));
    collectionAgentDTO.setAttribute("k1", "v1");
    collectionAgentDTO.setStoreByForeignSource(true);
    collectionAgentDTO.setNodeId(99);
    collectionAgentDTO.setNodeLabel("switch");
    collectionAgentDTO.setForeignSource("fs");
    collectionAgentDTO.setForeignId("fid");
    collectionAgentDTO.setLocationName("HQ");
    collectionAgentDTO.setStorageResourcePath(ResourcePath.get("tmp", "foo"));
    collectionAgentDTO.setSysObjectId(".1.3.6");
    collectionAgentDTO.setSavedSysUpTime(149);
    return Arrays.asList(new Object[][] { { collectionAgentDTO, "<agent type=\"42\" address=\"192.168.1.1\" store-by-fs=\"true\" node-id=\"99\" node-label=\"switch\" foreign-source=\"fs\" foreign-id=\"fid\" location=\"HQ\" storage-resource-path=\"tmp/foo\" sys-object-id=\".1.3.6\" sys-up-time=\"149\">\n" + "   <attribute key=\"k1\"><![CDATA[v1]]></attribute>\n" + "</agent>" } });
}
Also used : CollectionAgentDTO(org.opennms.netmgt.collection.dto.CollectionAgentDTO) Parameters(org.junit.runners.Parameterized.Parameters)

Example 17 with Parameters

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

the class CollectorRequestDTOTest method data.

@Parameters
public static Collection<Object[]> data() throws Exception {
    CollectionAgentDTO agent = new CollectionAgentDTO();
    CollectorRequestDTO request = new CollectorRequestDTO();
    request.setAgent(agent);
    request.setLocation("HQ");
    request.setClassName(ServiceCollector.class.getCanonicalName());
    request.addAttribute("key", "value");
    return Arrays.asList(new Object[][] { { request, "<collector-request location=\"HQ\" class-name=\"org.opennms.netmgt.collection.api.ServiceCollector\">\n" + "   <agent type=\"0\" node-id=\"0\" sys-up-time=\"0\"/>\n" + "   <attribute key=\"key\"><![CDATA[value]]></attribute>\n" + "</collector-request>" } });
}
Also used : ServiceCollector(org.opennms.netmgt.collection.api.ServiceCollector) CollectionAgentDTO(org.opennms.netmgt.collection.dto.CollectionAgentDTO) Parameters(org.junit.runners.Parameterized.Parameters)

Example 18 with Parameters

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

the class CollectorResponseDTOTest method data.

@Parameters
public static Collection<Object[]> data() throws Exception {
    CollectionAgentDTO agent = new CollectionAgentDTO();
    CollectionSet collectionSet = new CollectionSetBuilder(agent).withTimestamp(new Date(0)).build();
    CollectorResponseDTO response = new CollectorResponseDTO(collectionSet);
    return Arrays.asList(new Object[][] { { response, "<collector-response>\n" + "   <collection-set status=\"SUCCEEDED\" timestamp=\"" + StringUtils.iso8601OffsetString(new Date(0), ZoneId.systemDefault(), ChronoUnit.SECONDS) + "\">\n" + "      <agent type=\"0\" node-id=\"0\" sys-up-time=\"0\"/>\n" + "   </collection-set>\n" + "</collector-response>" } });
}
Also used : CollectionSetBuilder(org.opennms.netmgt.collection.support.builder.CollectionSetBuilder) CollectionAgentDTO(org.opennms.netmgt.collection.dto.CollectionAgentDTO) Date(java.util.Date) CollectionSet(org.opennms.netmgt.collection.api.CollectionSet) Parameters(org.junit.runners.Parameterized.Parameters)

Example 19 with Parameters

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

the class AgentResponseCollectionTest method data.

@Parameters
public static Collection<Object[]> data() throws ParseException, UnknownHostException {
    final Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("options", "value");
    final String ipAddr = "127.0.0.1";
    // Instantiate the InetAddress like the InetAddressXmlAdapter does
    final InetAddress inetAddr = new IPAddress(ipAddr).toInetAddress();
    final AgentResponse response = new AgentResponse(inetAddr, 161, "SNMP", parameters);
    final AgentResponseCollection responses = new AgentResponseCollection(Arrays.asList(response));
    return Arrays.asList(new Object[][] { { responses, "<agents count=\"1\" totalCount=\"1\">" + "<agent>" + "    <address>" + ipAddr + "</address>" + "    <port>161</port>" + "    <serviceName>SNMP</serviceName>" + "    <parameters>" + "       <entry>" + "          <key>options</key>" + "          <value>value</value>" + "       </entry>" + "    </parameters>" + "</agent>" + "</agents>", null } });
}
Also used : HashMap(java.util.HashMap) IPAddress(org.opennms.core.network.IPAddress) InetAddress(java.net.InetAddress) Parameters(org.junit.runners.Parameterized.Parameters)

Example 20 with Parameters

use of org.junit.runners.Parameterized.Parameters in project pcgen by PCGen.

the class DataLoadTest method data.

/**
	 * Build the list of sources to be checked. Also initialises the plugins and 
	 * loads the game mode and campaign files.
	 */
@Parameters(name = "{1}")
public static Collection<Object[]> data() {
    // Set things up
    loadGameModes();
    SettingsHandler.setOutputDeprecationMessages(false);
    SettingsHandler.setInputUnconstructedMessages(false);
    PCGenSettings.OPTIONS_CONTEXT.setBoolean(PCGenSettings.OPTION_ALLOW_OVERRIDE_DUPLICATES, true);
    List<String> exclusions = Arrays.asList(excludedSources);
    List<SourceSelectionFacade> basicSources = getBasicSources();
    assertFalse("No sources found", basicSources.isEmpty());
    List<Object[]> params = new ArrayList<>();
    for (SourceSelectionFacade ssf : basicSources) {
        String testName = ssf.toString().replaceAll("[\\(\\)]", "_");
        if (!exclusions.contains(testName)) {
            params.add(new Object[] { ssf, testName });
        }
    }
    return params;
}
Also used : SourceSelectionFacade(pcgen.facade.core.SourceSelectionFacade) ArrayList(java.util.ArrayList) Parameters(org.junit.runners.Parameterized.Parameters)

Aggregations

Parameters (org.junit.runners.Parameterized.Parameters)70 ArrayList (java.util.ArrayList)41 File (java.io.File)20 TestCaseContext (org.apache.asterix.testframework.context.TestCaseContext)6 Date (java.util.Date)5 SslContext (io.netty.handler.ssl.SslContext)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 Field (java.lang.reflect.Field)2 BigInteger (java.math.BigInteger)2 GeneralSecurityException (java.security.GeneralSecurityException)2