/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
/**
- * Check if policy types have been specified is initialized.
+ * Check if data types have been specified correctly.
+ *
+ * @param serviceTemplate the service template containing data types to be checked
+ */
+ public static void assertDataTypesExist(final JpaToscaServiceTemplate serviceTemplate) {
+ if (serviceTemplate.getDataTypes() == null) {
+ String errorMessage = "no data types specified on service template";
+ LOGGER.warn(errorMessage);
+ throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
+ }
+
+ if (serviceTemplate.getDataTypes().getConceptMap().isEmpty()) {
+ String errorMessage = "list of data types specified on service template is empty";
+ LOGGER.warn(errorMessage);
+ throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
+ }
+ }
+
+ /**
+ * Check if policy types have been specified correctly.
+ *
+ * @param serviceTemplate the service template containing policy types to be checked
*/
public static void assertPolicyTypesExist(final JpaToscaServiceTemplate serviceTemplate) {
if (serviceTemplate.getPolicyTypes() == null) {
}
/**
- * Check if policy types have been specified is initialized.
+ * Check if policies have been specified correctly.
+ *
+ * @param serviceTemplate the service template containing policy types to be checked
*/
public static void assertPoliciesExist(final JpaToscaServiceTemplate serviceTemplate) {
if (serviceTemplate.getTopologyTemplate() == null) {