diff options
author | Max Benjamin <max.benjamin@att.com> | 2020-02-14 14:50:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-14 14:50:16 +0000 |
commit | 460b2c35e214b9422e9313a4bad8253669791ebf (patch) | |
tree | ec16d302fa24fa1a9929e881d6b4a91551008c6b /adapters/mso-ve-vnfm-adapter/src/test | |
parent | dbf7a49c67050dbd132146e4fa230bb5723dbc7d (diff) | |
parent | 361511c01e4e51dddb6e3bfe11b6728a76dbbfd0 (diff) |
Merge "Fixed, simplified and tested AuthorizationHeadersProvider (+small changes in poms)"
Diffstat (limited to 'adapters/mso-ve-vnfm-adapter/src/test')
-rw-r--r-- | adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java new file mode 100644 index 0000000000..64503ddfc2 --- /dev/null +++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * SO + * ================================================================================ + * Copyright (C) 2020 Samsung. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vevnfm.provider; + +import static org.junit.Assert.*; +import static org.onap.so.configuration.rest.BasicHttpHeadersProvider.AUTHORIZATION_HEADER; +import org.junit.Test; +import org.springframework.http.HttpHeaders; + +public class AuthorizationHeadersProviderTest { + + private static final String AUTHORIZATION_EXAMPLE = "authorization"; + + private final AuthorizationHeadersProvider provider = new AuthorizationHeadersProvider(); + + @Test + public void testSuccessValidAuthorizationAndRemoval() { + final HttpHeaders headers = provider.getHttpHeaders(); + final int size = headers.size(); + + provider.addAuthorization(AUTHORIZATION_EXAMPLE); + assertEquals(size + 1, headers.size()); + assertTrue(headers.containsKey(AUTHORIZATION_HEADER)); + + provider.removeAuthorization(); + assertEquals(size, headers.size()); + assertFalse(headers.containsKey(AUTHORIZATION_HEADER)); + } +} |