aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/ArtifactUtilsTest.java
blob: df398ae69717017353fa88ab14ca07ab1362b79a (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
package org.openecomp.sdc.be.datamodel.utils;

import org.junit.Test;
import org.openecomp.sdc.be.info.ArtifactTemplateInfo;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class ArtifactUtilsTest {

	private ArtifactUtils createTestSubject() {
		return new ArtifactUtils();
	}

	@Test
	public void testFindMasterArtifact() throws Exception {
		Map<String, ArtifactDefinition> deplymentArtifact = new HashMap<>();
		List<ArtifactDefinition> artifacts = new LinkedList<>();
		List<String> artifactsList = new LinkedList<>();
		ArtifactDefinition result;

		// default test
		result = ArtifactUtils.findMasterArtifact(deplymentArtifact, artifacts, artifactsList);
	}

	@Test
	public void testBuildJsonForUpdateArtifact() throws Exception {
		String artifactId = "";
		String artifactName = "";
		String artifactType = "";
		ArtifactGroupTypeEnum artifactGroupType = ArtifactGroupTypeEnum.DEPLOYMENT;
		String label = "";
		String displayName = "";
		String description = "";
		byte[] artifactContentent = new byte[] { ' ' };
		List<ArtifactTemplateInfo> updatedRequiredArtifacts = null;
		boolean isFromCsar = false;
		Map<String, Object> result;

		// test 1
		artifactId = null;
		result = ArtifactUtils.buildJsonForUpdateArtifact(artifactId, artifactName, artifactType, artifactGroupType,
				label, displayName, description, artifactContentent, updatedRequiredArtifacts, isFromCsar);
	}

	@Test
	public void testBuildJsonForArtifact() throws Exception {
		ArtifactTemplateInfo artifactTemplateInfo = new ArtifactTemplateInfo();
		artifactTemplateInfo.setFileName("mock.mock.heat");
		byte[] artifactContentent = new byte[] { ' ' };
		int atrifactLabelCounter = 0;
		Map<String, Object> result;

		// default test
		result = ArtifactUtils.buildJsonForArtifact(artifactTemplateInfo, artifactContentent, atrifactLabelCounter,false);
	}

	@Test
	public void testFindArtifactInList() throws Exception {
		List<ArtifactDefinition> createdArtifacts = new LinkedList<>();
		String artifactId = "mock";
		ArtifactDefinition result;

		// default test
		result = ArtifactUtils.findArtifactInList(createdArtifacts, artifactId);
	}
}