@Test public void readObjectNameSupplier() { final String object = "objectName"; final ObjectMetadata objectName = mock(ObjectMetadata.class); when(objectName.getName()).thenReturn(object); when(this.objectManager.get()).thenReturn(objectName); final Map<String, String> context = Maps.newHashMap(); assertThat(new ReadObjectNameFunction(this.objectManager).apply(context), is(object)); assertThat(context.get(Context.X_OG_OBJECT_NAME), is(object)); }
@Override public String apply(final Map<String, String> context) { final ObjectMetadata objectMetadata = this.objectManager.get(); context.put(Context.X_OG_OBJECT_NAME, objectMetadata.getName()); context.put(Context.X_OG_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); context.put(Context.X_OG_CONTAINER_SUFFIX, String.valueOf(objectMetadata.getContainerSuffix())); context.put(Context.X_OG_LEGAL_HOLD_SUFFIX, String.valueOf(objectMetadata.getNumberOfLegalHolds())); context.put(Context.X_OG_OBJECT_RETENTION, String.valueOf(objectMetadata.getRetention())); return objectMetadata.getName(); }
ReadObjectNameFunction 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_OBJECT_NAME, objectMetadata.getName()); context.put(Context.X_OG_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); context.put(Context.X_OG_CONTAINER_SUFFIX, String.valueOf(objectMetadata.getContainerSuffix())); context.put(Context.X_OG_LEGAL_HOLD_SUFFIX, String.valueOf(objectMetadata.getNumberOfLegalHolds())); context.put(Context.X_OG_OBJECT_RETENTION, String.valueOf(objectMetadata.getRetention())); return objectMetadata.getName(); } }
ReadObjectNameFunction 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_OBJECT_NAME, objectMetadata.getName()); context.put(Context.X_OG_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); context.put(Context.X_OG_CONTAINER_SUFFIX, String.valueOf(objectMetadata.getContainerSuffix())); context.put(Context.X_OG_LEGAL_HOLD_SUFFIX, String.valueOf(objectMetadata.getNumberOfLegalHolds())); context.put(Context.X_OG_OBJECT_RETENTION, String.valueOf(objectMetadata.getRetention())); return objectMetadata.getName(); } ReadObjectNameFunction(final ObjectManager objectManager); }
ReadObjectNameFunction 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_OBJECT_NAME, objectMetadata.getName()); context.put(Context.X_OG_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); context.put(Context.X_OG_CONTAINER_SUFFIX, String.valueOf(objectMetadata.getContainerSuffix())); context.put(Context.X_OG_LEGAL_HOLD_SUFFIX, String.valueOf(objectMetadata.getNumberOfLegalHolds())); context.put(Context.X_OG_OBJECT_RETENTION, String.valueOf(objectMetadata.getRetention())); return objectMetadata.getName(); } ReadObjectNameFunction(final ObjectManager objectManager); @Override String apply(final Map<String, String> context); @Override String toString(); }
ReadObjectNameFunction 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_OBJECT_NAME, objectMetadata.getName()); context.put(Context.X_OG_OBJECT_SIZE, String.valueOf(objectMetadata.getSize())); context.put(Context.X_OG_CONTAINER_SUFFIX, String.valueOf(objectMetadata.getContainerSuffix())); context.put(Context.X_OG_LEGAL_HOLD_SUFFIX, String.valueOf(objectMetadata.getNumberOfLegalHolds())); context.put(Context.X_OG_OBJECT_RETENTION, String.valueOf(objectMetadata.getRetention())); return objectMetadata.getName(); } ReadObjectNameFunction(final ObjectManager objectManager); @Override String apply(final Map<String, String> context); @Override String toString();  }