org.apache.curator.framework.imps.CuratorFrameworkImpl Java Examples

The following examples show how to use org.apache.curator.framework.imps.CuratorFrameworkImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClusterSyncManagerTest.java    From Decision with Apache License 2.0 5 votes vote down vote up
@Before
public  void setUp() throws Exception {

    configurationContext = mock(ConfigurationContext.class);
    when(configurationContext.getZookeeperHostsQuorum()).thenReturn("localhost:2181");
    when(configurationContext.isClusteringEnabled()).thenReturn(true);

    ArrayList clusterGroups = new ArrayList<>();
    clusterGroups.add("group1");
    clusterGroups.add("group2");
    when(configurationContext.getClusterGroups()).thenReturn(clusterGroups);
    when(configurationContext.getGroupId()).thenReturn("group1");
    when(configurationContext.isAllAckEnabled()).thenReturn(false);
    when(configurationContext.getAckTimeout()).thenReturn(500);

    curatorFramework = mock(CuratorFrameworkImpl.class, Mockito.RETURNS_DEEP_STUBS);

    zkUtils = mock(ZKUtils.class);
    failOverTask = mock(FailOverTask.class);
    clusterBarrierManager = mock(ClusterBarrierManager.class);

    message = mock(StratioStreamingMessage.class);
    when(message.getRequest_id()).thenReturn("111");
    when(message.getOperation()).thenReturn("create");

    nodeReply = mock(ActionCallbackDto.class);
    when(nodeReply.getErrorCode()).thenReturn(ReplyCode.OK.getCode());
    when(nodeReply.getDescription()).thenReturn(ReplyCode.OK.getMessage());

   clusterSyncManager = new ClusterSyncManager(STREAMING.ZK_CLUSTER_MANAGER_PATH, "id",
            configurationContext, failOverTask,curatorFramework, zkUtils, clusterBarrierManager);

}
 
Example #2
Source File: AsyncCuratorFrameworkImpl.java    From curator with Apache License 2.0 5 votes vote down vote up
private static CuratorFrameworkImpl reveal(CuratorFramework client)
{
    try
    {
        return (CuratorFrameworkImpl)Objects.requireNonNull(client, "client cannot be null");
    }
    catch ( Exception e )
    {
        throw new IllegalArgumentException("Only Curator clients created through CuratorFrameworkFactory are supported: " + client.getClass().getName());
    }
}
 
Example #3
Source File: AsyncCuratorFrameworkImpl.java    From curator with Apache License 2.0 5 votes vote down vote up
public AsyncCuratorFrameworkImpl(CuratorFrameworkImpl client, Filters filters, WatchMode watchMode, boolean watched)
{
    this.client = Objects.requireNonNull(client, "client cannot be null");
    this.filters = Objects.requireNonNull(filters, "filters cannot be null");
    this.watchMode = Objects.requireNonNull(watchMode, "watchMode cannot be null");
    this.watched = watched;
}
 
Example #4
Source File: AsyncCreateBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncCreateBuilderImpl(CuratorFrameworkImpl client, Filters filters)
{
    this.client = client;
    this.filters = filters;
}
 
Example #5
Source File: ClusterBarrierManagerTest.java    From Decision with Apache License 2.0 4 votes vote down vote up
@Before
public  void setUp() throws Exception {

    curatorFramework = mock(CuratorFrameworkImpl.class, Mockito.RETURNS_DEEP_STUBS);
}
 
Example #6
Source File: AsyncGetConfigBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncGetConfigBuilderImpl(CuratorFrameworkImpl client, Filters filters, WatchMode watchMode)
{
    this.client = client;
    this.filters = filters;
    this.watchMode = watchMode;
}
 
Example #7
Source File: AsyncSetDataBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncSetDataBuilderImpl(CuratorFrameworkImpl client, Filters filters)
{
    this.client = client;
    this.filters = filters;
}
 
Example #8
Source File: AsyncWatchBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncWatchBuilderImpl(CuratorFrameworkImpl client, Filters filters)
{
    this.client = client;
    this.filters = filters;
    watching = new Watching(client, true);
}
 
Example #9
Source File: AsyncRemoveWatchesBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncRemoveWatchesBuilderImpl(CuratorFrameworkImpl client, Filters filters)
{
    this.client = client;
    this.filters = filters;
}
 
Example #10
Source File: AsyncGetDataBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncGetDataBuilderImpl(CuratorFrameworkImpl client, Filters filters, WatchMode watchMode)
{
    this.client = client;
    this.filters = filters;
    this.watchMode = watchMode;
}
 
Example #11
Source File: AsyncExistsBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncExistsBuilderImpl(CuratorFrameworkImpl client, Filters filters, WatchMode watchMode)
{
    this.client = client;
    this.filters = filters;
    this.watchMode = watchMode;
}
 
Example #12
Source File: AsyncDeleteBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncDeleteBuilderImpl(CuratorFrameworkImpl client, Filters filters)
{
    this.client = client;
    this.filters = filters;
}
 
Example #13
Source File: AsyncCuratorFrameworkImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
CuratorFrameworkImpl getClient()
{
    return client;
}
 
Example #14
Source File: AsyncSetACLBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncSetACLBuilderImpl(CuratorFrameworkImpl client, Filters filters)
{
    this.client = client;
    this.filters = filters;
}
 
Example #15
Source File: AsyncReconfigBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncReconfigBuilderImpl(CuratorFrameworkImpl client, Filters filters)
{
    this.client = client;
    this.filters = filters;
}
 
Example #16
Source File: AsyncTransactionOpImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncTransactionOpImpl(CuratorFrameworkImpl client)
{
    this.client = client;
}
 
Example #17
Source File: AsyncGetChildrenBuilderImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
AsyncGetChildrenBuilderImpl(CuratorFrameworkImpl client, Filters filters, WatchMode watchMode)
{
    this.client = client;
    this.filters = filters;
    this.watchMode = watchMode;
}
 
Example #18
Source File: CuratorFrameworkFactory.java    From xian with Apache License 2.0 2 votes vote down vote up
/**
 * Apply the current values and build a new CuratorFramework
 *
 * @return new CuratorFramework
 */
public CuratorFramework build()
{
    return new CuratorFrameworkImpl(this);
}
 
Example #19
Source File: CuratorFrameworkFactory.java    From curator with Apache License 2.0 2 votes vote down vote up
/**
 * Apply the current values and build a new CuratorFramework
 *
 * @return new CuratorFramework
 */
public CuratorFramework build()
{
    return new CuratorFrameworkImpl(this);
}