ACS-2147 renaming method which gets storage props (#778)

* ACS-2147: Adding missing ContentStore implementation, switching some logging
to trace.

* ACS-2147: Renaming getObjectStorageProperties to getStorageProperties

* [maven-release-plugin][skip ci] prepare release 14.20

* [maven-release-plugin][skip ci] prepare for next development iteration

* Fix/mnt 21506 sanitation create people (#756)

* MNT-21506: sanitize username on nodeBrowser Repo

* [maven-release-plugin][skip ci] prepare release 14.21

* [maven-release-plugin][skip ci] prepare for next development iteration

* ACS-2148: Adding get StorageObjectProps to ContentService (#773)

* ACS-2148: Adding get StorageObjectProps to ContentService and implementation.

* ACS-2148: Adding propertyQName param to get storage property method.

* ACS-2148: Security config for added method.

* ACS-2148: Renaming getObjectStorageProperties to getStorageProperties

* ACS-2148: Javadoc fix

* ACS-2148: Fixing security context after method renaming.

* ACS-2148: ContentService with new method names.

* ACS-2147: Adding missing ContentStore implementation, switching some logging
to trace.

* ACS-2147: Renaming getObjectStorageProperties to getStorageProperties

* ACS-2148: ContentService with new method names.

* ACS-2148: Small fixes after code review.
This commit is contained in:
mpichura
2021-10-27 13:35:11 +02:00
committed by GitHub
parent 3c928a4928
commit 2d4140ea64
9 changed files with 87 additions and 79 deletions

View File

@@ -168,7 +168,7 @@ public class ContentServiceImplUnitTest
public void shouldReturnStoragePropertiesWhenTheyExist()
{
final Map<String, String> storageObjectPropsMap = Map.of(X_AMZ_HEADER_1, VALUE_1, X_AMZ_HEADER_2, VALUE_2);
when(mockContentStore.getObjectStorageProperties(SOME_CONTENT_URL)).thenReturn(storageObjectPropsMap);
when(mockContentStore.getStorageProperties(SOME_CONTENT_URL)).thenReturn(storageObjectPropsMap);
final Map<String, String> objectStorageProperties = contentService.getStorageProperties(NODE_REF, ContentModel.PROP_CONTENT);
assertFalse(objectStorageProperties.isEmpty());
@@ -178,7 +178,7 @@ public class ContentServiceImplUnitTest
@Test
public void shouldReturnEmptyStoragePropertiesWhenTheyDontExist()
{
when(mockContentStore.getObjectStorageProperties(SOME_CONTENT_URL)).thenReturn(Collections.emptyMap());
when(mockContentStore.getStorageProperties(SOME_CONTENT_URL)).thenReturn(Collections.emptyMap());
final Map<String, String> objectStorageProperties = contentService.getStorageProperties(NODE_REF, ContentModel.PROP_CONTENT);
assertTrue(objectStorageProperties.isEmpty());

View File

@@ -528,8 +528,8 @@ public class CachingContentStoreTest
{
final Map<String, String> propertiesMap = Map.of("x-amz-header1", "value1", "x-amz-header2", "value2");
final String contentUrl = "url";
when(backingStore.getObjectStorageProperties(contentUrl)).thenReturn(propertiesMap);
final Map<String, String> storageProperties = cachingStore.getObjectStorageProperties(contentUrl);
when(backingStore.getStorageProperties(contentUrl)).thenReturn(propertiesMap);
final Map<String, String> storageProperties = cachingStore.getStorageProperties(contentUrl);
assertFalse(storageProperties.isEmpty());
assertEquals(propertiesMap, storageProperties);
}
@@ -537,7 +537,7 @@ public class CachingContentStoreTest
@Test
public void shouldReturnEmptyStorageProperties()
{
Map<String, String> storageProperties = cachingStore.getObjectStorageProperties("url");
Map<String, String> storageProperties = cachingStore.getStorageProperties("url");
assertTrue(storageProperties.isEmpty());
}
}

View File

@@ -321,13 +321,13 @@ public class AggregatingContentStoreTest extends AbstractWritableContentStoreTes
{
final String contentUrl = "url";
final Map<String, String> primaryStorePropertiesMap = Map.of(X_AMZ_HEADER_1, VALUE_1, X_AMZ_HEADER_2, VALUE_2);;
when(primaryStoreMock.getObjectStorageProperties(contentUrl)).thenReturn(primaryStorePropertiesMap);
when(primaryStoreMock.getStorageProperties(contentUrl)).thenReturn(primaryStorePropertiesMap);
final Map<String, String> storageProperties = aggregatingStore.getObjectStorageProperties(contentUrl);
final Map<String, String> storageProperties = aggregatingStore.getStorageProperties(contentUrl);
assertFalse(storageProperties.isEmpty());
assertEquals(primaryStorePropertiesMap, storageProperties);
verify(secondaryStoreMock, times(0)).getObjectStorageProperties(contentUrl);
verify(secondaryStoreMock, times(0)).getStorageProperties(contentUrl);
}
@Test
@@ -335,29 +335,29 @@ public class AggregatingContentStoreTest extends AbstractWritableContentStoreTes
{
final String contentUrl = "url";
final Map<String, String> secondaryStorePropertiesMap = Map.of(X_AMZ_HEADER_1, VALUE_1, X_AMZ_HEADER_2, VALUE_2);;
when(primaryStoreMock.getObjectStorageProperties(contentUrl)).thenReturn(Collections.emptyMap());
when(secondaryStoreMock.getObjectStorageProperties(contentUrl)).thenReturn(secondaryStorePropertiesMap);
when(primaryStoreMock.getStorageProperties(contentUrl)).thenReturn(Collections.emptyMap());
when(secondaryStoreMock.getStorageProperties(contentUrl)).thenReturn(secondaryStorePropertiesMap);
final Map<String, String> storageProperties = aggregatingStore.getObjectStorageProperties(contentUrl);
final Map<String, String> storageProperties = aggregatingStore.getStorageProperties(contentUrl);
assertFalse(storageProperties.isEmpty());
assertEquals(secondaryStorePropertiesMap, storageProperties);
verify(secondaryStoreMock, times(1)).getObjectStorageProperties(contentUrl);
verify(primaryStoreMock, times(1)).getObjectStorageProperties(contentUrl);
verify(secondaryStoreMock, times(1)).getStorageProperties(contentUrl);
verify(primaryStoreMock, times(1)).getStorageProperties(contentUrl);
}
@Test
public void shouldReturnEmptyStorageProperties()
{
final String contentUrl = "url";
when(primaryStoreMock.getObjectStorageProperties(contentUrl)).thenReturn(Collections.emptyMap());
when(secondaryStoreMock.getObjectStorageProperties(contentUrl)).thenReturn(Collections.emptyMap());
when(primaryStoreMock.getStorageProperties(contentUrl)).thenReturn(Collections.emptyMap());
when(secondaryStoreMock.getStorageProperties(contentUrl)).thenReturn(Collections.emptyMap());
final Map<String, String> storageProperties = aggregatingStore.getObjectStorageProperties(contentUrl);
final Map<String, String> storageProperties = aggregatingStore.getStorageProperties(contentUrl);
assertTrue(storageProperties.isEmpty());
verify(secondaryStoreMock, times(1)).getObjectStorageProperties(contentUrl);
verify(primaryStoreMock, times(1)).getObjectStorageProperties(contentUrl);
verify(secondaryStoreMock, times(1)).getStorageProperties(contentUrl);
verify(primaryStoreMock, times(1)).getStorageProperties(contentUrl);
}
}