diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-11-10 12:22:28 +0100 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-11-10 12:47:24 +0100 |
commit | 8e0c7007906730fe4547b0265a895ad8a322a7dc (patch) | |
tree | dbc3310da5c7b7083cc6b9ecffee633d2cf5cd7f /v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManagerTest.java | |
parent | aa7e652e6105a6972d6c41ff0738cd9e31ce0188 (diff) |
Remove hc2vpp codebase
Moved to a dedicated hc2vpp project in fd.io
Change-Id: I03dc3b3029f21b127a00c69a86bcd8e467896241
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManagerTest.java')
-rw-r--r-- | v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManagerTest.java | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManagerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManagerTest.java deleted file mode 100644 index 52a7a5c2d..000000000 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManagerTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * 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. - */ - -package io.fd.honeycomb.translate.v3po; - - - - -import static org.hamcrest.CoreMatchers.hasItems; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.verify; - -import com.google.common.base.Optional; -import io.fd.honeycomb.translate.MappingContext; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.DisabledInterfaces; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.DisabledInterfacesBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.disabled.interfaces.DisabledInterfaceIndex; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.disabled.interfaces.DisabledInterfaceIndexBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.disabled.interfaces.DisabledInterfaceIndexKey; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; - -public class DisabledInterfacesManagerTest { - - private static final InstanceIdentifier<DisabledInterfaces> - ROOT_ID = InstanceIdentifier.create(DisabledInterfaces.class); - private static final KeyedInstanceIdentifier<DisabledInterfaceIndex, DisabledInterfaceIndexKey> SPECIFIC_ID_1 = - ROOT_ID.child(DisabledInterfaceIndex.class, new DisabledInterfaceIndexKey(1)); - private static final KeyedInstanceIdentifier<DisabledInterfaceIndex, DisabledInterfaceIndexKey> SPECIFIC_ID_4 = - ROOT_ID.child(DisabledInterfaceIndex.class, new DisabledInterfaceIndexKey(4)); - - @Mock - private MappingContext mappingContext; - private DisabledInterfacesManager manager; - - @Before - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - manager = new DisabledInterfacesManager(); - doReturn(Optional.of(new DisabledInterfacesBuilder().setDisabledInterfaceIndex(toIndices(1, 2, 3)).build())) - .when(mappingContext) - .read(ROOT_ID); - doReturn(Optional.of(toIndex(1))) - .when(mappingContext) - .read(SPECIFIC_ID_1); - doReturn(Optional.absent()) - .when(mappingContext) - .read(SPECIFIC_ID_4); - } - - @Test - public void testGetAll() throws Exception { - final List<Integer> disabledInterfaces = manager.getDisabledInterfaces(mappingContext); - assertThat(disabledInterfaces, hasItems(1, 2, 3)); - } - - @Test - public void testCheckOne() throws Exception { - assertTrue(manager.isInterfaceDisabled(1, mappingContext)); - assertFalse(manager.isInterfaceDisabled(4, mappingContext)); - } - - @Test - public void testDisable() throws Exception { - manager.disableInterface(1, mappingContext); - verify(mappingContext).put(SPECIFIC_ID_1, toIndex(1)); - } - - @Test - public void testRemoveDisability() throws Exception { - manager.removeDisabledInterface(1, mappingContext); - verify(mappingContext).delete(SPECIFIC_ID_1); - } - - private List<DisabledInterfaceIndex> toIndices(final int... indices) { - return Arrays.stream(indices) - .mapToObj(this::toIndex) - .collect(Collectors.toList()); - } - - private DisabledInterfaceIndex toIndex(final int idx) { - return new DisabledInterfaceIndexBuilder() - .setIndex(idx) - .build(); - } -}
\ No newline at end of file |