diff options
Diffstat (limited to 'model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/DummyAxModelWithReferences.java')
-rw-r--r-- | model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/DummyAxModelWithReferences.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/DummyAxModelWithReferences.java b/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/DummyAxModelWithReferences.java new file mode 100644 index 000000000..887755d03 --- /dev/null +++ b/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/DummyAxModelWithReferences.java @@ -0,0 +1,71 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. 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. + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.model.basicmodel.handling; + +import java.util.ArrayList; +import java.util.List; +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxModel; +import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; + +public class DummyAxModelWithReferences extends AxModel { + private static final long serialVersionUID = -8194956638511120008L; + + private List<AxKey> extrakeyList = new ArrayList<>(); + + public DummyAxModelWithReferences(final AxArtifactKey key) { + super(key); + } + + @Override + public List<AxKey> getKeys() { + List<AxKey> keys = super.getKeys(); + keys.addAll(extrakeyList); + + return keys; + } + + public List<AxKey> getExtrakeyList() { + return extrakeyList; + } + + /** + * Set the reference key list. + */ + public void setReferenceKeyList() { + List<AxKey> keys = super.getKeys(); + + for (AxKey key: keys) { + AxArtifactKey akey = (AxArtifactKey) key; + AxReferenceKey keyRef = new AxReferenceKey(akey, akey.getName()); + extrakeyList.add(keyRef); + } + } + + public void addKey(final AxKey akey) { + extrakeyList.add(akey); + } + + public void removeKey(final AxKey akey) { + extrakeyList.remove(akey); + } +} |