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.assertNotNull;
24 import java.util.List;
25 import org.junit.Test;
26 import org.onap.so.apihandlerinfra.BaseTest;
27 import com.openpojo.reflection.PojoClass;
28 import com.openpojo.reflection.filters.FilterPackageInfo;
29 import com.openpojo.reflection.impl.PojoClassFactory;
30 import com.openpojo.validation.Validator;
31 import com.openpojo.validation.ValidatorBuilder;
32 import com.openpojo.validation.affirm.Affirm;
33 import com.openpojo.validation.rule.impl.GetterMustExistRule;
34 import com.openpojo.validation.rule.impl.SetterMustExistRule;
35 import com.openpojo.validation.test.impl.GetterTester;
36 import com.openpojo.validation.test.impl.SetterTester;
38 public class TenantIsolationBeansTest extends BaseTest {
40 private static final int EXPECTED_CLASS_COUNT = 25;
41 private static final String POJO_PACKAGE = "org.onap.so.apihandlerinfra.tenantisolationbeans";
44 public void ensureExpectedPojoCount() {
45 List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(POJO_PACKAGE, new FilterPackageInfo());
46 Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size());
50 public void testPojoStructureAndBehavior() {
51 Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule())
52 .with(new SetterTester()).with(new GetterTester()).build();
54 validator.validate(POJO_PACKAGE, new FilterPackageInfo());
58 public void testTenantIsolationToString() {
59 TenantIsolationRequest request = new TenantIsolationRequest();
60 request.setRequestId("requestId");
61 request.setRequestScope("scope");
62 request.setRequestType("type");
63 request.setStartTime("time");
64 request.setRequestDetails(new RequestDetails());
65 request.setRequestStatus(new RequestStatus());
67 assertNotNull(request.toString());
71 public void testRequestListToString() {
72 RequestList list = new RequestList();
73 list.setRequest(new Request());
74 list.setRequestStatus(new RequestStatus());
76 assertNotNull(list.toString());