@Test public void readObjectNameSupplier() { final String object = "objectName"; final ObjectMetadata objectName = mock(ObjectMetadata.class); when(objectName.getName()).thenReturn(object); when(objectName.getSize()).thenReturn(50000L); when(objectName.getContainerSuffix()).thenReturn(-1); when(this.objectManager.get()).thenReturn(objectName); final Map<String, String> context = Maps.newHashMap(); assertThat(new SourceReadObjectNameFunction(this.objectManager).apply(context), is(object)); assertThat(context.get(Context.X_OG_SSE_SOURCE_OBJECT_NAME), is(object)); assertThat(context.get(Context.X_OG_SSE_SOURCE_OBJECT_SIZE), is("50000")); assertThat(context.get(Context.X_OG_SSE_SOURCE_OBJECT_CONTAINER_SUFFIX), is("-1")); assertThat(context.get(Context.X_OG_OBJECT_SIZE), is("50000")); }
@Override public String apply(final Map<String, String> context) { final ObjectMetadata objectMetadata = this.objectManager.get(); context.put(Context.X_OG_SSE_SOURCE_OBJECT_NAME, objectMetadata.getName()); context.put(Context.X_OG_SSE_SOURCE_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); context.put(Context.X_OG_SSE_SOURCE_OBJECT_CONTAINER_SUFFIX, String.valueOf(objectMetadata.getContainerSuffix())); context.put(Context.X_OG_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); return objectMetadata.getName(); }
SourceReadObjectNameFunction implements Function<Map<String, String>, String> { @Override public String apply(final Map<String, String> context) { final ObjectMetadata objectMetadata = this.objectManager.get(); context.put(Context.X_OG_SSE_SOURCE_OBJECT_NAME, objectMetadata.getName()); context.put(Context.X_OG_SSE_SOURCE_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); context.put(Context.X_OG_SSE_SOURCE_OBJECT_CONTAINER_SUFFIX, String.valueOf(objectMetadata.getContainerSuffix())); context.put(Context.X_OG_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); return objectMetadata.getName(); } }
SourceReadObjectNameFunction implements Function<Map<String, String>, String> { @Override public String apply(final Map<String, String> context) { final ObjectMetadata objectMetadata = this.objectManager.get(); context.put(Context.X_OG_SSE_SOURCE_OBJECT_NAME, objectMetadata.getName()); context.put(Context.X_OG_SSE_SOURCE_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); context.put(Context.X_OG_SSE_SOURCE_OBJECT_CONTAINER_SUFFIX, String.valueOf(objectMetadata.getContainerSuffix())); context.put(Context.X_OG_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); return objectMetadata.getName(); } SourceReadObjectNameFunction(final ObjectManager objectManager); }
SourceReadObjectNameFunction implements Function<Map<String, String>, String> { @Override public String apply(final Map<String, String> context) { final ObjectMetadata objectMetadata = this.objectManager.get(); context.put(Context.X_OG_SSE_SOURCE_OBJECT_NAME, objectMetadata.getName()); context.put(Context.X_OG_SSE_SOURCE_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); context.put(Context.X_OG_SSE_SOURCE_OBJECT_CONTAINER_SUFFIX, String.valueOf(objectMetadata.getContainerSuffix())); context.put(Context.X_OG_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); return objectMetadata.getName(); } SourceReadObjectNameFunction(final ObjectManager objectManager); @Override String apply(final Map<String, String> context); @Override String toString(); }
SourceReadObjectNameFunction implements Function<Map<String, String>, String> { @Override public String apply(final Map<String, String> context) { final ObjectMetadata objectMetadata = this.objectManager.get(); context.put(Context.X_OG_SSE_SOURCE_OBJECT_NAME, objectMetadata.getName()); context.put(Context.X_OG_SSE_SOURCE_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); context.put(Context.X_OG_SSE_SOURCE_OBJECT_CONTAINER_SUFFIX, String.valueOf(objectMetadata.getContainerSuffix())); context.put(Context.X_OG_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); return objectMetadata.getName(); } SourceReadObjectNameFunction(final ObjectManager objectManager); @Override String apply(final Map<String, String> context); @Override String toString();  }