2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.so.apihandlerinfra.tenantisolationbeans;
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;
39 public class TenantIsolationBeansTest extends BaseTest {
41 private static final int EXPECTED_CLASS_COUNT = 25;
42 private static final String POJO_PACKAGE = "org.onap.so.apihandlerinfra.tenantisolationbeans";
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());
51 public void testPojoStructureAndBehavior() {
52 Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule())
53 .with(new SetterTester()).with(new GetterTester()).build();
55 validator.validate(POJO_PACKAGE, new FilterPackageInfo());
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());
68 assertNotNull(request.toString());
72 public void testRequestListToString() {
73 RequestList list = new RequestList();
74 list.setRequest(new Request());
75 list.setRequestStatus(new RequestStatus());
77 assertNotNull(list.toString());