c8949cee0f672bf04be0d0c6276a7a3691d2e746
[so.git] / bpmn / so-bpmn-infrastructure-common / src / test / java / org / onap / so / bpmn / infrastructure / workflow / serviceTask / client / entity / ClientEntityPojoTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 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.bpmn.infrastructure.workflow.serviceTask.client.entity;
22
23 import org.junit.Test;
24
25 import com.openpojo.reflection.PojoClass;
26 import com.openpojo.reflection.impl.PojoClassFactory;
27 import com.openpojo.validation.Validator;
28 import com.openpojo.validation.ValidatorBuilder;
29 import com.openpojo.validation.rule.impl.GetterMustExistRule;
30 import com.openpojo.validation.rule.impl.NoNestedClassRule;
31 import com.openpojo.validation.rule.impl.NoPrimitivesRule;
32 import com.openpojo.validation.rule.impl.NoPublicFieldsRule;
33 import com.openpojo.validation.rule.impl.SetterMustExistRule;
34 import com.openpojo.validation.test.impl.DefaultValuesNullTester;
35 import com.openpojo.validation.test.impl.GetterTester;
36 import com.openpojo.validation.test.impl.SetterTester;
37
38 public class ClientEntityPojoTest {
39         @Test
40         public void pojoStructure() {
41                 test(PojoClassFactory.getPojoClass(NetworkInformationEntity.class));
42                 test(PojoClassFactory.getPojoClass(NetworkInputParametersEntity.class));
43                 test(PojoClassFactory.getPojoClass(NetworkRequestInputEntity.class));
44                 test(PojoClassFactory.getPojoClass(NetworkResponseInformationEntity.class));
45                 test(PojoClassFactory.getPojoClass(NetworkTopologyOperationInputEntity.class));
46                 test(PojoClassFactory.getPojoClass(NetworkTopologyOperationOutputEntity.class));
47                 test(PojoClassFactory.getPojoClass(OnapModelInformationEntity.class));
48                 test(PojoClassFactory.getPojoClass(ParamEntity.class));
49                 test(PojoClassFactory.getPojoClass(RequestInformationEntity.class));
50                 test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationInputEntity.class));
51                 test(PojoClassFactory.getPojoClass(SdncRequestHeaderEntity.class));
52                 test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationInputEntity.class));
53                 test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationOutputEntity.class));
54                 test(PojoClassFactory.getPojoClass(ServiceInformationEntity.class));
55                 test(PojoClassFactory.getPojoClass(ServiceInputParametersEntity.class));
56                 test(PojoClassFactory.getPojoClass(ServiceRequestInputEntity.class));
57                 test(PojoClassFactory.getPojoClass(ServiceResponseInformationEntity.class));
58                 test(PojoClassFactory.getPojoClass(ServiceTopologyOperationInputEntity.class));
59                 test(PojoClassFactory.getPojoClass(ServiceTopologyOperationOutputEntity.class));
60                 test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationOutputEntity.class));
61         }
62         
63         private void test(PojoClass pojoClass) {
64                 Validator validator = ValidatorBuilder.create()
65                                 .with(new GetterMustExistRule())
66                                 .with(new SetterMustExistRule())
67                                 .with(new NoNestedClassRule())
68                                 .with(new NoPrimitivesRule())
69                                 .with(new NoPublicFieldsRule())
70                                 .with(new SetterTester())
71                                 .with(new GetterTester())
72                                 .with(new DefaultValuesNullTester())
73                                 .build();
74                 validator.validate(pojoClass);
75         }
76 }