Search in sources :

Example 1 with KeeperTransMeta

use of com.ctrip.xpipe.redis.core.entity.KeeperTransMeta in project x-pipe by ctripcorp.

the class DeleteKeeperCommandTest method beforeDeleteKeeperCommandTest.

@Before
public void beforeDeleteKeeperCommandTest() {
    keeperMeta = new KeeperMeta();
    keeperMeta.setIp("localhost");
    keeperMeta.setPort(randomPort());
    deleteKeeperCommand = new DeleteKeeperCommand(keeperContainerService, new KeeperTransMeta(clusterId, shardId, keeperMeta), scheduled, timeoutMilli, checkIntervalMili);
}
Also used : KeeperTransMeta(com.ctrip.xpipe.redis.core.entity.KeeperTransMeta) KeeperMeta(com.ctrip.xpipe.redis.core.entity.KeeperMeta) Before(org.junit.Before)

Example 2 with KeeperTransMeta

use of com.ctrip.xpipe.redis.core.entity.KeeperTransMeta in project x-pipe by ctripcorp.

the class DefaultKeeperStateControllerTest method testAdd.

@Test
public void testAdd() {
    Assert.assertFalse(addCommand.isBeginExecute());
    defaultKeeperStateController.addKeeper(new KeeperTransMeta(getClusterId(), getShardId(), new KeeperMeta()));
    sleep(10);
    Assert.assertTrue(addCommand.isBeginExecute());
}
Also used : KeeperTransMeta(com.ctrip.xpipe.redis.core.entity.KeeperTransMeta) KeeperMeta(com.ctrip.xpipe.redis.core.entity.KeeperMeta) Test(org.junit.Test) AbstractMetaServerTest(com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest)

Example 3 with KeeperTransMeta

use of com.ctrip.xpipe.redis.core.entity.KeeperTransMeta in project x-pipe by ctripcorp.

the class DefaultKeeperStateControllerTest method testDelete.

@Test
public void testDelete() throws TimeoutException {
    Assert.assertFalse(deleteCommand.isBeginExecute());
    defaultKeeperStateController.removeKeeper(new KeeperTransMeta(getClusterId(), getShardId(), new KeeperMeta()));
    waitConditionUntilTimeOut(() -> deleteCommand.isBeginExecute(), 1000);
}
Also used : KeeperTransMeta(com.ctrip.xpipe.redis.core.entity.KeeperTransMeta) KeeperMeta(com.ctrip.xpipe.redis.core.entity.KeeperMeta) Test(org.junit.Test) AbstractMetaServerTest(com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest)

Example 4 with KeeperTransMeta

use of com.ctrip.xpipe.redis.core.entity.KeeperTransMeta in project x-pipe by ctripcorp.

the class AddKeeperCommandTest method beforeAddKeeperCommandTest.

@Before
public void beforeAddKeeperCommandTest() {
    KeeperMeta keeperMeta = new KeeperMeta();
    keeperMeta.setPort(keeperPort);
    keeperMeta.setIp("localhost");
    keeperTransMeta = new KeeperTransMeta("clusterId", "shardId", keeperMeta);
    addKeeperCommand = new AddKeeperCommand(keeperContainerService, keeperTransMeta, scheduled, timeoutMilli, checkInterval);
}
Also used : KeeperTransMeta(com.ctrip.xpipe.redis.core.entity.KeeperTransMeta) KeeperMeta(com.ctrip.xpipe.redis.core.entity.KeeperMeta) Before(org.junit.Before)

Example 5 with KeeperTransMeta

use of com.ctrip.xpipe.redis.core.entity.KeeperTransMeta in project x-pipe by ctripcorp.

the class KeeperContainerServiceTest method setUp.

@Before
public void setUp() throws Exception {
    keeperContainerService = new KeeperContainerService();
    ReflectionTestUtils.setField(keeperContainerService, "leaderElectorManager", leaderElectorManager);
    ReflectionTestUtils.setField(keeperContainerService, "metaService", metaService);
    ReflectionTestUtils.setField(keeperContainerService, "leaderElectorManager", leaderElectorManager);
    ReflectionTestUtils.setField(keeperContainerService, "keeperContainerConfig", keeperContainerConfig);
    ReflectionTestUtils.setField(keeperContainerService, "keeperConfig", keeperConfig);
    ReflectionTestUtils.setField(keeperContainerService, "keepersMonitorManager", keepersMonitorManager);
    someCluster = "someCluster";
    someShard = "someShard";
    somePort = 6789;
    someKeeperMeta = new KeeperMeta();
    someKeeperMeta.setPort(somePort);
    someKeeperTransMeta = new KeeperTransMeta();
    someKeeperTransMeta.setClusterId(someCluster);
    someKeeperTransMeta.setShardId(someShard);
    someKeeperTransMeta.setKeeperMeta(someKeeperMeta);
    when(keeperContainerConfig.getReplicationStoreDir()).thenReturn(System.getProperty("user.dir"));
    ReflectionTestUtils.setField(ComponentRegistryHolder.class, "componentRegistry", componentRegistry);
}
Also used : KeeperTransMeta(com.ctrip.xpipe.redis.core.entity.KeeperTransMeta) KeeperMeta(com.ctrip.xpipe.redis.core.entity.KeeperMeta) Before(org.junit.Before)

Aggregations

KeeperMeta (com.ctrip.xpipe.redis.core.entity.KeeperMeta)6 KeeperTransMeta (com.ctrip.xpipe.redis.core.entity.KeeperTransMeta)6 Before (org.junit.Before)3 Test (org.junit.Test)3 AbstractMetaServerTest (com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest)2