Add POJOs to support policy design API 56/79056/4
authorChenfei Gao <cgao@research.att.com>
Sat, 23 Feb 2019 01:10:11 +0000 (20:10 -0500)
committerChenfei Gao <cgao@research.att.com>
Tue, 26 Feb 2019 14:31:23 +0000 (09:31 -0500)
Includes:
a) Added POJOs for TOSCA policy type
b) Added POJOs for TOSCA policy
c) Added POJOs for TOSCA custom data type
d) Added junit tests for POJOs

Issue-ID: POLICY-1515
Change-Id: I230b32339c60b7cd3c0b66adfc3f2b1bb38265c5
Signed-off-by: Chenfei Gao <cgao@research.att.com>
14 files changed:
platform/pom.xml [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaConstraint.java [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaDataType.java [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaEntrySchema.java [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaEventFilter.java [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicy.java [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyList.java [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyType.java [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyTypeList.java [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaProperty.java [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaTimeInterval.java [new file with mode: 0644]
platform/src/main/java/org/onap/policy/model/tosca/ToscaTrigger.java [new file with mode: 0644]
platform/src/test/java/org/onap/policy/tosca/TestPojos.java [new file with mode: 0644]
pom.xml

diff --git a/platform/pom.xml b/platform/pom.xml
new file mode 100644 (file)
index 0000000..2453cfc
--- /dev/null
@@ -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 (file)
index 0000000..21ae4c5
--- /dev/null
@@ -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 (file)
index 0000000..607c53c
--- /dev/null
@@ -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 (file)
index 0000000..b036dc6
--- /dev/null
@@ -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 (file)
index 0000000..74277d3
--- /dev/null
@@ -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 (file)
index 0000000..8f72dcb
--- /dev/null
@@ -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 (file)
index 0000000..ecc1251
--- /dev/null
@@ -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 (file)
index 0000000..8bb5200
--- /dev/null
@@ -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 (file)
index 0000000..d5ca357
--- /dev/null
@@ -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 (file)
index 0000000..6196637
--- /dev/null
@@ -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 (file)
index 0000000..d63b4e0
--- /dev/null
@@ -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 (file)
index 0000000..f5ca07c
--- /dev/null
@@ -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 (file)
index 0000000..e86c759
--- /dev/null
@@ -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());
+    }
+}
diff --git a/pom.xml b/pom.xml
index 922e16f..f0eb859 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -2,6 +2,7 @@
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
    Copyright (C) 2019 Nordix Foundation.
+   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.
         <sonar.jacoco.reportPath>${project.basedir}/../target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>
         <sonar.jacoco.itReportPath>${project.basedir}/../target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>
         <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
+
+        <policy.common.version>1.4.0-SNAPSHOT</policy.common.version>
     </properties>
 
     <modules>
+        <module>platform</module>
     </modules>
 
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
     <distributionManagement>
         <site>
             <id>ecomp-site</id>