use of com.hp.octane.integrations.OctaneConfigurationIntern in project octane-ci-java-sdk by MicroFocus.
the class SSCIntegrationTest method runAsQueueItem.
public void runAsQueueItem() {
try {
//
// I
// add one client and verify it works okay
//
OctaneConfiguration configA = new OctaneConfigurationIntern(clientAInstanceId, OctaneSPEndpointSimulator.getSimulatorUrl(), spIdA);
OctaneClient clientA = OctaneSDK.addClient(configA, VulnerabilitiesServicePluginServicesTest.class);
VulnerabilitiesService vulnerabilitiesServiceA = clientA.getVulnerabilitiesService();
vulnerabilitiesServiceA.enqueueRetrieveAndPushVulnerabilities("jobSSC1", "1", ToolType.SSC, System.currentTimeMillis(), 1, null, null);
if (expectedOutput.expectNoPsuh) {
CIPluginSDKUtils.doWait(2000);
} else {
GeneralTestUtils.waitAtMostFor(12000, () -> {
if (pushVulnerabilitiesCollectors.get(spIdA) != null && pushVulnerabilitiesCollectors.get(spIdA).size() == 1) {
return true;
} else {
return null;
}
});
}
Assert.assertEquals(clientAInstanceId + "|jobSSC1|1", preFlightRequestCollectors.get(spIdA).get(0));
//
// III
// remove one client and verify it is shut indeed and the second continue to work okay
//
OctaneSDK.removeClient(clientA);
} finally {
// remove clients
OctaneSDK.getClients().forEach(OctaneSDK::removeClient);
// remove simulators
if (simulators != null)
removeSPEPSimulators(simulators.values());
}
}
use of com.hp.octane.integrations.OctaneConfigurationIntern in project octane-ci-java-sdk by MicroFocus.
the class VulnerabilitiesServiceFunctionalityTest method testVulnerabilitiesFunctional.
@Test(timeout = 20000)
public void testVulnerabilitiesFunctional() {
Map<String, OctaneSPEndpointSimulator> simulators = null;
try {
String spIdA = UUID.randomUUID().toString();
String spIdB = UUID.randomUUID().toString();
String clientAInstanceId = UUID.randomUUID().toString();
String clientBInstanceId = UUID.randomUUID().toString();
Map<String, List<String>> preflightRequestCollectors = new LinkedHashMap<>();
Map<String, List<String>> pushVulnerabilitiesCollectors = new LinkedHashMap<>();
// init 2 shared space endpoints simulators
simulators = initSPEPSimulators(Stream.of(spIdA, spIdB).collect(Collectors.toSet()), preflightRequestCollectors, pushVulnerabilitiesCollectors);
//
// I
// add one client and verify it works okay
//
OctaneConfiguration configA = new OctaneConfigurationIntern(clientAInstanceId, OctaneSPEndpointSimulator.getSimulatorUrl(), spIdA);
OctaneClient clientA = OctaneSDK.addClient(configA, VulnerabilitiesServicePluginServicesTest.class);
VulnerabilitiesService vulnerabilitiesServiceA = clientA.getVulnerabilitiesService();
Assert.assertFalse(preflightRequestCollectors.containsKey(spIdA));
Assert.assertFalse(preflightRequestCollectors.containsKey(spIdB));
//
// II
// add one more client and verify they are both works okay
//
OctaneConfiguration configB = new OctaneConfigurationIntern(clientBInstanceId, OctaneSPEndpointSimulator.getSimulatorUrl(), spIdB);
OctaneClient clientB = OctaneSDK.addClient(configB, VulnerabilitiesServicePluginServicesTest.class);
VulnerabilitiesService vulnerabilitiesServiceB = clientB.getVulnerabilitiesService();
vulnerabilitiesServiceA.enqueueRetrieveAndPushVulnerabilities("job-preflight-true", "1", ToolType.SSC, System.currentTimeMillis(), 1, null, null);
vulnerabilitiesServiceA.enqueueRetrieveAndPushVulnerabilities("job-preflight-false", "1", ToolType.SSC, System.currentTimeMillis(), 1, null, null);
vulnerabilitiesServiceB.enqueueRetrieveAndPushVulnerabilities("job-preflight-true", "1", ToolType.SSC, System.currentTimeMillis(), 1, null, null);
vulnerabilitiesServiceB.enqueueRetrieveAndPushVulnerabilities("job-preflight-false", "1", ToolType.SSC, System.currentTimeMillis(), 1, null, null);
GeneralTestUtils.waitAtMostFor(12000, () -> {
if (preflightRequestCollectors.get(spIdA) != null && preflightRequestCollectors.get(spIdA).size() == 2 && preflightRequestCollectors.get(spIdB) != null && preflightRequestCollectors.get(spIdB).size() == 2) {
return true;
} else {
return null;
}
});
Assert.assertEquals(clientAInstanceId + "|job-preflight-true|1", preflightRequestCollectors.get(spIdA).get(0));
Assert.assertEquals(clientAInstanceId + "|job-preflight-false|1", preflightRequestCollectors.get(spIdA).get(1));
Assert.assertEquals(clientBInstanceId + "|job-preflight-true|1", preflightRequestCollectors.get(spIdB).get(0));
Assert.assertEquals(clientBInstanceId + "|job-preflight-false|1", preflightRequestCollectors.get(spIdB).get(1));
//
// III
// remove one client and verify it is shut indeed and the second continue to work okay
//
OctaneSDK.removeClient(clientA);
//
// IV
// remove second client and ensure no interactions anymore
//
OctaneSDK.removeClient(clientB);
} finally {
// remove clients
OctaneSDK.getClients().forEach(OctaneSDK::removeClient);
// remove simulators
if (simulators != null)
removeSPEPSimulators(simulators.values());
SSCServerSimulator.instance().endSimulation();
}
}
use of com.hp.octane.integrations.OctaneConfigurationIntern in project octane-ci-java-sdk by MicroFocus.
the class VulnerabilitiesServiceFunctionalityTest method testVulnerabilitiesFunctionalSSC.
@Test(timeout = 20000)
public void testVulnerabilitiesFunctionalSSC() {
Map<String, OctaneSPEndpointSimulator> simulators = null;
try {
String spIdA = UUID.randomUUID().toString();
String clientAInstanceId = UUID.randomUUID().toString();
Map<String, List<String>> preflightRequestCollectors = new LinkedHashMap<>();
Map<String, List<String>> pushVulnerabilitiesCollectors = new LinkedHashMap<>();
simulators = initSPEPSimulatorsForSSC(Stream.of(spIdA).collect(Collectors.toSet()), preflightRequestCollectors, pushVulnerabilitiesCollectors);
//
// I
// add one client and verify it works okay
//
OctaneConfiguration configA = new OctaneConfigurationIntern(clientAInstanceId, OctaneSPEndpointSimulator.getSimulatorUrl(), spIdA);
OctaneClient clientA = OctaneSDK.addClient(configA, VulnerabilitiesServicePluginServicesTest.class);
VulnerabilitiesService vulnerabilitiesServiceA = clientA.getVulnerabilitiesService();
prepareSSCSimulator();
vulnerabilitiesServiceA.enqueueRetrieveAndPushVulnerabilities("jobSSC1", "1", ToolType.SSC, System.currentTimeMillis(), 1, null, null);
GeneralTestUtils.waitAtMostFor(12000, () -> {
if (preflightRequestCollectors.get(spIdA) != null && preflightRequestCollectors.get(spIdA).size() == 1) {
return true;
} else {
return null;
}
});
Assert.assertEquals(clientAInstanceId + "|jobSSC1|1", preflightRequestCollectors.get(spIdA).get(0));
OctaneSDK.removeClient(clientA);
} finally {
// remove clients
OctaneSDK.getClients().forEach(OctaneSDK::removeClient);
// remove simulators
if (simulators != null)
removeSPEPSimulators(simulators.values());
SSCServerSimulator.instance().endSimulation();
}
}
use of com.hp.octane.integrations.OctaneConfigurationIntern in project octane-ci-java-sdk by MicroFocus.
the class TaskingServiceTests method setupClient.
@BeforeClass
public static void setupClient() {
String inId = UUID.randomUUID().toString();
String sspId = UUID.randomUUID().toString();
OctaneConfiguration configuration = new OctaneConfigurationIntern(inId, OctaneSPEndpointSimulator.getSimulatorUrl(), sspId);
client = OctaneSDK.addClient(configuration, TaskingTestPluginServicesTest.class);
}
use of com.hp.octane.integrations.OctaneConfigurationIntern in project octane-ci-java-sdk by MicroFocus.
the class TaskingServiceE2ETests method setupEnvironment.
@BeforeClass
public static void setupEnvironment() {
// setup Octane simulator
OctaneSPEndpointSimulator octaneSPEndpointSimulator = setupOctaneEPSimulator(sspId);
Assert.assertNotNull(octaneSPEndpointSimulator);
// setup Octane client
OctaneConfiguration configuration = new OctaneConfigurationIntern(inId, OctaneSPEndpointSimulator.getSimulatorUrl(), sspId);
client = OctaneSDK.addClient(configuration, TaskingTestPluginServicesTest.class);
}
Aggregations