Search in sources :

Example 6 with ClusteringFault

use of org.apache.axis2.clustering.ClusteringFault 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);
}
Also used : ClusteringCommand(org.apache.axis2.clustering.ClusteringCommand) ArrayList(java.util.ArrayList) ClusteringAgent(org.apache.axis2.clustering.ClusteringAgent) TenantLoadMessage(org.wso2.carbon.apimgt.impl.message.clustering.TenantLoadMessage) ClusteringFault(org.apache.axis2.clustering.ClusteringFault) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 7 with ClusteringFault

use of org.apache.axis2.clustering.ClusteringFault in project carbon-apimgt by wso2.

the class TenantLoadMessageTest method testExecuteMessage.

@Test
public void testExecuteMessage() throws ClusteringFault {
    System.setProperty(APIConstants.ENABLE_TENANT_LOAD_NOTIFICATION, "true");
    PowerMockito.mockStatic(APIUtil.class);
    PowerMockito.doNothing().when(APIUtil.class);
    tenantLoadMessage.execute(new ConfigurationContext(new AxisConfiguration()));
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 8 with ClusteringFault

use of org.apache.axis2.clustering.ClusteringFault in project carbon-apimgt by wso2.

the class TenantLoadMessageTest method testExecuteMessageWhenDisabled.

@Test
public void testExecuteMessageWhenDisabled() throws ClusteringFault {
    System.setProperty(APIConstants.ENABLE_TENANT_LOAD_NOTIFICATION, "false");
    tenantLoadMessage.execute(new ConfigurationContext(new AxisConfiguration()));
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

ClusteringFault (org.apache.axis2.clustering.ClusteringFault)5 Test (org.junit.Test)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 ClusteringAgent (org.apache.axis2.clustering.ClusteringAgent)3 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)3 TenantLoadMessage (org.wso2.carbon.apimgt.impl.message.clustering.TenantLoadMessage)3 ArrayList (java.util.ArrayList)2 ClusteringCommand (org.apache.axis2.clustering.ClusteringCommand)2 ClusteringMessage (org.apache.axis2.clustering.ClusteringMessage)2 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)2 ThrottleDataHolder (org.apache.synapse.commons.throttle.core.ThrottleDataHolder)2 AccessInformation (org.apache.synapse.commons.throttle.core.AccessInformation)1 ConcurrentAccessController (org.apache.synapse.commons.throttle.core.ConcurrentAccessController)1 ThrottleConfiguration (org.apache.synapse.commons.throttle.core.ThrottleConfiguration)1 ThrottleContext (org.apache.synapse.commons.throttle.core.ThrottleContext)1 ThrottleException (org.apache.synapse.commons.throttle.core.ThrottleException)1 Axis2MessageContext (org.apache.synapse.core.axis2.Axis2MessageContext)1 AuthenticationContext (org.wso2.carbon.apimgt.gateway.handlers.security.AuthenticationContext)1 VerbInfoDTO (org.wso2.carbon.apimgt.impl.dto.VerbInfoDTO)1