diff options
Diffstat (limited to 'ms/controllerblueprints')
3 files changed, 95 insertions, 1 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java index 6ec39ab5..b6f0f001 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java @@ -49,7 +49,7 @@ public class ConfigModelSearch implements Serializable { @Column(name = "internal_version")
private Integer internalVersion;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@LastModifiedDate
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "creation_date")
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelServiceTest.java new file mode 100644 index 00000000..d6a71e01 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelServiceTest.java @@ -0,0 +1,36 @@ +/* + * Copyright © 2018 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.service; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import java.lang.System; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException; +import org.onap.ccsdk.apps.controllerblueprints.service.repository.ConfigModelContentRepository; +import org.onap.ccsdk.apps.controllerblueprints.service.repository.ConfigModelRepository; + +public class ConfigModelServiceTest { + private ConfigModelService configModelService; + + @Test(expected = NullPointerException.class) + public void testGetInitialConfigModel() throws BluePrintException { + Assert.assertEquals(null, configModelService.getInitialConfigModel("")); + } +} diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java new file mode 100644 index 00000000..a5eb661a --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java @@ -0,0 +1,58 @@ +/* + * Copyright © 2018 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.service.validator; + +import static org.junit.Assert.*; + +import org.junit.*; +import org.onap.ccsdk.apps.controllerblueprints.service.validator.ModelTypeValidator; +import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType; +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException; + +import com.fasterxml.jackson.databind.JsonNode; + +public class ModelTypeValidatorTest { + + @Before + public void setup(){ + ModelTypeValidator modelTypeValidator; + } + + @Test + public void testGetValidModelDefinitionType_definitionContentNULL() throws Exception{ + String definitionType=null; + JsonNode definitionContent=null; + boolean valid= ModelTypeValidator.validateModelTypeDefinition(definitionType, definitionContent); + Assert.assertTrue(valid); + + } + + @Test(expected=BluePrintException.class) + public void testvalidateModelType() throws Exception{ + ModelType modelType = new ModelType(); + modelType.setDefinitionType(""); + modelType.setDerivedFrom(""); + modelType.setDescription(""); + JsonNode definitionContent=null; + modelType.setDefinition(definitionContent); + modelType.setModelName(""); + modelType.setVersion(""); + modelType.setTags(""); + modelType.setUpdatedBy(""); + ModelTypeValidator.validateModelType(modelType); + } +} |