PathMetadataDynamoDBTranslation { static PrimaryKey pathToKey(Path path) { Preconditions.checkArgument(!path.isRoot(), "Root path is not mapped to any PrimaryKey"); String childName = path.getName(); PrimaryKey key = new PrimaryKey(PARENT, pathToParentKey(path.getParent()), CHILD, childName); for (KeyAttribute attr : key.getComponents()) { String name = attr.getName(); Object v = attr.getValue(); Preconditions.checkNotNull(v, "Null value for DynamoDB attribute \"%s\"", name); Preconditions.checkState(!((String)v).isEmpty(), "Empty string value for DynamoDB attribute \"%s\"", name); } return key; } private  PathMetadataDynamoDBTranslation(); @VisibleForTesting static String pathToParentKey(Path path);  }
@Test public void testPathToKey() throws Exception { LambdaTestUtils.intercept(IllegalArgumentException.class, () -> pathToKey(new Path("/"))); doTestPathToKey(TEST_DIR_PATH); doTestPathToKey(TEST_FILE_PATH); }
@Test public void testPathToKeyTrailing() throws Exception { doTestPathToKey(new Path("s3a: doTestPathToKey(new Path("s3a: LambdaTestUtils.intercept(IllegalArgumentException.class, () -> pathToKey(new Path("s3a: }