/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfReferenceKey;
+import org.onap.policy.models.base.Validated;
import org.onap.policy.models.dao.DaoParameters;
import org.onap.policy.models.dao.PfDao;
import org.onap.policy.models.dao.PfDaoFactory;
assertThatThrownBy(() -> {
originalServiceTemplate.fromAuthorative(toscaServiceTemplate);
- }).hasMessage("PolicyType type not specified, the type of the PolicyType for this policy must be "
- + "specified in the type field");
+ }).hasMessage("Type not specified, the type of this TOSCA entity must be specified in the type field");
toscaPolicy.setType("IDontExist");
assertThatThrownBy(() -> {
originalServiceTemplate.fromAuthorative(toscaServiceTemplate);
- }).hasMessage("PolicyType version not specified, the version of the PolicyType for this policy must be "
+ }).hasMessage("Version not specified, the version of this TOSCA entity must be "
+ "specified in the type_version field");
toscaPolicy.setTypeVersion("hello");
assertThatThrownBy(() -> {
new SimpleToscaProvider().createPolicies(pfDao, originalServiceTemplate);
- }).hasMessageContaining("policy type IDontExist:99.100.101 referenced in policy not found");
+ }).hasMessageContaining("policy type").hasMessageContaining("IDontExist:99.100.101")
+ .hasMessageContaining(Validated.NOT_FOUND);
toscaPolicy.setType("IDontExist");
originalServiceTemplate.fromAuthorative(toscaServiceTemplate);
assertThatThrownBy(() -> {
originalServiceTemplate.fromAuthorative(toscaServiceTemplate);
- }).hasMessage("PolicyType type not specified, the type of the PolicyType for this policy must be "
- + "specified in the type field");
+ }).hasMessage("Type not specified, the type of this TOSCA entity must be specified in the type field");
toscaPolicy.setType(originalPolicyType);
toscaPolicy.setTypeVersion(originalPolicyTypeVersion);
serviceTemplateFragment.getPolicyTypes().getConceptMap().put(badPt.getKey(), badPt);
assertThatThrownBy(() -> new SimpleToscaProvider().appendToServiceTemplate(pfDao, serviceTemplateFragment))
- .hasMessageContaining(
- "key on concept entry PfConceptKey(name=NULL, version=0.0.0) may not be the null key");
+ .hasMessageContaining("key on concept entry").hasMessageContaining("NULL:0.0.0")
+ .hasMessageContaining(Validated.IS_A_NULL_KEY);
}
@Test