From 237dd48cacfeda0b39ec1c09ce23fe59787e9e14 Mon Sep 17 00:00:00 2001 From: Chenfei Gao Date: Fri, 22 Feb 2019 20:10:11 -0500 Subject: Add POJOs to support policy design API 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 --- platform/pom.xml | 70 ++++++++++++++++ .../onap/policy/model/tosca/ToscaConstraint.java | 93 ++++++++++++++++++++++ .../org/onap/policy/model/tosca/ToscaDataType.java | 70 ++++++++++++++++ .../onap/policy/model/tosca/ToscaEntrySchema.java | 54 +++++++++++++ .../onap/policy/model/tosca/ToscaEventFilter.java | 53 ++++++++++++ .../org/onap/policy/model/tosca/ToscaPolicy.java | 70 ++++++++++++++++ .../onap/policy/model/tosca/ToscaPolicyList.java | 50 ++++++++++++ .../onap/policy/model/tosca/ToscaPolicyType.java | 75 +++++++++++++++++ .../policy/model/tosca/ToscaPolicyTypeList.java | 50 ++++++++++++ .../org/onap/policy/model/tosca/ToscaProperty.java | 74 +++++++++++++++++ .../onap/policy/model/tosca/ToscaTimeInterval.java | 48 +++++++++++ .../org/onap/policy/model/tosca/ToscaTrigger.java | 88 ++++++++++++++++++++ .../test/java/org/onap/policy/tosca/TestPojos.java | 53 ++++++++++++ pom.xml | 12 +++ 14 files changed, 860 insertions(+) create mode 100644 platform/pom.xml create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaConstraint.java create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaDataType.java create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaEntrySchema.java create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaEventFilter.java create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicy.java create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyList.java create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyType.java create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaPolicyTypeList.java create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaProperty.java create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaTimeInterval.java create mode 100644 platform/src/main/java/org/onap/policy/model/tosca/ToscaTrigger.java create mode 100644 platform/src/test/java/org/onap/policy/tosca/TestPojos.java 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 @@ + + + 4.0.0 + + org.onap.policy.models + policy-models + 2.1.0-SNAPSHOT + + + platform + + ${project.artifactId} + The platform models that are shared across different policy components + + + + org.projectlombok + lombok + 1.18.4 + provided + + + com.google.code.gson + gson + + + org.onap.policy.common + utils + ${policy.common.version} + + + + + + + + src/main/resources + true + + **/version.txt + + + + src/main/resources + false + + **/version.txt + + + + + \ 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 metadata; + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("constraints") + private List constraints; + + @Getter + @Setter + @SerializedName("properties") + private List> 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 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 metadata; + + @Getter + @Setter + @SerializedName("properties") + private List> properties; + + @Getter + @Setter + @SerializedName("targets") + private List targets; + + @Getter + @Setter + @SerializedName("triggers") + private List> 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> policies; + + @Getter + @Setter + @SerializedName("data_types") + private List> 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 metadata; + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("properties") + private List> properties; + + @Getter + @Setter + @SerializedName("targets") + private List targets; + + @Getter + @Setter + @SerializedName("triggers") + private List> 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> policyTypes; + + @Getter + @Setter + @SerializedName("data_types") + private List> 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 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()); + } +} diff --git a/pom.xml b/pom.xml index 922e16f98..f0eb859a2 100644 --- 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. @@ -41,11 +42,22 @@ ${project.basedir}/../target/code-coverage/jacoco-ut.exec ${project.basedir}/../target/code-coverage/jacoco-it.exec reuseReports + + 1.4.0-SNAPSHOT + platform + + + junit + junit + test + + + ecomp-site -- cgit 1.2.3-korg