Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-api-handlers / mso-api-handler-infra / src / test / java / org / onap / so / apihandlerinfra / tenantisolationbeans / TenantIsolationBeansTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.apihandlerinfra.tenantisolationbeans;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25 import java.util.List;
26 import org.junit.Test;
27 import org.onap.so.apihandlerinfra.BaseTest;
28 import com.openpojo.reflection.PojoClass;
29 import com.openpojo.reflection.filters.FilterPackageInfo;
30 import com.openpojo.reflection.impl.PojoClassFactory;
31 import com.openpojo.validation.Validator;
32 import com.openpojo.validation.ValidatorBuilder;
33 import com.openpojo.validation.affirm.Affirm;
34 import com.openpojo.validation.rule.impl.GetterMustExistRule;
35 import com.openpojo.validation.rule.impl.SetterMustExistRule;
36 import com.openpojo.validation.test.impl.GetterTester;
37 import com.openpojo.validation.test.impl.SetterTester;
38
39 public class TenantIsolationBeansTest extends BaseTest {
40
41     private static final int EXPECTED_CLASS_COUNT = 25;
42     private static final String POJO_PACKAGE = "org.onap.so.apihandlerinfra.tenantisolationbeans";
43
44     @Test
45     public void ensureExpectedPojoCount() {
46         List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(POJO_PACKAGE, new FilterPackageInfo());
47         Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size());
48     }
49
50     @Test
51     public void testPojoStructureAndBehavior() {
52         Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule())
53                 .with(new SetterTester()).with(new GetterTester()).build();
54
55         validator.validate(POJO_PACKAGE, new FilterPackageInfo());
56     }
57
58     @Test
59     public void testTenantIsolationToString() {
60         TenantIsolationRequest request = new TenantIsolationRequest();
61         request.setRequestId("requestId");
62         request.setRequestScope("scope");
63         request.setRequestType("type");
64         request.setStartTime("time");
65         request.setRequestDetails(new RequestDetails());
66         request.setRequestStatus(new RequestStatus());
67
68         assertNotNull(request.toString());
69     }
70
71     @Test
72     public void testRequestListToString() {
73         RequestList list = new RequestList();
74         list.setRequest(new Request());
75         list.setRequestStatus(new RequestStatus());
76
77         assertNotNull(list.toString());
78     }
79 }