@Test public void testGetStrategyNullPointerExceptionWhenPathIsNull() { final NullPointerException ex = assertThrows(NullPointerException.class, () -> factory.getStrategy(null)); assertEquals("path should not be null", ex.getMessage()); }
public ShardStrategy getStrategy(final YangInstanceIdentifier path) { final String moduleName = getModuleName(requireNonNull(path, "path should not be null")); final ShardStrategy shardStrategy = configuration.getStrategyForModule(moduleName); if (shardStrategy == null) { final ShardStrategy strategyForPrefix = configuration.getStrategyForPrefix(new DOMDataTreeIdentifier(logicalStoreType, path)); if (strategyForPrefix == null) { return DefaultShardStrategy.getInstance(); } return strategyForPrefix; } return shardStrategy; }
ShardStrategyFactory { public ShardStrategy getStrategy(final YangInstanceIdentifier path) { final String moduleName = getModuleName(requireNonNull(path, "path should not be null")); final ShardStrategy shardStrategy = configuration.getStrategyForModule(moduleName); if (shardStrategy == null) { final ShardStrategy strategyForPrefix = configuration.getStrategyForPrefix(new DOMDataTreeIdentifier(logicalStoreType, path)); if (strategyForPrefix == null) { return DefaultShardStrategy.getInstance(); } return strategyForPrefix; } return shardStrategy; } }
ShardStrategyFactory { public ShardStrategy getStrategy(final YangInstanceIdentifier path) { final String moduleName = getModuleName(requireNonNull(path, "path should not be null")); final ShardStrategy shardStrategy = configuration.getStrategyForModule(moduleName); if (shardStrategy == null) { final ShardStrategy strategyForPrefix = configuration.getStrategyForPrefix(new DOMDataTreeIdentifier(logicalStoreType, path)); if (strategyForPrefix == null) { return DefaultShardStrategy.getInstance(); } return strategyForPrefix; } return shardStrategy; } ShardStrategyFactory(final Configuration configuration, final LogicalDatastoreType logicalStoreType); }
ShardStrategyFactory { public ShardStrategy getStrategy(final YangInstanceIdentifier path) { final String moduleName = getModuleName(requireNonNull(path, "path should not be null")); final ShardStrategy shardStrategy = configuration.getStrategyForModule(moduleName); if (shardStrategy == null) { final ShardStrategy strategyForPrefix = configuration.getStrategyForPrefix(new DOMDataTreeIdentifier(logicalStoreType, path)); if (strategyForPrefix == null) { return DefaultShardStrategy.getInstance(); } return strategyForPrefix; } return shardStrategy; } ShardStrategyFactory(final Configuration configuration, final LogicalDatastoreType logicalStoreType); ShardStrategy getStrategy(final YangInstanceIdentifier path); static ShardStrategy newShardStrategyInstance(final String moduleName, final String strategyName,
            final Configuration configuration); }
ShardStrategyFactory { public ShardStrategy getStrategy(final YangInstanceIdentifier path) { final String moduleName = getModuleName(requireNonNull(path, "path should not be null")); final ShardStrategy shardStrategy = configuration.getStrategyForModule(moduleName); if (shardStrategy == null) { final ShardStrategy strategyForPrefix = configuration.getStrategyForPrefix(new DOMDataTreeIdentifier(logicalStoreType, path)); if (strategyForPrefix == null) { return DefaultShardStrategy.getInstance(); } return strategyForPrefix; } return shardStrategy; } ShardStrategyFactory(final Configuration configuration, final LogicalDatastoreType logicalStoreType); ShardStrategy getStrategy(final YangInstanceIdentifier path); static ShardStrategy newShardStrategyInstance(final String moduleName, final String strategyName,
            final Configuration configuration);  }