use of org.apache.axis2.clustering.ClusteringCommand in project carbon-apimgt by wso2.
the class TenantLoadMessageSenderTest method testSendTenantRegistryLoadMessage.
@Test
public void testSendTenantRegistryLoadMessage() throws ClusteringFault {
ClusteringAgent clusteringAgent = PowerMockito.mock(ClusteringAgent.class);
ClusteringMessage request = new TenantLoadMessage(1, "a.com");
ClusteringCommand command = PowerMockito.mock(ClusteringCommand.class);
List<ClusteringCommand> commandList = new ArrayList<ClusteringCommand>();
commandList.add(command);
PowerMockito.when(clusteringAgent.sendMessage(request, true)).thenReturn(commandList);
tenantLoadMessageSender.sendTenantLoadMessage(clusteringAgent, 1, "a.com", 1);
}
use of org.apache.axis2.clustering.ClusteringCommand in project carbon-apimgt by wso2.
the class TenantLoadMessageSenderTest method testSendTenantRegistryLoadMessageFail.
@Test(expected = ClusteringFault.class)
public void testSendTenantRegistryLoadMessageFail() throws ClusteringFault {
ClusteringAgent clusteringAgent = PowerMockito.mock(ClusteringAgent.class);
ClusteringCommand command = PowerMockito.mock(ClusteringCommand.class);
List<ClusteringCommand> commandList = new ArrayList<ClusteringCommand>();
commandList.add(command);
ClusteringFault clusteringFault = PowerMockito.mock(ClusteringFault.class);
PowerMockito.when(clusteringAgent.sendMessage(Matchers.any(TenantLoadMessage.class), Matchers.anyBoolean())).thenThrow(clusteringFault);
tenantLoadMessageSender.sendTenantLoadMessage(clusteringAgent, 1, "a.com", 2);
}
Aggregations