Search in sources :

Example 1 with IfProfileValue

use of org.springframework.test.annotation.IfProfileValue in project opennms by OpenNMS.

the class IcmpDetectorTest method testDetectorSuccess.

@Test(timeout = 20000)
@IfProfileValue(name = "runPingTests", value = "true")
public void testDetectorSuccess() throws Exception {
    getPingerFactory().setInstance(0, true, new JnaPinger());
    m_icmpDetector = m_detectorFactory.createDetector();
    assertTrue("ICMP could not be detected on localhost", m_icmpDetector.isServiceDetected(InetAddress.getLocalHost()));
}
Also used : JnaPinger(org.opennms.netmgt.icmp.jna.JnaPinger) Test(org.junit.Test) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Example 2 with IfProfileValue

use of org.springframework.test.annotation.IfProfileValue in project opennms by OpenNMS.

the class IcmpDetectorTest method testDetectorFailJni.

@Test(timeout = 20000)
@IfProfileValue(name = "runPingTests", value = "true")
public void testDetectorFailJni() throws Exception {
    getPingerFactory().setInstance(0, true, new JniPinger());
    m_icmpDetector = m_detectorFactory.createDetector();
    assertFalse("ICMP was incorrectly identified on " + InetAddressUtils.UNPINGABLE_ADDRESS.getHostAddress(), m_icmpDetector.isServiceDetected(InetAddressUtils.UNPINGABLE_ADDRESS));
}
Also used : JniPinger(org.opennms.netmgt.icmp.jni.JniPinger) Test(org.junit.Test) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Example 3 with IfProfileValue

use of org.springframework.test.annotation.IfProfileValue in project opennms by OpenNMS.

the class IcmpDetectorTest method testDetectorSuccessJni.

@Test(timeout = 20000)
@IfProfileValue(name = "runPingTests", value = "true")
public void testDetectorSuccessJni() throws Exception {
    getPingerFactory().setInstance(0, true, new JniPinger());
    m_icmpDetector = m_detectorFactory.createDetector();
    assertTrue("ICMP could not be detected on localhost", m_icmpDetector.isServiceDetected(InetAddress.getLocalHost()));
}
Also used : JniPinger(org.opennms.netmgt.icmp.jni.JniPinger) Test(org.junit.Test) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Example 4 with IfProfileValue

use of org.springframework.test.annotation.IfProfileValue in project perun by CESNET.

the class SchedulingPoolTest method addToPoolTest.

@IfProfileValue(name = "perun.test.groups", values = ("unit-tests"))
@Test
public void addToPoolTest() throws InternalErrorException {
    System.out.println("SchedulingPool.addToPool()");
    Assert.isTrue(schedulingPool.getSize() == 1, "original size is 1");
    schedulingPool.addToPool(task1, dispatcherQueue);
    // pool already contains this task
    Assert.isTrue(schedulingPool.getSize() == 1, "new size is 1");
    task2 = new Task();
    task2.setId(2);
    task2.setExecService(execservice2);
    task2.setFacility(facility1);
    task2.setDestinations(destinations);
    task2.setSchedule(new Date(System.currentTimeMillis()));
    schedulingPool.addToPool(task2, dispatcherQueue);
    Assert.isTrue(schedulingPool.getSize() == 2, "new size is 2");
}
Also used : Task(cz.metacentrum.perun.taskslib.model.Task) Date(java.util.Date) AbstractDispatcherTest(cz.metacentrum.perun.dispatcher.AbstractDispatcherTest) Test(org.junit.Test) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Example 5 with IfProfileValue

use of org.springframework.test.annotation.IfProfileValue in project perun by CESNET.

the class SchedulingPoolTest method getTaskByIdTest.

@IfProfileValue(name = "perun.test.groups", values = ("unit-tests"))
@Test
public void getTaskByIdTest() {
    System.out.println("SchedulingPool.getTaskById()");
    Task task = schedulingPool.getTaskById(task1.getId());
    Assert.isTrue(task == task1);
}
Also used : Task(cz.metacentrum.perun.taskslib.model.Task) AbstractDispatcherTest(cz.metacentrum.perun.dispatcher.AbstractDispatcherTest) Test(org.junit.Test) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Aggregations

Test (org.junit.Test)8 IfProfileValue (org.springframework.test.annotation.IfProfileValue)8 JnaPinger (org.opennms.netmgt.icmp.jna.JnaPinger)3 JniPinger (org.opennms.netmgt.icmp.jni.JniPinger)3 AbstractDispatcherTest (cz.metacentrum.perun.dispatcher.AbstractDispatcherTest)2 Task (cz.metacentrum.perun.taskslib.model.Task)2 Date (java.util.Date)1