Skip to content

Commit 649e877

Browse files
author
Xin LI
committed
adjust updateAccountAttributes returned value format
1 parent 3a7a73f commit 649e877

File tree

10 files changed

+23
-33
lines changed

10 files changed

+23
-33
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ sourceSets {
101101
}
102102

103103
configure(allprojects) {
104-
version = '1.4.1'
104+
version = '1.4.3'
105105
if (!project.hasProperty('release')) {
106106
project.setVersion(project.getVersion() + '-SNAPSHOT')
107107
}
@@ -132,7 +132,7 @@ configure(allprojects) {
132132
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
133133
compile 'io.jsonwebtoken:jjwt:0.9.1'
134134
implementation 'org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE'
135-
implementation 'com.scality:vaultclient:0.5.1'
135+
implementation 'com.scality:vaultclient:0.5.2-SNAPSHOT'
136136
implementation 'com.amazonaws:aws-java-sdk-s3:1.11.914'
137137
implementation 'com.amazonaws:aws-java-sdk-sts:1.11.914'
138138
implementation 'com.amazonaws:aws-java-sdk-iam:1.11.914'

osis-core/src/main/java/com/scality/osis/configuration/DocumentationConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public class DocumentationConfig {
3131
private static final String DOC_TITLE = "Object Storage Interoperability Services API for Scality platform";
3232
private static final String DOC_DESCRIPTION = "This is VMware Cloud Director Object Storage Interoperability Services API for Scality platform.";
33-
private static final String DOC_VERSION = "1.4.1-SNAPSHOT";
33+
private static final String DOC_VERSION = "1.4.3-SNAPSHOT";
3434
private static final String PROJECT_BASE = "com.scality.osis";
3535

3636
ApiInfo apiInfo() {

osis-core/src/main/java/com/scality/osis/service/impl/ScalityOsisServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ public OsisTenant updateTenant(String tenantId, OsisTenant osisTenant) {
570570
logger.debug("[Vault]Update Account Attributes request:{}",
571571
new Gson().toJson(updateAccountAttributesRequest));
572572

573-
CreateAccountResponseDTO accountResponse = vaultAdmin
573+
AccountData accountResponse = vaultAdmin
574574
.updateAccountAttributes(updateAccountAttributesRequest);
575575

576576
logger.debug("[Vault]Update Account Attributes response:{}", new Gson().toJson(accountResponse));

osis-core/src/test/java/com/scality/osis/service/impl/BaseOsisServiceTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,19 +195,14 @@ protected void initCreateTenantMocks() {
195195
protected void initUpdateTenantMocks() {
196196
// initialize mock create account response
197197
when(vaultAdminMock.updateAccountAttributes(any(UpdateAccountAttributesRequestDTO.class)))
198-
.thenAnswer((Answer<CreateAccountResponseDTO>) invocation -> {
198+
.thenAnswer((Answer<AccountData>) invocation -> {
199199
final UpdateAccountAttributesRequestDTO request = invocation.getArgument(0);
200200
final AccountData data = new AccountData();
201201
data.setEmailAddress(SAMPLE_SCALITY_ACCOUNT_EMAIL);
202202
data.setName(request.getAccountName());
203203
data.setId(SAMPLE_ID);
204204
data.setCustomAttributes(request.getCustomAttributes());
205-
final Account account = new Account();
206-
account.setData(data);
207-
final CreateAccountResponseDTO response = new CreateAccountResponseDTO();
208-
response.setAccount(account);
209-
210-
return response;
205+
return data;
211206
});
212207
}
213208

osis-core/src/test/java/com/scality/osis/utils/ScalityTestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public final class ScalityTestUtils {
5757
public static final String TEST_S3_URL = "http://localhost:8000";
5858
public static final String PLATFORM_NAME = "Scality";
5959
public static final String PLATFORM_VERSION = "7.10";
60-
public static final String API_VERSION = "1.4.1-SNAPSHOT";
60+
public static final String API_VERSION = "1.4.3-SNAPSHOT";
6161
public static final long SAMPLE_DURATION_SECONDS = 120L;
6262
public static final String ACTIVE_STR = "Active";
6363
public static final String NA_STR = "N/A";

storage-platform-clients/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies {
2222
testCompile 'org.javaswift:joss:0.9.13'
2323
testCompile 'org.apache.httpcomponents:httpclient:4.5.2'
2424
testCompile 'ch.qos.logback:logback-classic:1.2.1'
25-
implementation 'com.scality:vaultclient:0.5.0'
25+
implementation 'com.scality:vaultclient:0.5.2-SNAPSHOT'
2626
implementation 'com.amazonaws:aws-java-sdk-s3:1.11.914'
2727
implementation 'com.amazonaws:aws-java-sdk-sts:1.11.914'
2828
implementation 'com.amazonaws:aws-java-sdk-iam:1.11.914'

storage-platform-clients/src/main/java/com/scality/osis/vaultadmin/VaultAdmin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public interface VaultAdmin {
113113
* @param updateAccountAttributesRequestDTO the update account attributes request dto
114114
* @return The updated account as a create account response object.
115115
*/
116-
CreateAccountResponseDTO updateAccountAttributes(UpdateAccountAttributesRequestDTO updateAccountAttributesRequestDTO);
116+
AccountData updateAccountAttributes(UpdateAccountAttributesRequestDTO updateAccountAttributesRequestDTO);
117117

118118
/**
119119
* Get User by accessKey

storage-platform-clients/src/main/java/com/scality/osis/vaultadmin/impl/VaultAdminImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public AccountData getAccount(GetAccountRequestDTO getAccountRequestDTO) {
376376
* @return The updated account as a create account response object.
377377
*/
378378
@Override
379-
public CreateAccountResponseDTO updateAccountAttributes(UpdateAccountAttributesRequestDTO updateAccountAttributesRequestDTO) {
379+
public AccountData updateAccountAttributes(UpdateAccountAttributesRequestDTO updateAccountAttributesRequestDTO) {
380380
return ExternalServiceFactory.executeVaultService(vaultAccountClient::updateAccountAttributes, updateAccountAttributesRequestDTO);
381381
}
382382

storage-platform-clients/src/test/java/com/scality/osis/vaultadmin/impl/BaseTest.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,29 +244,24 @@ public Response<GenerateAccountAccessKeyResponse> answer(final InvocationOnMock
244244
private void initUpdateAccountAttributesMocks() {
245245
//initialize mock update account attributes response
246246
when(accountServicesClient.updateAccountAttributes(any(UpdateAccountAttributesRequestDTO.class)))
247-
.thenAnswer(new Answer<Response<CreateAccountResponseDTO>>() {
247+
.thenAnswer(new Answer<Response<AccountData>>() {
248248
@Override
249-
public Response<CreateAccountResponseDTO> answer(final InvocationOnMock invocation) {
249+
public Response<AccountData> answer(final InvocationOnMock invocation) {
250250
final UpdateAccountAttributesRequestDTO request = invocation.getArgument(0);
251251

252252
final AccountData data = new AccountData();
253253
data.setEmailAddress(DEFAULT_TEST_EMAIL_ADDR);
254-
data.setName(request.getName());
254+
data.setName(request.getAccountName());
255255
data.setId(DEFAULT_TEST_ACCOUNT_ID);
256256
data.setCanonicalId(DEFAULT_TEST_CANONICAL_ID);
257257
data.setCustomAttributes(request.getCustomAttributes());
258-
data.setArn(DEFAULT_TEST_ARN_STR + request.getName() +"/\"");
258+
data.setArn(DEFAULT_TEST_ARN_STR + request.getAccountName() +"/\"");
259259
data.setCreateDate(new Date());
260260

261-
final Account account = new Account();
262-
account.setData(data);
263-
final CreateAccountResponseDTO response = new CreateAccountResponseDTO();
264-
response.setAccount(account);
265-
266261
final HttpResponse httpResponse = new HttpResponse(null, null);
267262
httpResponse.setStatusCode(201);
268263
httpResponse.setStatusText("Created");
269-
return new Response<>(response,httpResponse);
264+
return new Response<>(data, httpResponse);
270265
}
271266
});
272267
}

storage-platform-clients/src/test/java/com/scality/osis/vaultadmin/impl/VaultAdminImplTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -531,16 +531,16 @@ public void updateAccountAttributes() {
531531
customAttributestemp.put("cd_tenant_id==" + UUID.randomUUID(), "");
532532

533533
final UpdateAccountAttributesRequestDTO updateAccountAttributesRequestDTO = UpdateAccountAttributesRequestDTO.builder()
534-
.name(name)
534+
.accountName(name)
535535
.customAttributes(customAttributestemp)
536536
.build();
537537

538-
final CreateAccountResponseDTO response = vaultAdminImpl.updateAccountAttributes(updateAccountAttributesRequestDTO);
539-
assertEquals(name, response.getAccount().getData().getName());
540-
assertNotNull(response.getAccount().getData().getArn());
541-
assertNotNull(response.getAccount().getData().getCreateDate());
542-
assertNotNull(response.getAccount().getData().getId());
543-
assertNotNull(response.getAccount().getData().getCanonicalId());
544-
assertNotNull(response.getAccount().getData().getCustomAttributes());
538+
final AccountData response = vaultAdminImpl.updateAccountAttributes(updateAccountAttributesRequestDTO);
539+
assertEquals(name, response.getName());
540+
assertNotNull(response.getArn());
541+
assertNotNull(response.getCreateDate());
542+
assertNotNull(response.getId());
543+
assertNotNull(response.getCanonicalId());
544+
assertNotNull(response.getCustomAttributes());
545545
}
546546
}

0 commit comments

Comments
 (0)