* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
- * Modification Copyright (C) 2018 IBM
+ * Modifications Copyright (C) 2018 IBM
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@Test
public void testProcessMissingParamKeys() throws Exception {
- PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
Map<String, String> inParams = new HashMap<String, String>();
inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
@Test(expected = SvcLogicException.class)
public void testInProcessMissingParamKeysForEmptyPdContent() throws Exception {
- PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
Map<String, String> inParams = new HashMap<String, String>();
inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
String jsonData = IOUtils.toString(
@Test
public void testProcessExternalSystemParamKeys() throws Exception {
- PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
Map<String, String> inParams = new HashMap<String, String>();
inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
@Test
public void mergeJsonData() throws Exception {
- PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
Map<String, String> inParams = new HashMap<String, String>();
inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
@Test
public void mergeJsonDataForEmptyParams() throws SvcLogicException, IOException {
- PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
Map<String, String> inParams = new HashMap<String, String>();
inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
String mergeJsonData = IOUtils.toString(
}
+ @Test(expected = SvcLogicException.class)
+ public void testMergeJsonDataCatchPortion() throws Exception {
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+ SvcLogicContext ctx = new SvcLogicContext();
+ propertyDefinitionNode.mergeJsonData(inParams, ctx);
+ }
+
@Test
public void testArtificatTransformer() throws Exception {
ArtificatTransformer transformer = new ArtificatTransformer();
@Test
public void testValidationPd() throws Exception {
- PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
Map<String, String> inParams = new HashMap<String, String>();
SvcLogicContext ctx = new SvcLogicContext();
String jsonData = IOUtils.toString(
inParams.put(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME, "INSTAR");
propertyDefinitionNode.validateParams(inParams, ctx);
}
+
+ @Test(expected=SvcLogicException.class)
+ public void testValidateParamsForEmptyParams() throws Exception
+ {
+ Map<String, String> inParams = new HashMap<String, String>();
+ SvcLogicContext ctx = new SvcLogicContext();
+ propertyDefinitionNode.validateParams(inParams, ctx);
+ }
+
+ @Test
+ public void testValidateParamsForEmptyConfigParams() throws Exception
+ {
+ Map<String, String> inParams = new HashMap<String, String>();
+ String jsonData = IOUtils.toString(
+ TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"),
+ Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, jsonData);
+ SvcLogicContext ctx = new SvcLogicContext();
+ propertyDefinitionNode.validateParams(inParams, ctx);
+ String status = ctx.getAttribute("status");
+ assertEquals(ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS,status);
+ }
}