/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 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.
@EqualsAndHashCode(callSuper = false)
public class TopicParameters extends BusTopicParams {
private String topicCommInfrastructure;
+
+ public TopicParameters() {
+ // this defaults to true
+ setManaged(true);
+ }
}
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
* Modifications Copyright (C) 2019 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.junit.Test;
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
/**
private static final Coder coder = new StandardCoder();
@Test
- public void test() {
+ public void test() throws CoderException {
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParameterGroupMap(false), TopicParameterGroup.class);
final GroupValidationResult validationResult = topicParameterGroup.validate();
assertTrue(validationResult.isValid());
assertEquals(CommonTestData.TOPIC_PARAMS, topicParameterGroup.getTopicSinks());
assertEquals(CommonTestData.TOPIC_PARAMS, topicParameterGroup.getTopicSources());
+
+ // these should default to true
+ assertTrue(new TopicParameters().isManaged());
+ assertTrue(coder.decode("{}", TopicParameters.class).isManaged());
+
+ // but can be overridden
+ assertFalse(coder.decode("{'managed':false}".replace('\'', '"'), TopicParameters.class).isManaged());
}
@Test