本文整理汇总了Java中org.apache.axis2.engine.AxisConfiguration.setClusteringAgent方法的典型用法代码示例。如果您正苦于以下问题:Java AxisConfiguration.setClusteringAgent方法的具体用法?Java AxisConfiguration.setClusteringAgent怎么用?Java AxisConfiguration.setClusteringAgent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.engine.AxisConfiguration
的用法示例。
在下文中一共展示了AxisConfiguration.setClusteringAgent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMemberContextOperations
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
public final void testMemberContextOperations() throws Exception {
AxisConfiguration axisConfiguration = new AxisConfiguration();
axisConfiguration.setClusteringAgent(null);
ServiceReferenceHolder.getInstance().setDistributedObjectProvider(new HazelcastDistributedObjectProvider());
ServiceReferenceHolder.getInstance().setAxisConfiguration(axisConfiguration);
CloudControllerContext.unitTest = true;
CloudControllerContext cloudControllerContext = CloudControllerContext.getInstance();
Thread t1 = new Thread(new MemberAdder(cloudControllerContext));
t1.start();
t1.join();
assertEquals(2, cloudControllerContext.getMemberContextsOfClusterId("cluster-1").size());
Thread t2 = new Thread(new MemberRemover(cloudControllerContext));
t2.start();
t2.join();
assertEquals(1, cloudControllerContext.getMemberContextsOfClusterId("cluster-1").size());
}
示例2: testUpdateKubCluster
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
public void testUpdateKubCluster() throws Exception {
KubernetesMaster km1 = new KubernetesMaster();
km1.setPrivateIPAddress(MASTER_IP_1);
KubernetesCluster cluster = new KubernetesCluster();
cluster.setClusterId(CLUSTER_ID);
cluster.setKubernetesMaster(km1);
AxisConfiguration axisConfiguration = new AxisConfiguration();
axisConfiguration.setClusteringAgent(null);
ServiceReferenceHolder.getInstance().setDistributedObjectProvider(new HazelcastDistributedObjectProvider());
ServiceReferenceHolder.getInstance().setAxisConfiguration(axisConfiguration);
CloudControllerContext.unitTest = true;
CloudControllerContext ctx = CloudControllerContext.getInstance();
assertNotNull(ctx);
ctx.addKubernetesCluster(cluster);
KubernetesClusterContext kubClusterContext = new KubernetesClusterContext(CLUSTER_ID, MASTER_IP_1, MASTER_PORT, LOWER_PORT, UPPER_PORT);
CloudControllerContext.getInstance().addKubernetesClusterContext(kubClusterContext);
KubernetesMaster km2 = new KubernetesMaster();
km2.setPrivateIPAddress(MASTER_IP_2);
KubernetesCluster newCluster = new KubernetesCluster();
newCluster.setClusterId(CLUSTER_ID);
newCluster.setKubernetesMaster(km2);
// Get cluster context and update
CloudControllerContext.getInstance().updateKubernetesCluster(newCluster);
KubernetesClusterContext kubClusterContextUpdated = CloudControllerContext.getInstance().getKubernetesClusterContext(CLUSTER_ID);
// Update necessary parameters of kubClusterContext using the updated kubCluster
kubClusterContextUpdated.updateKubClusterContextParams(newCluster);
CloudControllerContext.getInstance().updateKubernetesClusterContext(kubClusterContext);
// Get updated values and assert
assertEquals("testhostname2" , CloudControllerContext.getInstance().getKubernetesClusterContext(CLUSTER_ID).getMasterIp());
assertNotSame("testhostname1" , CloudControllerContext.getInstance().getKubernetesClusterContext(CLUSTER_ID).getMasterIp());
}