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