@Override
public C get(final PfConceptKey conceptKey) {
- return new PfConceptGetterImpl<>((NavigableMap<PfConceptKey, C>) conceptMap).get(conceptKey);
+ if (conceptKey.isNullVersion()) {
+ return get(conceptKey.getName());
+ } else {
+ return new PfConceptGetterImpl<>((NavigableMap<PfConceptKey, C>) conceptMap).get(conceptKey);
+ }
}
@Override
Assertions.argumentNotNull(conceptKeyName, "conceptKeyName may not be null");
// The very fist key that could have this name
- final PfConceptKey lowestArtifactKey = new PfConceptKey(conceptKeyName, "0.0.1");
+ final PfConceptKey lowestArtifactKey = new PfConceptKey(conceptKeyName, PfKey.NULL_KEY_VERSION);
// Check if we found a key for our name
PfConceptKey foundKey = conceptMap.ceilingKey(lowestArtifactKey);
package org.onap.policy.models.provider.revisionhierarchy;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.assertj.core.api.Assertions.assertThatCode;
import java.util.Base64;
import org.junit.Test;
import org.onap.policy.common.utils.coder.YamlJsonTranslator;
import org.onap.policy.common.utils.resources.TextFileUtils;
-import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderFactory;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
}
@Test
- public void testInitAndClose() throws Exception {
+ public void testMultipleVersions() throws Exception {
PolicyModelsProvider databaseProvider =
new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
.getTextFileAsString("src/test/resources/servicetemplates/MultipleRevisionServiceTemplate.yaml"),
ToscaServiceTemplate.class);
- assertThatThrownBy(() -> {
+ assertThatCode(() -> {
databaseProvider.createPolicies(serviceTemplate);
- }).isInstanceOf(PfModelRuntimeException.class);
+ }).doesNotThrowAnyException();
databaseProvider.close();
}