@Test void shouldCheckIfServiceIsEnabled() { List<NodeInfo> nodeInfos = new ArrayList<NodeInfo>(); Map<ServiceType, Integer> direct = new HashMap<ServiceType, Integer>(); Map<ServiceType, Integer> ssl = new HashMap<ServiceType, Integer>(); direct.put(ServiceType.KV, 1234); direct.put(ServiceType.MANAGER, 1235); ssl.put(ServiceType.KV, 4567); nodeInfos.add(new NodeInfo("127.0.0.1", direct, ssl, null)); BucketConfig bc = new SampleBucketConfig(nodeInfos, null); assertTrue(bc.serviceEnabled(ServiceType.KV)); assertTrue(bc.serviceEnabled(ServiceType.MANAGER)); assertFalse(bc.serviceEnabled(ServiceType.QUERY)); assertFalse(bc.serviceEnabled(ServiceType.VIEWS)); }
@Override public boolean serviceEnabled(ServiceType type) { return (enabledServices & (1 << type.ordinal())) != 0; }
AbstractBucketConfig implements BucketConfig { @Override public boolean serviceEnabled(ServiceType type) { return (enabledServices & (1 << type.ordinal())) != 0; } }
AbstractBucketConfig implements BucketConfig { @Override public boolean serviceEnabled(ServiceType type) { return (enabledServices & (1 << type.ordinal())) != 0; } protected  AbstractBucketConfig(String uuid, String name, BucketNodeLocator locator, String uri, String streamingUri,
                                   List<NodeInfo> nodeInfos, List<PortInfo> portInfos,
                                   List<BucketCapabilities> bucketCapabilities, String origin,
                                   Map<String, Set<ClusterCapabilities>> clusterCapabilities
    ); }
AbstractBucketConfig implements BucketConfig { @Override public boolean serviceEnabled(ServiceType type) { return (enabledServices & (1 << type.ordinal())) != 0; } protected  AbstractBucketConfig(String uuid, String name, BucketNodeLocator locator, String uri, String streamingUri,
                                   List<NodeInfo> nodeInfos, List<PortInfo> portInfos,
                                   List<BucketCapabilities> bucketCapabilities, String origin,
                                   Map<String, Set<ClusterCapabilities>> clusterCapabilities
    ); @Override String uuid(); @Override String name(); @Override BucketNodeLocator locator(); @Override String uri(); @Override String streamingUri(); @Override List<NodeInfo> nodes(); @Override boolean serviceEnabled(ServiceType type); @Override Map<ServiceType, Set<ClusterCapabilities>> clusterCapabilities(); @Override Set<BucketCapabilities> bucketCapabilities(); }
AbstractBucketConfig implements BucketConfig { @Override public boolean serviceEnabled(ServiceType type) { return (enabledServices & (1 << type.ordinal())) != 0; } protected  AbstractBucketConfig(String uuid, String name, BucketNodeLocator locator, String uri, String streamingUri,
                                   List<NodeInfo> nodeInfos, List<PortInfo> portInfos,
                                   List<BucketCapabilities> bucketCapabilities, String origin,
                                   Map<String, Set<ClusterCapabilities>> clusterCapabilities
    ); @Override String uuid(); @Override String name(); @Override BucketNodeLocator locator(); @Override String uri(); @Override String streamingUri(); @Override List<NodeInfo> nodes(); @Override boolean serviceEnabled(ServiceType type); @Override Map<ServiceType, Set<ClusterCapabilities>> clusterCapabilities(); @Override Set<BucketCapabilities> bucketCapabilities();  }