aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/PolicyUtilsTest.java
blob: 5b5718f6881df594dcfb986e4800ff2b25cb0dff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package org.openecomp.sdc.be.components.validation;

import fj.data.Either;
import mockit.Deencapsulation;
import org.junit.Test;
import org.openecomp.sdc.be.components.BeConfDependentTest;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;

import java.util.Map;
import java.util.Set;

public class PolicyUtilsTest extends BeConfDependentTest{

	@Test
	public void testGetNextPolicyCounter() throws Exception {
		Map<String, PolicyDefinition> policies = null;
		int result;

		// default test
		result = PolicyUtils.getNextPolicyCounter(policies);
	}

	@Test
	public void testValidatePolicyFields() throws Exception {
		PolicyDefinition recievedPolicy = new PolicyDefinition();
		PolicyDefinition validPolicy = new PolicyDefinition();
		Map<String, PolicyDefinition> policies = null;
		Either<PolicyDefinition, ActionStatus> result;

		// default test
		result = PolicyUtils.validatePolicyFields(recievedPolicy, validPolicy, policies);
	}

	@Test
	public void testGetExcludedPolicyTypesByComponent() throws Exception {
		Component component = new Resource();
		Set<String> result;

		// default test
		result = PolicyUtils.getExcludedPolicyTypesByComponent(component);
		component = new Service();
		result = PolicyUtils.getExcludedPolicyTypesByComponent(component);
	}

	@Test
	public void testExtractNextPolicyCounterFromUniqueId() throws Exception {
		String uniqueId = "";
		int result;

		// default test
		result = Deencapsulation.invoke(PolicyUtils.class, "extractNextPolicyCounterFromUniqueId",
				new Object[] { uniqueId });
	}

	@Test
	public void testExtractNextPolicyCounterFromName() throws Exception {
		String policyName = "";
		int result;

		// default test
		result = Deencapsulation.invoke(PolicyUtils.class, "extractNextPolicyCounterFromName",
				new Object[] { policyName });
	}

	@Test
	public void testExtractNextPolicyCounter() throws Exception {
		String policyName = "";
		int endIndex = 0;
		int result;

		// default test
		result = Deencapsulation.invoke(PolicyUtils.class, "extractNextPolicyCounter",
				new Object[] { policyName, endIndex });
	}

	@Test
	public void testValidateImmutablePolicyFields() throws Exception {
		PolicyDefinition receivedPolicy = new PolicyDefinition();
		PolicyDefinition validPolicy = new PolicyDefinition();

		// default test
		Deencapsulation.invoke(PolicyUtils.class, "validateImmutablePolicyFields",
				receivedPolicy, validPolicy);
	}

	@Test
	public void testIsUpdatedField() throws Exception {
		String oldField = "";
		String newField = "";
		boolean result;

		// default test
		result = Deencapsulation.invoke(PolicyUtils.class, "isUpdatedField", new Object[] { oldField, newField });
	}

	@Test
	public void testLogImmutableFieldUpdateWarning() throws Exception {
		String oldValue = "";
		String newValue = "";
		JsonPresentationFields field = null;

		// default test
		Deencapsulation.invoke(PolicyUtils.class, "logImmutableFieldUpdateWarning",
				new Object[] { oldValue, newValue, JsonPresentationFields.class });
	}
}