Merge "Reduce log noise/warnings format to conventions"
[so.git] / adapters / mso-adapter-utils / src / test / java / org / openecomp / mso / cloud / authentication / AuthenticationMethodTest.java
1 /*\r
2  * ============LICENSE_START==========================================\r
3  * ===================================================================\r
4  * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.\r
5  * ===================================================================\r
6  * Licensed under the Apache License, Version 2.0 (the "License");\r
7  * you may not use this file except in compliance with the License.\r
8  * You may obtain a copy of the License at\r
9  *\r
10  *        http://www.apache.org/licenses/LICENSE-2.0\r
11  *\r
12  * Unless required by applicable law or agreed to in writing, software\r
13  * distributed under the License is distributed on an "AS IS" BASIS,\r
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
15  * See the License for the specific language governing permissions and\r
16  * limitations under the License.\r
17  * ============LICENSE_END============================================\r
18  *\r
19  * ECOMP and OpenECOMP are trademarks\r
20  * and service marks of AT&T Intellectual Property.\r
21  *\r
22  */\r
23 \r
24 package org.openecomp.mso.cloud.authentication;\r
25 \r
26 import static org.junit.Assert.assertTrue;\r
27 \r
28 import com.woorea.openstack.keystone.model.Authentication;\r
29 import com.woorea.openstack.keystone.model.authentication.UsernamePassword;\r
30 import org.junit.Test;\r
31 import org.openecomp.mso.cloud.CloudIdentity;\r
32 import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication;\r
33 \r
34 /**\r
35  * A few JUnit tests to evaluate the new factory that manages authentication\r
36  * types and their associated wrapper classes. Here it is assumed that core types\r
37  * only are tested.\r
38  */\r
39 public class AuthenticationMethodTest {\r
40 \r
41     /**\r
42      *\r
43      */\r
44     public AuthenticationMethodTest() {\r
45         // TODO Auto-generated constructor stub\r
46     }\r
47 \r
48     @Test\r
49     public void testCustomRackspaceAuthFromCloudIdentity() {\r
50         CloudIdentity ci = new CloudIdentity();\r
51         ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY);\r
52         ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");\r
53         ci.setMsoId("test");\r
54         Authentication auth = ci.getAuthentication();\r
55         assertTrue(RackspaceAuthentication.class.equals(auth.getClass()));\r
56     }\r
57 \r
58     @Test\r
59     public void testCoreUsernamePasswordAuthFromCloudIdentity() {\r
60         CloudIdentity ci = new CloudIdentity();\r
61         ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD);\r
62         ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");\r
63         ci.setMsoId("someuser");\r
64         Authentication auth = ci.getAuthentication();\r
65         assertTrue(UsernamePassword.class.equals(auth.getClass()));\r
66     }\r
67 }\r