summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell')
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AbstractCellComparatorTest.java58
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AbstractCellFormatterTest.java51
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AppIdFormatterTest.java49
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/ConnectPointFormatterTest.java44
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/DefaultCellComparatorTest.java146
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/DefaultCellFormatterTest.java70
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/EnumFormatterTest.java60
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/HexFormatterTest.java56
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/HostLocationFormatterTest.java45
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/TimeFormatterTest.java51
10 files changed, 0 insertions, 630 deletions
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AbstractCellComparatorTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AbstractCellComparatorTest.java
deleted file mode 100644
index 30125afb..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AbstractCellComparatorTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.ui.table.cell;
-
-import org.junit.Test;
-import org.onosproject.ui.table.CellComparator;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Unit tests for {@link AbstractCellComparator}.
- */
-public class AbstractCellComparatorTest {
-
- private static class Concrete extends AbstractCellComparator {
- @Override
- protected int nonNullCompare(Object o1, Object o2) {
- return 42;
- }
- }
-
- private CellComparator cmp = new Concrete();
-
- @Test
- public void twoNullArgs() {
- assertTrue("two nulls", cmp.compare(null, null) == 0);
- }
-
- @Test
- public void nullArgOne() {
- assertTrue("null one", cmp.compare(null, 1) < 0);
- }
-
- @Test
- public void nullArgTwo() {
- assertTrue("null two", cmp.compare(1, null) > 0);
- }
-
- // mock output, but check that our method was invoked...
- @Test
- public void noNulls() {
- assertTrue("no Nulls", cmp.compare(1, 2) == 42);
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AbstractCellFormatterTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AbstractCellFormatterTest.java
deleted file mode 100644
index 41fefd65..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AbstractCellFormatterTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.ui.table.cell;
-
-import org.junit.Test;
-import org.onosproject.ui.table.CellFormatter;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Unit tests for {@link AbstractCellFormatter}.
- */
-public class AbstractCellFormatterTest {
-
- private static final String MOCK_OUTPUT = "Mock!!";
-
- private static class Concrete extends AbstractCellFormatter {
- @Override
- protected String nonNullFormat(Object value) {
- return MOCK_OUTPUT;
- }
- }
-
- private CellFormatter frm = new Concrete();
-
- @Test
- public void nullInput() {
- assertEquals("wrong result", "", frm.format(null));
- }
-
- // mock output, but check that our method was invoked...
- @Test
- public void nonNullInput() {
- assertEquals("what?", MOCK_OUTPUT, frm.format(1));
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AppIdFormatterTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AppIdFormatterTest.java
deleted file mode 100644
index a7befbdb..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/AppIdFormatterTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.ui.table.cell;
-
-import org.junit.Test;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.ui.table.CellFormatter;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Unit tests for {@link AppIdFormatter}.
- */
-public class AppIdFormatterTest {
-
- private static final ApplicationId APP_ID = new ApplicationId() {
- @Override
- public short id() {
- return 25;
- }
-
- @Override
- public String name() {
- return "some app";
- }
- };
-
- private CellFormatter fmt = AppIdFormatter.INSTANCE;
-
- @Test
- public void basic() {
- assertEquals("wrong format", "25 : some app", fmt.format(APP_ID));
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/ConnectPointFormatterTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/ConnectPointFormatterTest.java
deleted file mode 100644
index f7ad2751..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/ConnectPointFormatterTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.ui.table.cell;
-
-import org.junit.Test;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.ui.table.CellFormatter;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Unit tests for {@link ConnectPointFormatter}.
- */
-public class ConnectPointFormatterTest {
-
- private static final DeviceId DEVID = DeviceId.deviceId("foobar");
- private static final PortNumber PORT = PortNumber.portNumber(42);
-
- private static final ConnectPoint CP = new ConnectPoint(DEVID, PORT);
-
- private CellFormatter fmt = ConnectPointFormatter.INSTANCE;
-
- @Test
- public void basic() {
- assertEquals("wrong format", "foobar/42", fmt.format(CP));
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/DefaultCellComparatorTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/DefaultCellComparatorTest.java
deleted file mode 100644
index b870d483..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/DefaultCellComparatorTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.ui.table.cell;
-
-import org.junit.Test;
-import org.onosproject.ui.table.CellComparator;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Unit tests for {@link DefaultCellComparator}.
- */
-public class DefaultCellComparatorTest {
-
- private static final String SOME = "SoMeStRiNg";
- private static final String OTHER = "OtherSTRING";
-
- private CellComparator cmp = DefaultCellComparator.INSTANCE;
-
- // default comparator should detect Comparable<T> impls and use that
-
- @Test
- public void sameString() {
- assertTrue("same string", cmp.compare(SOME, SOME) == 0);
- }
-
- @Test
- public void someVsOther() {
- assertTrue("some vs other", cmp.compare(SOME, OTHER) > 0);
- }
-
- @Test
- public void otherVsSome() {
- assertTrue("other vs some", cmp.compare(OTHER, SOME) < 0);
- }
-
- @Test
- public void someVsNull() {
- assertTrue("some vs null", cmp.compare(SOME, null) > 0);
- }
-
- @Test
- public void nullVsSome() {
- assertTrue("null vs some", cmp.compare(null, SOME) < 0);
- }
-
- @Test(expected = ClassCastException.class)
- public void mismatch() {
- cmp.compare(42, SOME);
- }
-
-
- @Test
- public void strElevenTwo() {
- assertTrue("str 11 vs 2", cmp.compare("11", "2") < 0);
- }
-
- @Test
- public void intElevenTwo() {
- assertTrue("int 11 vs 2", cmp.compare(11, 2) > 0);
- }
-
-
- @Test
- public void intSmallBig() {
- assertTrue("int 2 vs 4", cmp.compare(2, 4) < 0);
- }
-
- @Test
- public void intBigSmall() {
- assertTrue("int 4 vs 2", cmp.compare(4, 2) > 0);
- }
-
- @Test
- public void intEqual() {
- assertTrue("int 4 vs 4", cmp.compare(4, 4) == 0);
- }
-
- @Test
- public void longSmallBig() {
- assertTrue("long 2 vs 4", cmp.compare(2L, 4L) < 0);
- }
-
- @Test
- public void longBigSmall() {
- assertTrue("long 4 vs 2", cmp.compare(4L, 2L) > 0);
- }
-
- @Test
- public void longEqual() {
- assertTrue("long 4 vs 4", cmp.compare(4L, 4L) == 0);
- }
-
-
- private enum SmallStarWars { C3PO, R2D2, LUKE }
-
- @Test
- public void swEpisodeI() {
- assertTrue("c3po r2d2",
- cmp.compare(SmallStarWars.C3PO, SmallStarWars.R2D2) < 0);
- }
-
- @Test
- public void swEpisodeIi() {
- assertTrue("r2d2 c3po",
- cmp.compare(SmallStarWars.R2D2, SmallStarWars.C3PO) > 0);
- }
-
- @Test
- public void swEpisodeIii() {
- assertTrue("luke c3po",
- cmp.compare(SmallStarWars.LUKE, SmallStarWars.C3PO) > 0);
- }
-
- @Test
- public void swEpisodeIv() {
- assertTrue("c3po luke",
- cmp.compare(SmallStarWars.C3PO, SmallStarWars.LUKE) < 0);
- }
-
- @Test
- public void swEpisodeV() {
- assertTrue("luke r2d2",
- cmp.compare(SmallStarWars.LUKE, SmallStarWars.R2D2) > 0);
- }
-
- @Test
- public void swEpisodeVi() {
- assertTrue("r2d2 luke",
- cmp.compare(SmallStarWars.R2D2, SmallStarWars.LUKE) < 0);
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/DefaultCellFormatterTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/DefaultCellFormatterTest.java
deleted file mode 100644
index b63793b9..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/DefaultCellFormatterTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.ui.table.cell;
-
-import org.junit.Test;
-import org.onosproject.ui.table.CellFormatter;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Unit tests for {@link DefaultCellFormatter}.
- */
-public class DefaultCellFormatterTest {
-
- private static final String UNEX = "Unexpected result";
- private static final String SOME_STRING = "SoMeStRiNg";
-
- private static class TestClass {
- @Override
- public String toString() {
- return SOME_STRING;
- }
- }
-
- private CellFormatter fmt = DefaultCellFormatter.INSTANCE;
-
- @Test
- public void formatNull() {
- assertEquals(UNEX, "", fmt.format(null));
- }
-
- @Test
- public void formatInteger() {
- assertEquals(UNEX, "3", fmt.format(3));
- }
-
- @Test
- public void formatTrue() {
- assertEquals(UNEX, "true", fmt.format(true));
- }
-
- @Test
- public void formatFalse() {
- assertEquals(UNEX, "false", fmt.format(false));
- }
-
- @Test
- public void formatString() {
- assertEquals(UNEX, "FOO", fmt.format("FOO"));
- }
-
- @Test
- public void formatObject() {
- assertEquals(UNEX, SOME_STRING, fmt.format(new TestClass()));
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/EnumFormatterTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/EnumFormatterTest.java
deleted file mode 100644
index 68833c90..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/EnumFormatterTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.ui.table.cell;
-
-import org.junit.Test;
-import org.onosproject.ui.table.CellFormatter;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Unit tests for {@link EnumFormatter}.
- */
-public class EnumFormatterTest {
-
- enum TestEnum {
- ADDED,
- PENDING_ADD,
- WAITING_AUDIT_COMPLETE
- }
-
- private CellFormatter fmt = EnumFormatter.INSTANCE;
-
- @Test
- public void nullValue() {
- assertEquals("null value", "", fmt.format(null));
- }
-
- @Test
- public void noUnderscores() {
- assertEquals("All caps", "Added", fmt.format(TestEnum.ADDED));
- }
-
- @Test
- public void underscores() {
- assertEquals("All caps with underscores",
- "Pending Add", fmt.format(TestEnum.PENDING_ADD));
- }
-
- @Test
- public void multiUnderscores() {
- assertEquals("All caps with underscores",
- "Waiting Audit Complete",
- fmt.format(TestEnum.WAITING_AUDIT_COMPLETE));
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/HexFormatterTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/HexFormatterTest.java
deleted file mode 100644
index 2f70d43c..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/HexFormatterTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.ui.table.cell;
-
-import org.junit.Test;
-import org.onosproject.ui.table.CellFormatter;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Unit tests for {@link HexFormatter}.
- */
-public class HexFormatterTest {
-
- private CellFormatter fmt = HexFormatter.INSTANCE;
-
- @Test
- public void nullValue() {
- assertEquals("null value", "", fmt.format(null));
- }
-
- @Test
- public void zero() {
- assertEquals("zero", "0x0", fmt.format(0));
- }
-
- @Test
- public void one() {
- assertEquals("one", "0x1", fmt.format(1));
- }
-
- @Test
- public void ten() {
- assertEquals("ten", "0xa", fmt.format(10));
- }
-
- @Test
- public void twenty() {
- assertEquals("twenty", "0x14", fmt.format(20));
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/HostLocationFormatterTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/HostLocationFormatterTest.java
deleted file mode 100644
index 25ec89cd..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/HostLocationFormatterTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.ui.table.cell;
-
-import org.junit.Test;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.HostLocation;
-import org.onosproject.net.PortNumber;
-import org.onosproject.ui.table.CellFormatter;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Unit tests for {@link HostLocationFormatter}.
- */
-public class HostLocationFormatterTest {
-
- private static final DeviceId DEVID = DeviceId.deviceId("foobar");
- private static final PortNumber PORT = PortNumber.portNumber(42);
- private static final long TIME = 12345;
-
- private static final HostLocation LOC = new HostLocation(DEVID, PORT, TIME);
-
- private CellFormatter fmt = HostLocationFormatter.INSTANCE;
-
- @Test
- public void basic() {
- assertEquals("wrong format", "foobar/42", fmt.format(LOC));
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/TimeFormatterTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/TimeFormatterTest.java
deleted file mode 100644
index 1e05ded1..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/ui/table/cell/TimeFormatterTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.ui.table.cell;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.junit.Test;
-import org.onosproject.ui.table.CellFormatter;
-
-import java.util.Locale;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Unit tests for {@link TimeFormatter}.
- */
-public class TimeFormatterTest {
-
- private static final Locale LOCALE = Locale.ENGLISH;
- private static final DateTimeZone ZONE = DateTimeZone.UTC;
-
- private static final DateTime TIME = new DateTime(2015, 5, 4, 15, 30, ZONE);
- private static final String EXP_ZONE_NAME = "3:30:00 PM UTC";
- private static final String EXP_ZONE_OFFSET = "3:30:00 PM +00:00";
-
- // Have to use explicit Locale and TimeZone for the unit test, so that
- // irrespective of which locale and time zone the test is run in, it
- // always produces the same result...
- private CellFormatter fmt =
- new TimeFormatter().withLocale(LOCALE).withZone(ZONE);
-
- @Test
- public void basic() {
- assertTrue("wrong format", (EXP_ZONE_NAME.equals(fmt.format(TIME)) ||
- EXP_ZONE_OFFSET.equals(fmt.format(TIME))));
- }
-}