Search in sources :

Example 1 with OBStrategy

use of com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.ob.OBStrategy in project dal by ctripcorp.

the class MultiHostClusterPropertiesAdapterTest method getRouteStrategy.

@Test
public void getRouteStrategy() {
    clusterPropertiesAdapter = new MultiHostClusterPropertiesAdapter(mgrRouteStrategyConfig, CLUSTER_NAME);
    String routeStrategy = clusterPropertiesAdapter.routeStrategyName();
    Assert.assertEquals(RouteStrategyEnum.WRITE_ORDERED.name(), routeStrategy);
    RouteStrategy multiHostStrategy = clusterPropertiesAdapter.generate();
    Assert.assertTrue(multiHostStrategy instanceof MGRStrategy);
    clusterPropertiesAdapter = new MultiHostClusterPropertiesAdapter(obRouteStrategyConfig, CLUSTER_NAME);
    routeStrategy = clusterPropertiesAdapter.routeStrategyName();
    Assert.assertEquals(RouteStrategyEnum.WRITE_CURRENT_ZONE_FIRST.getAlias(), routeStrategy);
    multiHostStrategy = clusterPropertiesAdapter.generate();
    Assert.assertTrue(multiHostStrategy instanceof OBStrategy);
    clusterPropertiesAdapter = new MultiHostClusterPropertiesAdapter(mgrRouteStrategyConfig, CLUSTER_NAME);
}
Also used : MGRStrategy(com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.mgr.MGRStrategy) RouteStrategy(com.ctrip.platform.dal.dao.datasource.cluster.strategy.RouteStrategy) OBStrategy(com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.ob.OBStrategy) Test(org.junit.Test)

Aggregations

RouteStrategy (com.ctrip.platform.dal.dao.datasource.cluster.strategy.RouteStrategy)1 MGRStrategy (com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.mgr.MGRStrategy)1 OBStrategy (com.ctrip.platform.dal.dao.datasource.cluster.strategy.multi.ob.OBStrategy)1 Test (org.junit.Test)1