Search in sources :

Example 1 with LocationAwareRequisitionClient

use of org.opennms.netmgt.provision.persist.LocationAwareRequisitionClient in project opennms by OpenNMS.

the class RequisitionUrlConnectionTest method canRetrieveRequisition.

@Test
public void canRetrieveRequisition() throws Exception {
    Requisition expectedRequisition = new Requisition();
    LocationAwareRequisitionClient client = mock(LocationAwareRequisitionClient.class, RETURNS_DEEP_STUBS);
    when(client.requisition().withRequisitionProviderType("test").withParameters(any()).execute().get()).thenReturn(expectedRequisition);
    try {
        RequisitionUrlConnection.setClient(client);
        final String requisitionAsStr = urlToString("requisition://test/");
        Requisition actualRequisition = JaxbUtils.unmarshal(Requisition.class, requisitionAsStr);
        assertEquals(expectedRequisition, actualRequisition);
    } finally {
        RequisitionUrlConnection.setClient(null);
    }
}
Also used : LocationAwareRequisitionClient(org.opennms.netmgt.provision.persist.LocationAwareRequisitionClient) Requisition(org.opennms.netmgt.provision.persist.requisition.Requisition) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 LocationAwareRequisitionClient (org.opennms.netmgt.provision.persist.LocationAwareRequisitionClient)1 Requisition (org.opennms.netmgt.provision.persist.requisition.Requisition)1