Package org.apache.curator.framework.api

Examples of org.apache.curator.framework.api.GetDataBuilder


    }
  }

  protected <T> Optional<T> getData(String path, Optional<Stat> stat, Transcoder<T> transcoder) {
    try {
      GetDataBuilder bldr = curator.getData();

      if (stat.isPresent()) {
        bldr.storingStatIn(stat.get());
      }

      byte[] data = bldr.forPath(path);

      if (data == null || data.length == 0) {
        LOG.trace("Empty data found for path {}", path);
        return Optional.absent();
      }
View Full Code Here


public class EncryptedPropertyResolverTest {

    @Test
    public void testResolve() throws Exception {
        CuratorFramework curator = createMock(CuratorFramework.class);
        GetDataBuilder getDataBuilder = createMock(GetDataBuilder.class);

        expect(curator.getData()).andReturn(getDataBuilder).anyTimes();
        expect(getDataBuilder.forPath(AUTHENTICATION_CRYPT_ALGORITHM.getPath())).andReturn("PBEWithMD5AndDES".getBytes()).anyTimes();
        expect(getDataBuilder.forPath(AUTHENTICATION_CRYPT_PASSWORD.getPath())).andReturn("mypassword".getBytes()).anyTimes();

        replay(curator);
        replay(getDataBuilder);

        FabricService fabricService = createMock(FabricService.class);
View Full Code Here

    }

    @Test
    public void testResolveZkEnc() throws Exception {
        CuratorFramework curator = createMock(CuratorFramework.class);
        GetDataBuilder getDataBuilder = createMock(GetDataBuilder.class);

        expect(curator.getData()).andReturn(getDataBuilder).anyTimes();
        expect(getDataBuilder.forPath(AUTHENTICATION_CRYPT_ALGORITHM.getPath())).andReturn("PBEWithMD5AndDES".getBytes()).anyTimes();
        expect(getDataBuilder.forPath(AUTHENTICATION_CRYPT_PASSWORD.getPath())).andReturn("ZKENC=bXlwYXNzd29yZA==".getBytes()).anyTimes();

        replay(curator);
        replay(getDataBuilder);

        FabricService fabricService = createMock(FabricService.class);
View Full Code Here

TOP

Related Classes of org.apache.curator.framework.api.GetDataBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.