diff options
Diffstat (limited to 'platform')
13 files changed, 848 insertions, 0 deletions
diff --git a/platform/pom.xml b/platform/pom.xml new file mode 100644 index 000000000..2453cfc75 --- /dev/null +++ b/platform/pom.xml @@ -0,0 +1,70 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.models</groupId> + <artifactId>policy-models</artifactId> + <version>2.1.0-SNAPSHOT</version> + </parent> + + <artifactId>platform</artifactId> + + <name>${project.artifactId}</name> + <description>The platform models that are shared across different policy components</description> + + <dependencies> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.18.4</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>utils</artifactId> + <version>${policy.common.version}</version> + </dependency> + </dependencies> + + <build> + <resources> + <!-- Output the version of the pap service --> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + <includes> + <include>**/version.txt</include> + </includes> + </resource> + <resource> + <directory>src/main/resources</directory> + <filtering>false</filtering> + <excludes> + <exclude>**/version.txt</exclude> + </excludes> + </resource> + </resources> + </build> +</project>
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaConstraint.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaConstraint.java new file mode 100644 index 000000000..21ae4c516 --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaConstraint.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the Constraint of property in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaConstraint { + + @Getter + @Setter + @SerializedName("equal") + private String equal; + + @Getter + @Setter + @SerializedName("greater_than") + private String greaterThan; + + @Getter + @Setter + @SerializedName("greater_or_equal") + private String greaterOrEqual; + + @Getter + @Setter + @SerializedName("less_than") + private String lessThan; + + @Getter + @Setter + @SerializedName("less_or_equal") + private String lessOrEqual; + + @Getter + @Setter + @SerializedName("in_range") + private String inRange; + + @Getter + @Setter + @SerializedName("valid_values") + private String validValues; + + @Getter + @Setter + @SerializedName("length") + private String length; + + @Getter + @Setter + @SerializedName("min_length") + private String minLength; + + @Getter + @Setter + @SerializedName("max_length") + private String maxLength; + + @Getter + @Setter + @SerializedName("pattern") + private String pattern; +}
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaDataType.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaDataType.java new file mode 100644 index 000000000..607c53c9d --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaDataType.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent custom data type in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaDataType { + + @Getter + @Setter + @SerializedName("derived_from") + private String derivedFrom; + + @Getter + @Setter + @SerializedName("version") + private String version; + + @Getter + @Setter + @SerializedName("metadata") + private Map<String, String> metadata; + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("constraints") + private List<ToscaConstraint> constraints; + + @Getter + @Setter + @SerializedName("properties") + private List<Map<String, ToscaProperty>> properties; +}
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaEntrySchema.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaEntrySchema.java new file mode 100644 index 000000000..b036dc60f --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaEntrySchema.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the EntrySchema of list/map property in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaEntrySchema { + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("type") + private String type; + + @Getter + @Setter + @SerializedName("constraints") + private List<ToscaConstraint> constraints; +}
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaEventFilter.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaEventFilter.java new file mode 100644 index 000000000..74277d3a7 --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaEventFilter.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the EventFilter in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaEventFilter { + + @Getter + @Setter + @SerializedName("node") + private String node; + + @Getter + @Setter + @SerializedName("requirement") + private String requirement; + + @Getter + @Setter + @SerializedName("capability") + private String capability; +}
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicy.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicy.java new file mode 100644 index 000000000..8f72dcb0b --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicy.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the policy in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaPolicy { + + @Getter + @Setter + @SerializedName("type") + private String type; + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("metadata") + private Map<String, String> metadata; + + @Getter + @Setter + @SerializedName("properties") + private List<Map<String, String>> properties; + + @Getter + @Setter + @SerializedName("targets") + private List<String> targets; + + @Getter + @Setter + @SerializedName("triggers") + private List<Map<String, ToscaTrigger>> triggers; +}
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyList.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyList.java new file mode 100644 index 000000000..ecc1251fb --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyList.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the policy list in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaPolicyList { + + @Getter + @Setter + @SerializedName("policies") + private List<Map<String, ToscaPolicy>> policies; + + @Getter + @Setter + @SerializedName("data_types") + private List<Map<String, ToscaDataType>> dataTypes; +}
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyType.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyType.java new file mode 100644 index 000000000..8bb5200a7 --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyType.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the policy type in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaPolicyType { + + @Getter + @Setter + @SerializedName("derived_from") + private String derivedFrom; + + @Getter + @Setter + @SerializedName("version") + private String version; + + @Getter + @Setter + @SerializedName("metadata") + private Map<String, String> metadata; + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("properties") + private List<Map<String, ToscaProperty>> properties; + + @Getter + @Setter + @SerializedName("targets") + private List<String> targets; + + @Getter + @Setter + @SerializedName("triggers") + private List<Map<String, ToscaTrigger>> triggers; +}
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyTypeList.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyTypeList.java new file mode 100644 index 000000000..d5ca357c5 --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyTypeList.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the policy type list in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaPolicyTypeList { + + @Getter + @Setter + @SerializedName("policy_types") + private List<Map<String, ToscaPolicyType>> policyTypes; + + @Getter + @Setter + @SerializedName("data_types") + private List<Map<String, ToscaDataType>> dataTypes; +}
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaProperty.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaProperty.java new file mode 100644 index 000000000..6196637c1 --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaProperty.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the property in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaProperty { + + @Getter + @Setter + @SerializedName("type") + private String type; + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("required") + private boolean required; + + @Getter + @Setter + @SerializedName("default_value") + private Object defaultValue; + + @Getter + @Setter + @SerializedName("status") + private String status; + + @Getter + @Setter + @SerializedName("constraints") + private List<ToscaConstraint> constraints; + + @Getter + @Setter + @SerializedName("entry_schema") + private ToscaEntrySchema entrySchema; +}
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaTimeInterval.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaTimeInterval.java new file mode 100644 index 000000000..d63b4e039 --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaTimeInterval.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the TimeInterval in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaTimeInterval { + + @Getter + @Setter + @SerializedName("start_time") + private String startTime; + + @Getter + @Setter + @SerializedName("end_time") + private String endTime; +}
\ No newline at end of file diff --git a/platform/src/main/java/org/onap/policy/model/tosca/ToscaTrigger.java b/platform/src/main/java/org/onap/policy/model/tosca/ToscaTrigger.java new file mode 100644 index 000000000..f5ca07cbb --- /dev/null +++ b/platform/src/main/java/org/onap/policy/model/tosca/ToscaTrigger.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.model.tosca; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the trigger of policy type in TOSCA definition + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaTrigger { + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("event_type") + private String eventType; + + @Getter + @Setter + @SerializedName("schedule") + private ToscaTimeInterval schedule; + + @Getter + @Setter + @SerializedName("target_filter") + private ToscaEventFilter targetFilter; + + @Getter + @Setter + @SerializedName("condition") + private ToscaConstraint condition; + + @Getter + @Setter + @SerializedName("constraint") + private ToscaConstraint constraint; + + @Getter + @Setter + @SerializedName("period") + private String period; + + @Getter + @Setter + @SerializedName("evaluations") + private int evaluations; + + @Getter + @Setter + @SerializedName("method") + private String method; + + @Getter + @Setter + @SerializedName("action") + private String action; +}
\ No newline at end of file diff --git a/platform/src/test/java/org/onap/policy/tosca/TestPojos.java b/platform/src/test/java/org/onap/policy/tosca/TestPojos.java new file mode 100644 index 000000000..e86c75904 --- /dev/null +++ b/platform/src/test/java/org/onap/policy/tosca/TestPojos.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.tosca; + +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +import org.junit.Test; +import org.onap.policy.common.utils.validation.ToStringTester; + +/** + * Class to perform unit tests of all pojos + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +public class TestPojos { + + private static final String POJO_PACKAGE = "org.onap.policy.model.tosca"; + + @Test + public void testPojos() { + final Validator validator = ValidatorBuilder.create().with(new ToStringTester()) + .with(new SetterMustExistRule()).with(new GetterMustExistRule()).with(new SetterTester()) + .with(new GetterTester()).build(); + validator.validate(POJO_PACKAGE, new FilterPackageInfo()); + } +} |