Search in sources :

Example 1 with SequenceAdmin

use of org.wso2.carbon.sequences.services.SequenceAdmin in project carbon-apimgt by wso2.

the class SequenceAdminServiceProxyTestCase method testGetSequence.

@Test
public void testGetSequence() {
    SequenceAdminServiceProxy sequenceAdminServiceProxy = null;
    try {
        sequenceAdminServiceProxy = new SequenceAdminServiceProxy("abc.com");
        SequenceAdmin sequenceAdmin = Mockito.mock(SequenceAdmin.class);
        OMElement omElement = Mockito.mock(OMElement.class);
        Mockito.when(sequenceAdmin.getSequenceForTenant("xyz", "abc.com")).thenReturn(omElement);
        sequenceAdminServiceProxy.setSequenceAdmin(sequenceAdmin);
    } catch (Exception e) {
        fail("Exception while testing getSequence");
    }
    try {
        Assert.assertNotNull(sequenceAdminServiceProxy.getSequence("xyz"));
    } catch (AxisFault axisFault) {
        fail("AxisFault while testing getSequence");
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) SequenceAdmin(org.wso2.carbon.sequences.services.SequenceAdmin) OMElement(org.apache.axiom.om.OMElement) Test(org.junit.Test)

Example 2 with SequenceAdmin

use of org.wso2.carbon.sequences.services.SequenceAdmin in project carbon-apimgt by wso2.

the class SequenceAdminServiceProxyTestCase method testIsExsistingSequence.

@Test
public void testIsExsistingSequence() {
    SequenceAdminServiceProxy sequenceAdminServiceProxy = null;
    try {
        sequenceAdminServiceProxy = new SequenceAdminServiceProxy("abc.com");
        SequenceAdmin sequenceAdmin = Mockito.mock(SequenceAdmin.class);
        Mockito.when(sequenceAdmin.isExistingSequence("xyz")).thenReturn(true);
        Mockito.when(sequenceAdmin.isExistingSequenceForTenant("xyz", "abc.com")).thenReturn(true);
        sequenceAdminServiceProxy.setSequenceAdmin(sequenceAdmin);
    } catch (Exception axisFault) {
    // test for axisFault
    }
    try {
        Assert.assertTrue(sequenceAdminServiceProxy.isExistingSequence("xyz"));
    } catch (AxisFault axisFault) {
        fail("AxisFault while testing getSequence");
    }
    try {
        Assert.assertTrue(sequenceAdminServiceProxy.isExistingSequence("xyz"));
    } catch (AxisFault axisFault) {
        fail("AxisFault while testing getSequenceForTenant");
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) SequenceAdmin(org.wso2.carbon.sequences.services.SequenceAdmin) Test(org.junit.Test)

Example 3 with SequenceAdmin

use of org.wso2.carbon.sequences.services.SequenceAdmin in project carbon-apimgt by wso2.

the class SequenceAdminServiceProxyTestCase method testDeleteSequence.

@Test
public void testDeleteSequence() {
    SequenceAdminServiceProxy sequenceAdminServiceProxy = null;
    try {
        sequenceAdminServiceProxy = new SequenceAdminServiceProxy("abc.com");
        SequenceAdmin sequenceAdmin = Mockito.mock(SequenceAdmin.class);
        Mockito.doNothing().when(sequenceAdmin).deleteSequence("xyz");
        sequenceAdminServiceProxy.setSequenceAdmin(sequenceAdmin);
    } catch (Exception e) {
        fail("Exception while testing deleteSequence");
    }
    try {
        sequenceAdminServiceProxy.deleteSequence("xyz");
    } catch (AxisFault axisFault) {
        fail("AxisFault while testing deleteSequence");
    }
    try {
        sequenceAdminServiceProxy.deleteSequence("xyz");
    } catch (AxisFault axisFault) {
        fail("AxisFault while testing deleteSequenceForTenant");
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) SequenceAdmin(org.wso2.carbon.sequences.services.SequenceAdmin) Test(org.junit.Test)

Example 4 with SequenceAdmin

use of org.wso2.carbon.sequences.services.SequenceAdmin in project carbon-apimgt by wso2.

the class SequenceAdminServiceProxyTestCase method testAddSequence.

@Test
public void testAddSequence() {
    SequenceAdminServiceProxy sequenceAdminServiceProxy = null;
    try {
        sequenceAdminServiceProxy = new SequenceAdminServiceProxy("abc.com");
        SequenceAdmin sequenceAdmin = Mockito.mock(SequenceAdmin.class);
        Mockito.doNothing().when(sequenceAdmin).addSequence(omElement);
        sequenceAdminServiceProxy.setSequenceAdmin(sequenceAdmin);
    } catch (Exception e) {
        fail("Exception while testing addSequence");
    }
    try {
        sequenceAdminServiceProxy.addSequence(omElement);
    } catch (AxisFault e) {
        fail("AxisFault while testing addSequence");
    }
    try {
        sequenceAdminServiceProxy.addSequence(omElement);
    } catch (AxisFault axisFault) {
        fail("AxisFault while testing addSequenceForTenant");
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) SequenceAdmin(org.wso2.carbon.sequences.services.SequenceAdmin) Test(org.junit.Test)

Aggregations

AxisFault (org.apache.axis2.AxisFault)4 Test (org.junit.Test)4 SequenceAdmin (org.wso2.carbon.sequences.services.SequenceAdmin)4 OMElement (org.apache.axiom.om.OMElement)1