aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/clamp/clds/dao/CldsDao.java30
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsModel.java266
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsService.java12
-rw-r--r--src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java4
-rw-r--r--src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java7
5 files changed, 33 insertions, 286 deletions
diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
index 7e42b296..7bef430d 100644
--- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
+++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
@@ -65,7 +65,6 @@ public class CldsDao {
private SimpleJdbcCall procGetTemplate;
private SimpleJdbcCall procDelAllModelInstances;
private SimpleJdbcCall procInsModelInstance;
- private SimpleJdbcCall procDelModelInstance;
private static final String HEALTHCHECK = "Select 1";
/**
@@ -77,8 +76,6 @@ public class CldsDao {
/**
* When dataSource is provided, instantiate spring jdbc objects.
- *
- * @param dataSource
*/
public void setDataSource(DataSource dataSource) {
this.jdbcTemplateObject = new JdbcTemplate(dataSource);
@@ -90,15 +87,11 @@ public class CldsDao {
this.procGetTemplate = new SimpleJdbcCall(dataSource).withProcedureName("get_template");
this.procSetTemplate = new SimpleJdbcCall(dataSource).withProcedureName("set_template");
this.procInsModelInstance = new SimpleJdbcCall(dataSource).withProcedureName("ins_model_instance");
- this.procDelModelInstance = new SimpleJdbcCall(dataSource).withProcedureName("del_model_instance");
this.procDelAllModelInstances = new SimpleJdbcCall(dataSource).withProcedureName("del_all_model_instances");
}
/**
* Get a model from the database given the model name.
- *
- * @param modelName
- * @return model
*/
public CldsModel getModel(String modelName) {
return getModel(modelName, null);
@@ -106,9 +99,6 @@ public class CldsDao {
/**
* Get a model from the database given the controlNameUuid.
- *
- * @param controlNameUuid
- * @return model
*/
public CldsModel getModelByUuid(String controlNameUuid) {
return getModel(null, controlNameUuid);
@@ -126,17 +116,9 @@ public class CldsDao {
model.setId((String) (out.get("v_model_id")));
model.setTemplateId((String) (out.get("v_template_id")));
model.setTemplateName((String) (out.get("v_template_name")));
- model.setBpmnId((String) (out.get("v_template_bpmn_id")));
- model.setBpmnUserid((String) out.get("v_template_bpmn_user_id"));
model.setBpmnText((String) out.get("v_template_bpmn_text"));
- model.setPropId((String) (out.get("v_model_prop_id")));
- model.setPropUserid((String) out.get("v_model_prop_user_id"));
model.setPropText((String) out.get("v_model_prop_text"));
- model.setImageId((String) (out.get("v_template_image_id")));
- model.setImageUserid((String) out.get("v_template_image_user_id"));
model.setImageText((String) out.get("v_template_image_text"));
- model.setDocId((String) (out.get("v_template_doc_id")));
- model.setDocUserid((String) out.get("v_template_doc_user_id"));
model.setDocText((String) out.get("v_template_doc_text"));
model.setBlueprintText((String) out.get("v_model_blueprint_text"));
model.getEvent().setId((String) (out.get("v_event_id")));
@@ -167,17 +149,9 @@ public class CldsDao {
model.setId((String) (out.get("v_model_id")));
model.setTemplateId((String) (out.get("v_template_id")));
model.setTemplateName((String) (out.get("v_template_name")));
- model.setBpmnId((String) (out.get("v_template_bpmn_id")));
- model.setBpmnUserid((String) out.get("v_template_bpmn_user_id"));
model.setBpmnText((String) out.get("v_template_bpmn_text"));
- model.setPropId((String) (out.get("v_model_prop_id")));
- model.setPropUserid((String) out.get("v_model_prop_user_id"));
model.setPropText((String) out.get("v_model_prop_text"));
- model.setImageId((String) (out.get("v_template_image_id")));
- model.setImageUserid((String) out.get("v_template_image_user_id"));
model.setImageText((String) out.get("v_template_image_text"));
- model.setDocId((String) (out.get("v_template_doc_id")));
- model.setDocUserid((String) out.get("v_template_doc_user_id"));
model.setDocText((String) out.get("v_template_doc_text"));
model.setBlueprintText((String) out.get("v_model_blueprint_text"));
model.getEvent().setId((String) (out.get("v_event_id")));
@@ -226,10 +200,6 @@ public class CldsDao {
model.setControlNamePrefix((String) out.get("v_control_name_prefix"));
model.setControlNameUuid((String) out.get("v_control_name_uuid"));
model.setId((String) (out.get("v_model_id")));
- model.setPropId((String) (out.get("v_model_prop_id")));
- model.setPropUserid((String) (out.get("v_model_prop_user_id")));
- model.setBlueprintId((String) (out.get("v_model_blueprint_id")));
- model.setBlueprintUserid((String) out.get("v_model_blueprint_user_id"));
model.getEvent().setId((String) (out.get("v_event_id")));
model.getEvent().setActionCd((String) out.get("v_action_cd"));
model.getEvent().setActionStateCd((String) out.get("v_action_state_cd"));
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsModel.java b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
index 62b10d44..55ea4ec2 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsModel.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
@@ -39,55 +39,34 @@ import org.onap.clamp.clds.dao.CldsDao;
* Represent a CLDS Model.
*/
public class CldsModel {
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsModel.class);
- protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
-
- private static final int UUID_LENGTH = 36;
-
- public static final String STATUS_DESIGN = "DESIGN";
- public static final String STATUS_DISTRIBUTED = "DISTRIBUTED";
- public static final String STATUS_ACTIVE = "ACTIVE";
- public static final String STATUS_STOPPED = "STOPPED";
- public static final String STATUS_DELETING = "DELETING";
- public static final String STATUS_ERROR = "ERROR"; // manual
- // intervention
- // required
- public static final String STATUS_UNKNOWN = "UNKNOWN";
-
- private String id;
- private String templateId;
- private String templateName;
- private String name;
- private String controlNamePrefix;
- private String controlNameUuid;
- private String bpmnId;
- private String bpmnUserid;
- private String bpmnText;
- private String propId;
- private String propUserid;
- private String propText;
- private String imageId;
- private String imageUserid;
- private String imageText;
- private String docId;
- private String docUserid;
- private String docText;
- private String blueprintId;
- private String blueprintUserid;
- private String blueprintText;
- private CldsEvent event;
- private String status;
- private List<String> permittedActionCd;
- private List<CldsModelInstance> cldsModelInstanceList;
-
- private String typeId;
- private String typeName;
-
- private String dispatcherResponse;
-
- private String deploymentId;
-
- private boolean userAuthorizedToUpdate;
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsModel.class);
+ private static final int UUID_LENGTH = 36;
+ private static final String STATUS_DESIGN = "DESIGN";
+ private static final String STATUS_DISTRIBUTED = "DISTRIBUTED";
+ private static final String STATUS_ACTIVE = "ACTIVE";
+ private static final String STATUS_STOPPED = "STOPPED";
+ private static final String STATUS_DELETING = "DELETING";
+ private static final String STATUS_ERROR = "ERROR";
+ private static final String STATUS_UNKNOWN = "UNKNOWN";
+ private String id;
+ private String templateId;
+ private String templateName;
+ private String name;
+ private String controlNamePrefix;
+ private String controlNameUuid;
+ private String bpmnText;
+ private String propText;
+ private String imageText;
+ private String docText;
+ private String blueprintText;
+ private CldsEvent event;
+ private String status;
+ private List<String> permittedActionCd;
+ private List<CldsModelInstance> cldsModelInstanceList;
+ private String typeId;
+ private String typeName;
+ private String deploymentId;
/**
* Construct empty model.
@@ -98,10 +77,6 @@ public class CldsModel {
/**
* Retrieve from DB.
- *
- * @param cldsDao
- * @param name
- * @return
*/
public static CldsModel retrieve(CldsDao cldsDao, String name, boolean okIfNotFound) {
// get from db
@@ -126,9 +101,6 @@ public class CldsModel {
/**
* Save model to DB.
- *
- * @param cldsDao
- * @param userid
*/
public void save(CldsDao cldsDao, String userid) {
cldsDao.setModel(this, userid);
@@ -137,32 +109,6 @@ public class CldsModel {
}
/**
- * Insert a new event for the new action. Throw IllegalArgumentException if
- * requested actionCd is not permitted.
- *
- * @param cldsDao
- * @param userid
- * @param actionCd
- * @param actionStateCd
- */
- public void insEvent(CldsDao cldsDao, String userid, String actionCd, String actionStateCd) {
- validateAction(actionCd);
- event = CldsEvent.insEvent(cldsDao, this, userid, actionCd, actionStateCd, null);
- determineStatus();
- determinePermittedActionCd();
- }
-
- /**
- * Update event with processInstanceId
- *
- * @param cldsDao
- * @param processInstanceId
- */
- public void updEvent(CldsDao cldsDao, String processInstanceId) {
- cldsDao.updEvent(event.getId(), processInstanceId);
- }
-
- /**
* set the status in the model
*/
private void determineStatus() {
@@ -196,8 +142,6 @@ public class CldsModel {
/**
* Get the actionCd from current event. If none, default value is
* CldsEvent.ACTION_CREATE
- *
- * @return
*/
private String getCurrentActionCd() {
// current default actionCd is CREATE
@@ -211,8 +155,6 @@ public class CldsModel {
/**
* Get the actionStateCd from current event. If none, default value is
* CldsEvent.ACTION_STATE_COMPLETED
- *
- * @return
*/
private String getCurrentActionStateCd() {
// current default actionStateCd is CREATE
@@ -279,8 +221,6 @@ public class CldsModel {
* Validate requestedActionCd - determine permittedActionCd and then check
* if contained in permittedActionCd Throw IllegalArgumentException if
* requested actionCd is not permitted.
- *
- * @param requestedActionCd
*/
public void validateAction(String requestedActionCd) {
determinePermittedActionCd();
@@ -296,9 +236,6 @@ public class CldsModel {
* + controlNameUuid). No fields are populated other than controlNamePrefix
* and controlNameUuid. Throws BadRequestException if length of given
* control name is less than UUID_LENGTH.
- *
- * @param fullControlName
- * @return
*/
public static CldsModel createUsingControlName(String fullControlName) {
if (fullControlName == null || fullControlName.length() < UUID_LENGTH) {
@@ -321,9 +258,6 @@ public class CldsModel {
/**
* To insert modelInstance to the database
- *
- * @param cldsDao
- * @param dcaeEvent
*/
public static CldsModel insertModelInstance(CldsDao cldsDao, DcaeEvent dcaeEvent, String userid) {
String controlName = dcaeEvent.getControlName();
@@ -341,24 +275,6 @@ public class CldsModel {
}
/**
- * To remove modelInstance from the database This method is defunct - DCAE
- * Proxy will not undeploy individual instances. It will send an empty list
- * of deployed instances to indicate all have been removed. Or it will send
- * an updated list to indicate those that are still deployed with any not on
- * the list considered undeployed.
- *
- * @param cldsDao
- * @param dcaeEvent
- */
- @SuppressWarnings("unused")
- private static CldsModel removeModelInstance(CldsDao cldsDao, DcaeEvent dcaeEvent) {
- String controlName = dcaeEvent.getControlName();
- // cldsModel = cldsDao.delModelInstance(cldsModel.getControlNameUuid(),
- // dcaeEvent.getInstances() );
- return createUsingControlName(controlName);
- }
-
- /**
* @return the name
*/
public String getName() {
@@ -380,10 +296,6 @@ public class CldsModel {
return typeName;
}
- /**
- * @param name
- * the typeName to set
- */
public void setTypeName(String typeName) {
this.typeName = typeName;
}
@@ -427,21 +339,6 @@ public class CldsModel {
}
/**
- * @return the propUserid
- */
- public String getPropUserid() {
- return propUserid;
- }
-
- /**
- * @param propUserid
- * the propUserid to set
- */
- public void setPropUserid(String propUserid) {
- this.propUserid = propUserid;
- }
-
- /**
* @return the propText
*/
public String getPropText() {
@@ -479,14 +376,6 @@ public class CldsModel {
this.templateName = templateName;
}
- public String getPropId() {
- return propId;
- }
-
- public void setPropId(String propId) {
- this.propId = propId;
- }
-
/**
* @param event
* the event to set
@@ -510,37 +399,6 @@ public class CldsModel {
this.status = status;
}
- /**
- * @return the permittedActionCd
- */
- public List<String> getPermittedActionCd() {
- return permittedActionCd;
- }
-
- /**
- * @param permittedActionCd
- * the permittedActionCd to set
- */
- public void setPermittedActionCd(List<String> permittedActionCd) {
- this.permittedActionCd = permittedActionCd;
- }
-
- public String getBlueprintId() {
- return blueprintId;
- }
-
- public void setBlueprintId(String blueprintId) {
- this.blueprintId = blueprintId;
- }
-
- public String getBlueprintUserid() {
- return blueprintUserid;
- }
-
- public void setBlueprintUserid(String blueprintUserid) {
- this.blueprintUserid = blueprintUserid;
- }
-
public String getBlueprintText() {
return blueprintText;
}
@@ -549,22 +407,6 @@ public class CldsModel {
this.blueprintText = blueprintText;
}
- public String getBpmnId() {
- return bpmnId;
- }
-
- public void setBpmnId(String bpmnId) {
- this.bpmnId = bpmnId;
- }
-
- public String getBpmnUserid() {
- return bpmnUserid;
- }
-
- public void setBpmnUserid(String bpmnUserid) {
- this.bpmnUserid = bpmnUserid;
- }
-
public String getBpmnText() {
return bpmnText;
}
@@ -573,22 +415,6 @@ public class CldsModel {
this.bpmnText = bpmnText;
}
- public String getImageId() {
- return imageId;
- }
-
- public void setImageId(String imageId) {
- this.imageId = imageId;
- }
-
- public String getImageUserid() {
- return imageUserid;
- }
-
- public void setImageUserid(String imageUserid) {
- this.imageUserid = imageUserid;
- }
-
public String getImageText() {
return imageText;
}
@@ -597,22 +423,6 @@ public class CldsModel {
this.imageText = imageText;
}
- public String getDocId() {
- return docId;
- }
-
- public void setDocId(String docId) {
- this.docId = docId;
- }
-
- public String getDocUserid() {
- return docUserid;
- }
-
- public void setDocUserid(String docUserid) {
- this.docUserid = docUserid;
- }
-
public String getDocText() {
return docText;
}
@@ -636,19 +446,6 @@ public class CldsModel {
return cldsModelInstanceList;
}
- public void setCldsModelInstanceList(List<CldsModelInstance> cldsModelInstanceList) {
- this.cldsModelInstanceList = cldsModelInstanceList;
- }
-
- public void setDispatcherResponse(String dispatcherResponse) {
- this.dispatcherResponse = dispatcherResponse;
-
- }
-
- public String getDispatcherResponse() {
- return this.dispatcherResponse;
- }
-
public String getDeploymentId() {
return deploymentId;
}
@@ -657,11 +454,4 @@ public class CldsModel {
this.deploymentId = deploymentId;
}
- public boolean isUserAuthorizedToUpdate() {
- return userAuthorizedToUpdate;
- }
-
- public void setUserAuthorizedToUpdate(boolean userAuthorizedToUpdate) {
- this.userAuthorizedToUpdate = userAuthorizedToUpdate;
- }
}
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java
index bbcfd5d2..3c9e4704 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -151,13 +151,6 @@ public class CldsService extends SecureServiceBase {
@Autowired
private DcaeInventoryServices dcaeInventoryServices;
- public CldsService() {
- }
-
- public CldsService(RefProp refProp) {
- this.refProp = refProp;
- }
-
/*
*
* CLDS IFO service will return 3 things 1. User Name 2. CLDS code version
@@ -295,7 +288,6 @@ public class CldsService extends SecureServiceBase {
logger.debug("GET model for modelName={}", modelName);
CldsModel cldsModel = CldsModel.retrieve(cldsDao, modelName, false);
isAuthorizedForVf(cldsModel);
- cldsModel.setUserAuthorizedToUpdate(isAuthorizedNoException(permissionUpdateCl));
/**
* Checking condition whether our CLDS model can call INventory Method
*/
@@ -343,7 +335,6 @@ public class CldsService extends SecureServiceBase {
if (template != null) {
cldsModel.setTemplateId(template.getId());
cldsModel.setDocText(template.getPropText());
- cldsModel.setDocId(template.getPropId());
}
}
cldsModel.save(cldsDao, getUserId());
@@ -426,7 +417,6 @@ public class CldsService extends SecureServiceBase {
if (template != null) {
model.setTemplateId(template.getId());
model.setDocText(template.getPropText());
- model.setDocId(template.getPropId());
}
}
// save model to db
@@ -833,7 +823,7 @@ public class CldsService extends SecureServiceBase {
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public CldsModel deployModel(@PathParam("action") String action, @PathParam("modelName") String modelName,
- @QueryParam("test") String test, CldsModel model) throws IOException {
+ @QueryParam("test") String test, CldsModel model) {
Date startTime = new Date();
LoggingUtils.setRequestContext("CldsService: Deploy model", getPrincipalName());
try {
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java
index 6373e153..f09fd9b1 100644
--- a/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java
@@ -73,7 +73,7 @@ public class CldsDaoItCase extends AbstractItCase {
}
@Test
- public void testModelSave() throws IOException {
+ public void testModelSave() {
String randomNameTemplate = RandomStringUtils.randomAlphanumeric(5);
// Add the template first
CldsTemplate newTemplate = new CldsTemplate();
@@ -97,7 +97,6 @@ public class CldsDaoItCase extends AbstractItCase {
newModel.setTemplateName(randomNameTemplate);
newModel.setTemplateId(newTemplate.getId());
newModel.setDocText(newTemplate.getPropText());
- newModel.setDocId(newTemplate.getPropId());
// Save the model in DB
cldsDao.setModel(newModel, "user");
// Test if the model can be retrieved
@@ -139,7 +138,6 @@ public class CldsDaoItCase extends AbstractItCase {
newModel.setTemplateName("test-template-for-event");
newModel.setTemplateId(newTemplate.getId());
newModel.setDocText(newTemplate.getPropText());
- newModel.setDocId(newTemplate.getPropId());
CldsEvent.insEvent(cldsDao, newModel, "user", CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_COMPLETED,
"process-instance-id");
}
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java
index 0f65ef0c..9dac2dc1 100644
--- a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java
@@ -85,7 +85,7 @@ public class CldsServiceItCase extends AbstractItCase {
}
@Test
- public void testCldsInfoNotAuthorized() throws Exception {
+ public void testCldsInfoNotAuthorized() {
SecurityContext securityContext = Mockito.mock(SecurityContext.class);
Principal principal = Mockito.mock(Principal.class);
Mockito.when(principal.getName()).thenReturn("admin");
@@ -123,7 +123,7 @@ public class CldsServiceItCase extends AbstractItCase {
}
@Test
- public void testGetHealthCheck() throws Exception {
+ public void testGetHealthCheck() {
CldsHealthCheck cldsHealthCheck = cldsService.gethealthcheck();
assertNotNull(cldsHealthCheck);
assertEquals("UP", cldsHealthCheck.getHealthCheckStatus());
@@ -132,7 +132,7 @@ public class CldsServiceItCase extends AbstractItCase {
}
@Test
- public void testPutModel() throws Exception {
+ public void testPutModel() {
SecurityContext securityContext = Mockito.mock(SecurityContext.class);
Principal principal = Mockito.mock(Principal.class);
Mockito.when(principal.getName()).thenReturn("admin");
@@ -164,7 +164,6 @@ public class CldsServiceItCase extends AbstractItCase {
newModel.setTemplateName("test-template");
newModel.setTemplateId(newTemplate.getId());
newModel.setDocText(newTemplate.getPropText());
- newModel.setDocId(newTemplate.getPropId());
// Test the PutModel method
String randomNameModel = RandomStringUtils.randomAlphanumeric(5);
cldsService.putModel(randomNameModel, newModel);