@Test public void testTranslationWithRawKeyVersion2() { DocumentTranslator translator = new DocumentTranslator(TestUtils.createTranslatorConfigWithRawKeyV2()); Table table = new Table(); table.setName(UUID.randomUUID() .toString()); Document document = new Document(); document.setId(UUID.randomUUID() .toString()); document.setTimestamp(System.currentTimeMillis()); document.setData(mapper.createObjectNode() .put("name", NAME)); Document translatedDocument = translator.translate(table, document); assertNotNull(translatedDocument.getMetadata()); assertEquals(translatedDocument.getId(), translatedDocument.getMetadata() .getRawStorageId()); assertEquals(translatedDocument.getMetadata() .getId(), document.getId()); assertTrue(translatedDocument.getMetadata() .getRawStorageId() .endsWith(Constants.RAW_KEY_VERSION_TO_SUFFIX_MAP.get("2.0"))); }
public List<Document> translate(final Table table, final List<Document> inDocuments) { ImmutableList.Builder<Document> docListBuilder = ImmutableList.builder(); for (Document document : inDocuments) { docListBuilder.add(translate(table, document)); } return docListBuilder.build(); }
DocumentTranslator { public List<Document> translate(final Table table, final List<Document> inDocuments) { ImmutableList.Builder<Document> docListBuilder = ImmutableList.builder(); for (Document document : inDocuments) { docListBuilder.add(translate(table, document)); } return docListBuilder.build(); } }
DocumentTranslator { public List<Document> translate(final Table table, final List<Document> inDocuments) { ImmutableList.Builder<Document> docListBuilder = ImmutableList.builder(); for (Document document : inDocuments) { docListBuilder.add(translate(table, document)); } return docListBuilder.build(); } @Inject  DocumentTranslator(TranslatorConfig translatorConfig); }
DocumentTranslator { public List<Document> translate(final Table table, final List<Document> inDocuments) { ImmutableList.Builder<Document> docListBuilder = ImmutableList.builder(); for (Document document : inDocuments) { docListBuilder.add(translate(table, document)); } return docListBuilder.build(); } @Inject  DocumentTranslator(TranslatorConfig translatorConfig); List<Document> translate(final Table table, final List<Document> inDocuments); Document translate(final Table table, final Document inDocument); Document translateBack(final Document inDocument); @VisibleForTesting String generateScalableKey(String id); String rawStorageIdFromDocumentId(Table table, String id); }
DocumentTranslator { public List<Document> translate(final Table table, final List<Document> inDocuments) { ImmutableList.Builder<Document> docListBuilder = ImmutableList.builder(); for (Document document : inDocuments) { docListBuilder.add(translate(table, document)); } return docListBuilder.build(); } @Inject  DocumentTranslator(TranslatorConfig translatorConfig); List<Document> translate(final Table table, final List<Document> inDocuments); Document translate(final Table table, final Document inDocument); Document translateBack(final Document inDocument); @VisibleForTesting String generateScalableKey(String id); String rawStorageIdFromDocumentId(Table table, String id);  }