* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
*/
package org.onap.clamp.clds.it;
import java.io.IOException;
+import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.clamp.clds.AbstractItCase;
-import org.onap.clamp.clds.client.req.TcaRequestFormatter;
+import org.onap.clamp.clds.client.req.tca.TcaRequestFormatter;
+import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.model.CldsEvent;
-import org.onap.clamp.clds.model.prop.ModelProperties;
+import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.util.ResourceFileUtil;
import org.skyscreamer.jsonassert.JSONAssert;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
/**
*/
@RunWith(SpringRunner.class)
@SpringBootTest
-@TestPropertySource(locations = "classpath:application-no-camunda.properties")
-public class TcaRequestFormatterItCase extends AbstractItCase {
+public class TcaRequestFormatterItCase {
- String modelProp;
- String modelBpmn;
- String modelName;
- String controlName;
- String yamlInput;
+ @Autowired
+ private ClampProperties refProp;
+ private String modelProp;
+ private String modelBpmn;
+ private String modelName;
+ private String controlName;
+ private String yamlInput;
+ private ModelProperties modelProperties;
/**
* Initialize Test.
yamlInput = ResourceFileUtil.getResourceAsString("example/tca-policy-req/blueprint-input.yaml");
modelName = "example-model01";
controlName = "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf";
+ modelProperties = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, false, modelBpmn,
+ modelProp);
}
@Test
- public void testCreatePolicyJson() throws IOException {
- ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, false, modelBpmn,
- modelProp);
- String result = TcaRequestFormatter.createPolicyJson(refProp, prop);
+ public void testCreatePolicyJson() throws IOException, JSONException {
+ String result = TcaRequestFormatter.createPolicyJson(refProp, modelProperties);
assertNotNull(result);
JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("example/tca-policy-req/tca-policy-expected.json"),
result, true);
@Test
public void testUpdatedBlueprintWithConfiguration() throws IOException {
- ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, false, modelBpmn,
- modelProp);
- String result = TcaRequestFormatter.updatedBlueprintWithConfiguration(refProp, prop, yamlInput);
-
+ String result = TcaRequestFormatter.updatedBlueprintWithConfiguration(refProp, modelProperties, yamlInput);
assertNotNull(result);
assertEquals(ResourceFileUtil.getResourceAsString("example/tca-policy-req/blueprint-expected.yaml"), result);
}