Return-Path: X-Original-To: apmail-jena-commits-archive@www.apache.org Delivered-To: apmail-jena-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AE0251876C for ; Wed, 29 Apr 2015 12:04:34 +0000 (UTC) Received: (qmail 27289 invoked by uid 500); 29 Apr 2015 12:04:34 -0000 Delivered-To: apmail-jena-commits-archive@jena.apache.org Received: (qmail 27254 invoked by uid 500); 29 Apr 2015 12:04:34 -0000 Mailing-List: contact commits-help@jena.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jena.apache.org Delivered-To: mailing list commits@jena.apache.org Received: (qmail 27212 invoked by uid 99); 29 Apr 2015 12:04:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2015 12:04:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6CB4FE0215; Wed, 29 Apr 2015 12:04:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: andy@apache.org To: commits@jena.apache.org Date: Wed, 29 Apr 2015 12:04:35 -0000 Message-Id: <4f4641dde7f24b559934f0d847e20ac0@git.apache.org> In-Reply-To: <7e7f9b5530d248b4bb077e7729b4840d@git.apache.org> References: <7e7f9b5530d248b4bb077e7729b4840d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/11] jena git commit: JENA-923: Remove jena-arq files now in jena-base http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestBytes.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestBytes.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestBytes.java deleted file mode 100644 index a857509..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestBytes.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import java.nio.ByteBuffer ; - -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.Bytes ; -import org.junit.Test ; - -public class TestBytes extends BaseTest -{ - @Test public void packInt1() - { - byte[] b = new byte[4] ; - Bytes.setInt(0x01020304,b) ; - assertEquals(0x01, b[0]) ; - assertEquals(0x02, b[1]) ; - assertEquals(0x03, b[2]) ; - assertEquals(0x04, b[3]) ; - } - - @Test public void packInt2() - { - byte[] b = new byte[8] ; - Bytes.setInt(0x01020304,b,0) ; - Bytes.setInt(0x05060708,b,4) ; - assertEquals(0x01, b[0]) ; - assertEquals(0x02, b[1]) ; - assertEquals(0x03, b[2]) ; - assertEquals(0x04, b[3]) ; - assertEquals(0x05, b[4]) ; - assertEquals(0x06, b[5]) ; - assertEquals(0x07, b[6]) ; - assertEquals(0x08, b[7]) ; - } - - @Test public void packInt3() - { - byte[] b = new byte[4] ; - Bytes.setInt(0xF1F2F3F4,b) ; - int i = Bytes.getInt(b) ; - assertEquals(0xF1F2F3F4, i) ; - } - - @Test public void packInt4() - { - byte[] b = new byte[8] ; - Bytes.setInt(0x01020304,b,0) ; - Bytes.setInt(0x05060708,b,4) ; - - int i1 = Bytes.getInt(b,0) ; - int i2 = Bytes.getInt(b,4) ; - assertEquals(0x01020304, i1) ; - assertEquals(0x05060708, i2) ; - } - - @Test public void packLong5() - { - byte[] b = new byte[8] ; - Bytes.setLong(0x0102030405060708L,b) ; - assertEquals(0x01, b[0]) ; - assertEquals(0x02, b[1]) ; - assertEquals(0x03, b[2]) ; - assertEquals(0x04, b[3]) ; - assertEquals(0x05, b[4]) ; - assertEquals(0x06, b[5]) ; - assertEquals(0x07, b[6]) ; - assertEquals(0x08, b[7]) ; - } - - @Test public void packLong6() - { - byte[] b = new byte[16] ; - Bytes.setLong(0x0102030405060708L,b,0) ; - Bytes.setLong(0x1112131415161718L,b,8) ; - assertEquals(0x01, b[0]) ; - assertEquals(0x02, b[1]) ; - assertEquals(0x03, b[2]) ; - assertEquals(0x04, b[3]) ; - assertEquals(0x05, b[4]) ; - assertEquals(0x06, b[5]) ; - assertEquals(0x07, b[6]) ; - assertEquals(0x08, b[7]) ; - - assertEquals(0x11, b[0+8]) ; - assertEquals(0x12, b[1+8]) ; - assertEquals(0x13, b[2+8]) ; - assertEquals(0x14, b[3+8]) ; - assertEquals(0x15, b[4+8]) ; - assertEquals(0x16, b[5+8]) ; - assertEquals(0x17, b[6+8]) ; - assertEquals(0x18, b[7+8]) ; - } - - @Test public void packLong7() - { - byte[] b = new byte[8] ; - Bytes.setLong(0xF1F2F3F4F5F6F7F8L,b) ; - long i = Bytes.getLong(b) ; - assertEquals (0xF1F2F3F4F5F6F7F8L,i) ; - } - - @Test public void packLong8() - { - byte[] b = new byte[16] ; - Bytes.setLong(0xF1F2F3F4F5F6F7F8L,b,0) ; - Bytes.setLong(0xA1A2A3A4A5A6A7A8L,b,8) ; - - long i1 = Bytes.getLong(b,0) ; - long i2 = Bytes.getLong(b,8) ; - assertEquals(0xF1F2F3F4F5F6F7F8L,i1) ; - assertEquals(0xA1A2A3A4A5A6A7A8L,i2) ; - } - - @Test public void compare1() { compare(0, new byte[]{}, new byte[]{}) ; } - @Test public void compare2() { compare(+1, new byte[]{1}, new byte[]{}) ; } - @Test public void compare3() { compare(-1, new byte[]{1}, new byte[]{1,2}) ; } - - @Test public void compare4() { compare(+1, new byte[]{1,3}, new byte[]{1,2}) ; } - @Test public void compare5() { compare(+1, new byte[]{1,3}, new byte[]{1,2,3}) ; } - @Test public void compare6() { compare(-1, new byte[]{1,2}, new byte[]{1,2,3}) ; } - - byte[] bytes = { 1, 2, 3, 4, 5, 6 } ; - - @Test public void slice1() - { - byte[] x = Bytes.copyOf(bytes) ; - assertArrayEquals(bytes, x) ; - } - - @Test public void slice3() - { - byte[] x = Bytes.copyOf(bytes,3) ; - byte[] y = new byte[]{4,5,6} ; - assertArrayEquals(y, x) ; - } - - @Test public void slice2() - { - byte[] x = Bytes.copyOf(bytes,3,2) ; - byte[] y = new byte[]{4,5} ; - assertArrayEquals(y, x) ; - } - - private static void compare(int expected, byte[] b1, byte[] b2) - { - int x = Bytes.compare(b1, b2) ; - if ( x > 0 && expected > 0 ) return ; - if ( x == 0 && expected == 0 ) return ; - if ( x < 0 && expected < 0 ) return ; - fail("Does not compare: "+Bytes.asHex(b1)+" :: "+Bytes.asHex(b2)) ; - } - - private static void codec(String str) - { - ByteBuffer bb = ByteBuffer.allocate(16) ; - Bytes.toByteBuffer(str, bb) ; - bb.flip() ; - String str2 = Bytes.fromByteBuffer(bb) ; - assertEquals(str, str2) ; - } - - static private final String asciiBase = "abc" ; - static private final String latinBase = "Àéíÿ" ; - static private final String latinExtraBase = "ỹfifl" ; // fi-ligature, fl-ligature - static private final String greekBase = "αβγ" ; - static private final String hewbrewBase = "אבג" ; - static private final String arabicBase = "ءآأ"; - static private final String symbolsBase = "☺☻♪♫" ; - static private final String chineseBase = "孫子兵法" ; // The Art of War - static private final String japaneseBase = "日本" ; // Japanese - - @Test public void codec1() { codec(asciiBase) ; } - @Test public void codec2() { codec("") ; } - @Test public void codec3() { codec(greekBase) ; } - @Test public void codec4() { codec(hewbrewBase) ; } - @Test public void codec5() { codec(arabicBase) ; } - @Test public void codec6() { codec(symbolsBase) ; } - @Test public void codec7() { codec(chineseBase) ; } - @Test public void codec8() { codec(japaneseBase) ; } -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestCache.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestCache.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestCache.java deleted file mode 100644 index 05513fe..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestCache.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import java.util.Arrays ; -import java.util.Collection ; -import java.util.List ; - -import org.apache.jena.atlas.iterator.Iter ; -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.Cache ; -import org.apache.jena.atlas.lib.CacheFactory ; -import org.junit.Before ; -import org.junit.Test ; -import org.junit.runner.RunWith ; -import org.junit.runners.Parameterized ; -import org.junit.runners.Parameterized.Parameters ; - -@RunWith(Parameterized.class) -public class TestCache extends BaseTest -{ - // Tests do not apply to cache1. - private static interface CacheMaker { Cache make(int size) ; String name() ; } - - private static CacheMaker simple = - new CacheMaker() - { - @Override - public Cache make(int size) { return CacheFactory.createSimpleCache(size) ; } - @Override - public String name() { return "Simple" ; } - } - ; - - private static CacheMaker standard = - new CacheMaker() - { - @Override - public Cache make(int size) { return CacheFactory.createCache(size) ; } - @Override - public String name() { return "Standard" ; } - } - ; - - @Parameters - public static Collection cacheMakers() - { - return Arrays.asList(new Object[][] { - { simple , 10 } - , { simple , 2 } - , { simple , 1 } - , { standard , 10 } - , { standard , 2 } - , { standard , 1 } - } ) ; - } - - Cache cache ; - CacheMaker cacheMaker ; - int size ; - - - public TestCache(CacheMaker cacheMaker, int size) - { - this.cacheMaker = cacheMaker ; - this.size = size ; - - } - - @Before public void before() { cache = cacheMaker.make(size) ; } - - @Test public void cache_00() - { - assertEquals(0, cache.size()) ; - assertTrue(cache.isEmpty()) ; - } - - @Test public void cache_01() - { - Integer x = cache.getIfPresent(7) ; - cache.put(7, 7) ; - assertEquals(1, cache.size()) ; - assertNull(x) ; - assertTrue(cache.containsKey(7)) ; - assertEquals(Integer.valueOf(7), cache.getIfPresent(7)) ; - } - - @Test public void cache_02() - { - cache.put(7, 7) ; - cache.put(8, 8) ; - // Not true for Cache1. - if ( size > 2 ) - assertEquals(2, cache.size()) ; - if ( size > 2 ) - assertTrue(cache.containsKey(7)) ; - - if ( size > 2 ) - assertEquals(Integer.valueOf(7), cache.getIfPresent(7)) ; - - assertTrue(cache.containsKey(8)) ; - assertEquals(Integer.valueOf(8), cache.getIfPresent(8)) ; - } - - @Test public void cache_03() - { - cache.put(7, 7) ; - Integer x1 = cache.getIfPresent(7) ; - cache.put(7, 18) ; - assertEquals(1, cache.size()) ; - assertEquals(7, x1.intValue()) ; - assertTrue(cache.containsKey(7)) ; - assertEquals(Integer.valueOf(18), cache.getIfPresent(7)) ; - } - - @Test public void cache_04() - { - cache.clear() ; - cache.put(7, 77) ; - List x = Iter.toList(cache.keys()) ; - assertEquals(1, x.size()) ; - assertEquals(Integer.valueOf(7), x.get(0)) ; - } - - @Test public void cache_05() - { - cache.clear() ; - cache.put(7, 77) ; - cache.clear() ; - assertEquals(0, cache.size()) ; - assertTrue(cache.isEmpty()) ; - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestCache2.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestCache2.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestCache2.java deleted file mode 100644 index 2e640f3..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestCache2.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import java.util.concurrent.Callable ; - -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.Cache ; -import org.apache.jena.atlas.lib.CacheFactory ; -import org.apache.jena.atlas.lib.cache.Cache1 ; -import org.junit.Test ; - -// Non-parameterized tests -public class TestCache2 extends BaseTest -{ - // Cache1 - @Test public void cache_10() - { - Cache cache = new Cache1<>() ; - String str = cache.getIfPresent(1) ; - assertNull(str) ; - - cache.put(1, "1") ; - str = cache.getIfPresent(1) ; - assertEquals("1", str) ; - - cache.put(2, "2") ; - str = cache.getIfPresent(1) ; - assertNull(str) ; - - cache.put(1, "1") ; - str = cache.getIfPresent(2) ; - assertNull(str) ; - str = cache.getIfPresent(1) ; - assertEquals("1", str) ; - } - - - - static Callable getter(final Integer key) { - return new Callable() { - @Override - public String call() { - return key.toString() ; } - } ; - } - - // Cache + getters - @Test public void cacheGetter_1() - { - Cache cache = CacheFactory.createCache(2) ; - String str = cache.getOrFill(1, getter(1)) ; - assertEquals("1", str) ; - } - - // Cache + getters - @Test public void cacheGetter_2() - { - Cache cache = CacheFactory.createCache(2) ; - String str1 = cache.getOrFill(1, getter(1)) ; - String str2 = cache.getOrFill(2, getter(2)) ; - String str3 = cache.getOrFill(3, getter(3)) ; - assertEquals("1", str1) ; - assertEquals("2", str2) ; - assertEquals("3", str3) ; - cache.put(1, "10") ; - str1 = cache.getIfPresent(1) ; - assertEquals("10", str1) ; - } - - -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestColumnMap.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestColumnMap.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestColumnMap.java deleted file mode 100644 index fb44166..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestColumnMap.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.ColumnMap ; -import org.apache.jena.atlas.lib.Tuple ; -import static org.apache.jena.atlas.lib.Tuple.* ; -import org.junit.Test ; - -public class TestColumnMap extends BaseTest -{ - @Test public void remap1() - { - ColumnMap x = new ColumnMap("SPO->POS", 2,0,1) ; // S->2 etc - - Integer[] array = {0,1,2 } ; - assertEquals(Integer.valueOf(2), x.mapSlot(0, array) ) ; - assertEquals(Integer.valueOf(0), x.mapSlot(1, array) ) ; - assertEquals(Integer.valueOf(1), x.mapSlot(2, array) ) ; - } - - @Test public void remap2() - { - ColumnMap x = new ColumnMap("SPO->POS", 2,0,1) ; - Integer[] array = { 0,1,2 } ; - assertEquals(Integer.valueOf(1), x.fetchSlot(0, array)) ; // The index 1 comes from position 0. - assertEquals(Integer.valueOf(2), x.fetchSlot(1, array)) ; - assertEquals(Integer.valueOf(0), x.fetchSlot(2, array)) ; - } - - @Test public void remap3() - { - ColumnMap x = new ColumnMap("POS", 2,0,1) ; - Tuple tuple = createTuple("S", "P", "O") ; - Tuple mapped = x.map(tuple) ; - Tuple expected = createTuple("P", "O", "S") ; - assertEquals(expected, mapped) ; - } - - @Test public void remap4() - { - ColumnMap x = new ColumnMap("POS", 2,0,1) ; - Tuple tuple = createTuple("S", "P", "O") ; - Tuple tuple2 = x.map(tuple) ; - tuple2 = x.unmap(tuple2) ; - assertEquals(tuple, tuple2) ; - } - - @Test public void compile1() - { - int[] x = ColumnMap.compileMapping("SPO", "POS") ; - // SPO -> POS so col 0 goes to col 2, col 1 goes to col 0 and col 2 goes to col 1 - int[] expected = { 2,0,1 } ; - assertArrayEquals(expected, x) ; - } - - @Test public void compile2() - { - int[] x = ColumnMap.compileMapping("SPOG", "GOPS") ; - int[] expected = { 3, 2, 1, 0 } ; - assertArrayEquals(expected, x) ; - } - - @Test public void map1() - { - ColumnMap cmap = new ColumnMap("GSPO", "OSPG") ; - Tuple tuple = createTuple("G", "S", "P", "O") ; - Tuple mapped = cmap.map(tuple) ; - Tuple expected = createTuple("O", "S", "P", "G") ; - assertEquals(expected, mapped) ; - Tuple unmapped = cmap.unmap(mapped) ; - assertEquals(createTuple("G", "S", "P", "O"), unmapped) ; - } - - @Test public void map2() - { - String[] x = { "G", "S", "P", "O" } ; - String[] y = { "O", "S", "P", "G" } ; - - ColumnMap cmap = new ColumnMap("Test", x, y) ; - Tuple tuple = Tuple.create(x) ; - Tuple mapped = cmap.map(tuple) ; - - Tuple expected = Tuple.create(y) ; - assertEquals(expected, mapped) ; - Tuple unmapped = cmap.unmap(mapped) ; - assertEquals(Tuple.create(x), unmapped) ; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestDateTimeUtils.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestDateTimeUtils.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestDateTimeUtils.java deleted file mode 100644 index 8aae32b..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestDateTimeUtils.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import static org.junit.Assert.*; - -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -import org.apache.jena.atlas.lib.DateTimeUtils ; -import org.junit.Test; - -public class TestDateTimeUtils { - - @Test - public void testCalendarToXSDDateTimeString_1() throws Exception { - Calendar cal = createCalendar(1984, Calendar.MARCH, 22, 14, 32, 1, 0, "Z") ; - assertEquals("1984-03-22T14:32:01+00:00", DateTimeUtils.calendarToXSDDateTimeString(cal)); - cal.setTimeZone(TimeZone.getTimeZone("MST")); - assertEquals("1984-03-22T07:32:01-07:00", DateTimeUtils.calendarToXSDDateTimeString(cal)); - } - - @Test - public void testCalendarToXSDDateTimeString_2() throws Exception { - Calendar cal = createCalendar(1984, Calendar.MARCH, 22, 14, 32, 1, 50, "Z") ; - assertEquals("1984-03-22T14:32:01.050+00:00", DateTimeUtils.calendarToXSDDateTimeString(cal)); - cal.setTimeZone(TimeZone.getTimeZone("MST")); - assertEquals("1984-03-22T07:32:01.050-07:00", DateTimeUtils.calendarToXSDDateTimeString(cal)); - } - - - @Test - public void testCalendarToXSDDateString() throws Exception { - Calendar cal = createCalendar(1984, Calendar.MARCH, 22, 23, 59, 1, 0, "Z"); - cal.setTimeZone(TimeZone.getTimeZone("Z")) ; - assertEquals("1984-03-22+00:00", DateTimeUtils.calendarToXSDDateString(cal)); - cal.setTimeZone(TimeZone.getTimeZone("MST")); - assertEquals("1984-03-22-07:00", DateTimeUtils.calendarToXSDDateString(cal)); - } - - @Test - public void testCalendarToXSDTimeString_1() throws Exception { - Calendar cal = createCalendar(1984, Calendar.MARCH, 22, 14, 32, 1, 0, "GMT+01:00"); - assertEquals("14:32:01+01:00", DateTimeUtils.calendarToXSDTimeString(cal)); - // Different timezone - moves the cal point-in-time. - cal.setTimeZone(TimeZone.getTimeZone("MST")); - assertEquals("06:32:01-07:00", DateTimeUtils.calendarToXSDTimeString(cal)); - } - - @Test - public void testCalendarToXSDTimeString_2() throws Exception { - Calendar cal = createCalendar(1984, Calendar.MARCH, 22, 14, 32, 1, 500, "GMT+01:00"); - assertEquals("14:32:01.500+01:00", DateTimeUtils.calendarToXSDTimeString(cal)); - // Different timezone - moves the cal point-in-time. - cal.setTimeZone(TimeZone.getTimeZone("MST")); - assertEquals("06:32:01.500-07:00", DateTimeUtils.calendarToXSDTimeString(cal)); - } - - private static Calendar createCalendar(int year, int month, int dayOfMonth, int hourOfDay, - int minute, int second, int milli, String tz) { - GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone(tz)) ; - cal.set(year, month, dayOfMonth, hourOfDay, minute, second) ; - cal.set(Calendar.MILLISECOND, milli) ; - return cal ; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestFileOps.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestFileOps.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestFileOps.java deleted file mode 100644 index 92538f7..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestFileOps.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.FileOps ; -import org.apache.jena.atlas.lib.Tuple ; -import org.junit.Test ; - -public class TestFileOps extends BaseTest -{ - /* - * t("") ; - t("/a/b/c") ; - t("/aa/bb/cc.ext") ; - t("cc.ext") ; - t("/cc.ext") ; - t("/") ; - t("xyz") ; - t("xyz/") ; - */ - - static void test(String fn, String path, String basename, String ext) - { - Tuple t = FileOps.splitDirBaseExt(fn) ; - assertEquals(path, t.get(0)) ; - assertEquals(basename, t.get(1)) ; - assertEquals(ext, t.get(2)) ; - - if ( basename != null ) - assertEquals(basename, FileOps.basename(fn)) ; - if ( ext != null ) - assertEquals(ext, FileOps.extension(fn)) ; - } - - @Test public void split01() - { test("/aa/bb/cc.ext", "/aa/bb", "cc", "ext") ; } - - @Test public void split02() - { test("/a/b/c", "/a/b", "c", null) ; } - - @Test public void split03() - { test("cc.ext", null, "cc", "ext") ; } - - @Test public void split04() - { test("/cc.ext", "", "cc", "ext") ; } - - @Test public void split05() - { test("/", "", "", null) ; } - - @Test public void split06() - { test("", null, "", null) ; } - - @Test public void split07() - { test("xyz", null, "xyz", null) ; } - - @Test public void split08() - { test("/xyz", "", "xyz", null) ; } - - @Test public void split09() - { test("xyz/", "xyz", "", null) ; } -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java deleted file mode 100644 index 7782c55..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import java.io.File ; - -import org.apache.jena.atlas.junit.BaseTest ; -import org.junit.Test ; - -public class TestFilenameProcessing extends BaseTest -{ - // See also TestFunction2 for tests for encode_for_uri - @Test public void encode_1() { encodeComponent("abc", "abc") ; } - @Test public void encode_2() { encodeComponent("", "") ; } - @Test public void encode_3() { encodeComponent(":/", "%3A%2F") ; } - - // ---- Main tests. - // Portablility - - private static String cwd = new File(".").getAbsolutePath() ; - // Without trailing slash. - static { cwd = cwd.substring(0, cwd.length()-2) ; } - - @Test public void fileIRI_1() - { - String uri = testFileIRI("D.ttl") ; - assertTrue(uri.endsWith("D.ttl")) ; - } - - @Test public void fileIRI_2() - { - String uri = testFileIRI("file:/D.ttl") ; - assertTrue(uri.endsWith("D.ttl")) ; - } - - @Test public void fileIRI_3() - { - String uri = testFileIRI("file://D.ttl") ; - assertTrue(uri.endsWith("D.ttl")) ; - } - - @Test public void fileIRI_4() - { - String iri = testFileIRI("file:///D.ttl") ; - // Even on windows, this is used as-is so no drive letter. - assertEquals("file:///D.ttl", iri) ; - } - - private static String testFileIRI(String fn) - { - String uri1 = IRILib.filenameToIRI(fn) ; - assertTrue(uri1.startsWith("file:///")) ; - String uri2 = IRILib.filenameToIRI(uri1) ; - assertEquals(uri1, uri2) ; - return uri1 ; - } - - - @Test public void fileURL_1() { assertNotEquals(cwd, "") ; assertNotNull(cwd) ; filenameToIRI("abc", "file://"+cwd+"/abc" ) ; } - - @Test public void fileURL_2() { filenameToIRI("/abc", "file:///abc" ) ; } - - static boolean isWindows = File.pathSeparator.equals(";") ; - - - @Test public void fileURL_3() - { - if ( isWindows ) - filenameToIRI("c:/Program File/App File", "file:///c:/Program%20File/App%20File") ; - else - filenameToIRI("/Program File/App File", "file:///Program%20File/App%20File") ; - } - - @Test public void fileURL_4() - { - if ( isWindows ) - filenameToIRI("c:/Program File/App Dir/", "file:///c:/Program%20File/App%20Dir/") ; - else - filenameToIRI("/Program File/App Dir/", "file:///Program%20File/App%20Dir/") ; - } - - @Test public void fileURL_5() - { - if ( isWindows ) - filenameToIRI("c:\\Windows\\Path", "file:///c:/Windows/Path") ; - else - filenameToIRI("c:\\Windows\\Path", "file://"+cwd+"/c:%5CWindows%5CPath") ; - - } - - @Test public void fileURL_6() { filenameToIRI("~user", "file://"+cwd+"/~user") ; } - @Test public void fileURL_7() { filenameToIRI(".", "file://"+cwd) ; } - - @Test public void fileURL_10() { filenameToIRI("file:abc", "file://"+cwd+"/abc" ) ; } - @Test public void fileURL_11() { filenameToIRI("file:/abc", "file:///abc" ) ; } - @Test public void fileURL_12() { filenameToIRI("file:", "file://"+cwd ) ; } - - @Test public void fileURL_13() { filenameToIRI("file:.", "file://"+cwd+"" ) ; } - @Test public void fileURL_14() { - String x = cwd ; - if ( isWindows ) - x = x.replace('\\', '/') ; - x = cwd.replaceAll("/[^/]*$", "") ; - filenameToIRI("file:..", "file://"+x ) ; - } - - - private static void encodeComponent(String string, String result) - { - String r = IRILib.encodeUriComponent(string) ; - assertEquals(result, r) ; - } - - private static void filenameToIRI(String string, String result) - { - String r = IRILib.filenameToIRI(string) ; - assertEquals(result, r) ; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestHex.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestHex.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestHex.java deleted file mode 100644 index e092e60..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestHex.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - - -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.Hex ; -import org.junit.Test ; - -public class TestHex extends BaseTest -{ - @Test public void hex_01() - { - byte[] b = new byte[16] ; - test(0L, 0, b, 16) ; - } - - @Test public void hex_02() - { - byte[] b = new byte[16] ; - test(1L, 0, b, 16) ; - } - - @Test public void hex_03() - { - byte[] b = new byte[16] ; - test(Long.MAX_VALUE, 0, b, 16) ; - } - - @Test public void hex_04() - { - byte[] b = new byte[16] ; - test(Long.MIN_VALUE, 0, b, 16) ; - } - - @Test public void hex_05() - { - byte[] b = new byte[16] ; - // -1L - test(0xFFFFFFFFFFFFFFFFL, 0, b, 16) ; - } - - @Test public void hex_06() - { - byte[] b = new byte[16] ; - test(-1L, 0, b, 16) ; - } - - private static void test(long value, int idx, byte[] b, int width) - { - int x = Hex.formatUnsignedLongHex(b, idx, value, width) ; - assertEquals(width, x) ; - for ( int i = 0 ; i < width ; i++ ) - { - int v = b[i] ; - if ( v >= '0' && v <= '9' ) continue ; - if ( v >= 'a' && v <= 'f' ) continue ; - if ( v >= 'A' && v <= 'F' ) continue ; - fail(String.format("Not a hex digit: %02X",b[i])) ; - } - - long v = Hex.getLong(b, idx) ; - assertEquals(value, v) ; - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestListUtils.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestListUtils.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestListUtils.java deleted file mode 100644 index ccaa56a..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestListUtils.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import static org.apache.jena.atlas.lib.ListUtils.unique ; - -import java.util.ArrayList ; -import java.util.Arrays ; -import java.util.List ; - -import org.apache.jena.atlas.junit.BaseTest ; -import org.junit.Test ; - -public class TestListUtils extends BaseTest -{ - @Test public void list01() - { - List x = Arrays.asList(1,2,3) ; - x = unique(x) ; - assertEquals(3, x.size()) ; - test(x, 1,2,3) ; - } - - @Test public void list02() - { - List x = Arrays.asList(1,2,3,1,3,2) ; - x = unique(x) ; - assertEquals(3, x.size()) ; - test(x, 1,2,3) ; - } - - @Test public void list03() - { - List x = new ArrayList<>() ; - x = unique(x) ; - assertEquals(0, x.size()) ; - test(x) ; - } - - @Test public void list04() - { - List x = Arrays.asList(99) ; - x = unique(x) ; - assertEquals(1, x.size()) ; - test(x, 99) ; - } - - @Test public void list05() - { - List x = Arrays.asList(1,1,2,3,1,1,3) ; - x = unique(x) ; - assertEquals(3, x.size()) ; - test(x, 1,2,3) ; - } - - private void test(List x, int... args) - { - assertEquals(args.length, x.size()) ; - - for ( int i = 0; i < args.length ; i++ ) - assertEquals(args[i], x.get(i).intValue()) ; - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestMultiSet.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestMultiSet.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestMultiSet.java deleted file mode 100644 index 477386b..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestMultiSet.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import java.util.Arrays ; -import java.util.Collections ; -import java.util.List ; - -import org.apache.jena.atlas.iterator.Iter ; -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.MultiSet ; -import org.junit.Test ; - - -public class TestMultiSet extends BaseTest -{ - @Test public void multiSet_01() - { - MultiSet x = new MultiSet<>() ; - assertTrue(x.isEmpty()) ; - assertEquals(0, x.count("A")) ; - } - - @Test public void multiSet_02() - { - MultiSet x = new MultiSet<>() ; - x.add("A") ; - assertFalse(x.isEmpty()) ; - assertEquals(1, x.count("A") ) ; - x.add("A") ; - assertEquals(2, x.count("A") ) ; - } - - @Test public void multiSet_03() - { - MultiSet x = new MultiSet<>() ; - x.add("A") ; - x.add("A") ; - x.remove("A") ; - assertEquals(1, x.count("A") ) ; - assertTrue(x.contains("A")) ; - x.remove("A") ; - assertEquals(0, x.count("A") ) ; - assertFalse(x.contains("A")) ; - } - - @Test public void multiSet_04() - { - String[] data = { } ; - iterTest(data) ; - } - - - @Test public void multiSet_05() - { - String[] data = { "A" } ; - iterTest(data) ; - } - - @Test public void multiSet_06() - { - String[] data = { "A", "B", "C" } ; - iterTest(data) ; - } - - - @Test public void multiSet_07() - { - String[] data = { "A", "B", "C", "A" } ; - iterTest(data) ; - } - - @Test public void multiSet_08() - { - String[] data = { } ; - MultiSet x = add(data) ; - assertEquals(0, x.size()) ; - } - - @Test public void multiSet_09() - { - String[] data = { "A", "A" } ; - MultiSet x = add(data) ; - assertEquals(2, x.size()) ; - } - - @Test public void multiSet_10() - { - String[] data = { "A", "A" } ; - MultiSet x = add(data) ; - x.remove("A") ; - assertEquals(1, x.size()) ; - x.remove("A") ; - assertEquals(0, x.size()) ; - x.remove("A") ; - assertEquals(0, x.size()) ; - } - - @Test public void multiSet_11() - { - String[] data = { "A", "A" } ; - MultiSet x = add(data) ; - long c = Iter.count(x.elements()) ; - assertEquals(1, c) ; - } - - private static MultiSet add(String[] data) - { - MultiSet x = new MultiSet<>() ; - for ( String str : data ) - x.add(str) ; - return x ; - } - - private static void iterTest(String[] data) - { - List expected = Arrays.asList(data) ; - MultiSet x = new MultiSet<>() ; - for ( String str : data ) - x.add(str) ; - List actual = Iter.toList(x.iterator()) ; - Collections.sort(expected) ; - Collections.sort(actual) ; - assertEquals(expected, actual) ; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestNumberUtils.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestNumberUtils.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestNumberUtils.java deleted file mode 100644 index 62c93da..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestNumberUtils.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.NumberUtils ; -import org.junit.Test ; - -public class TestNumberUtils extends BaseTest -{ - @Test public void int_format_01() { testInt(1, 1, "1") ; } - - @Test public void int_format_02() { testInt(1, 2, "01") ; } - - @Test public void int_format_03() { testInt(0, 1, "0") ; } - - @Test public void int_format_04() { testInt(0, 2, "00") ; } - - @Test public void int_format_05() { testInt(-1, 2, "-1") ; } - - @Test public void int_format_06() { testInt(-1, 3, "-01") ; } - - - @Test public void int_format_11() { testSigned(1, 2, "+1") ; } - - @Test public void int_format_12() { testSigned(1, 3, "+01") ; } - - @Test public void int_format_13() { testSigned(0, 2, "+0") ; } - - @Test public void int_format_14() { testSigned(0, 3, "+00") ; } - - @Test public void int_format_15() { testSigned(-1, 2, "-1") ; } - - @Test public void int_format_16() { testSigned(-1, 3, "-01") ; } - - @Test public void int_format_21() { testInt(1, "1") ; } - - @Test public void int_format_22() { testInt(0, "0") ; } - - @Test public void int_format_23() { testInt(-1, "-1") ; } - - @Test public void int_format_24() { testInt(10, "10") ; } - - @Test public void int_format_25() { testInt(100, "100") ; } - - @Test public void int_format_26() { testInt(-10, "-10") ; } - - @Test public void int_format_27() { testInt(-100, "-100") ; } - - - @Test public void int_format_31() { testUnsigned(1, 2, "01") ; } - - @Test public void int_format_32() { testUnsigned(1, 1, "1") ; } - - @Test public void int_format_33() { testUnsigned(0, 1, "0") ; } - - - private static void testInt(int value, String expected) - { - StringBuilder sb = new StringBuilder() ; - NumberUtils.formatInt(sb, value) ; - String result = sb.toString(); - assertEquals(expected, result) ; - } - - private static void testInt(int value, int width, String expected) - { - StringBuilder sb = new StringBuilder() ; - NumberUtils.formatInt(sb, value, width) ; - String result = sb.toString(); - assertEquals(expected, result) ; - } - - private static void testSigned(int value, int width, String expected) - { - StringBuilder sb = new StringBuilder() ; - NumberUtils.formatSignedInt(sb, value, width) ; - String result = sb.toString(); - assertEquals(expected, result) ; - } - - private static void testUnsigned(int value, int width, String expected) - { - StringBuilder sb = new StringBuilder() ; - NumberUtils.formatUnsignedInt(sb, value, width) ; - String result = sb.toString(); - assertEquals(expected, result) ; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestRefLong.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestRefLong.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestRefLong.java deleted file mode 100644 index 88e683a..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestRefLong.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.RefLong ; -import org.junit.Test ; - - -public class TestRefLong extends BaseTest -{ - @Test public void ref_01() - { - RefLong ref1 = new RefLong() ; - assertEquals(0, ref1.value()) ; - RefLong ref2 = new RefLong() ; - assertNotSame(ref1, ref2) ; - } - - @Test public void ref_02() - { - RefLong ref = new RefLong() ; - assertEquals(0, ref.value()) ; - ref.inc() ; - assertEquals(1, ref.value()) ; - ref.dec() ; - assertEquals(0, ref.value()) ; - } - - @Test public void ref_03() - { - RefLong ref = new RefLong(99) ; - assertEquals(99, ref.value()) ; - long x = ref.incAndGet() ; - assertEquals(100, x) ; - assertEquals(100, ref.value()) ; - x = ref.getAndInc() ; - assertEquals(100, x) ; - assertEquals(101, ref.value()) ; - } - - @Test public void ref_04() - { - RefLong ref = new RefLong(99) ; - assertEquals(99, ref.value()) ; - long x = ref.decAndGet() ; - assertEquals(98, x) ; - assertEquals(98, ref.value()) ; - x = ref.getAndDec() ; - assertEquals(98, x) ; - assertEquals(97, ref.value()) ; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestReverseComparator.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestReverseComparator.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestReverseComparator.java deleted file mode 100644 index 80b9c0d..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestReverseComparator.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - - -import java.util.ArrayList ; -import java.util.Arrays ; -import java.util.Collections ; -import java.util.Comparator ; -import java.util.List ; - -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.ReverseComparator ; -import org.junit.Test ; - -public class TestReverseComparator extends BaseTest -{ - static Comparator normal = new Comparator() - { - @Override - public int compare(String o1, String o2) - { - return o1.compareTo(o2); - } - }; - - static Comparator reverse = new ReverseComparator<>(normal); - - - static Comparator maxMin = new Comparator() - { - @Override - public int compare(String o1, String o2) - { - int value = o1.compareTo(o2); - if (value > 0) - return Integer.MAX_VALUE; - else if (value < 0) - return Integer.MIN_VALUE; - else - return 0; - } - }; - - static Comparator reverseMaxMin = new ReverseComparator<>(maxMin); - - static List items = Arrays.asList("a", "b", "c", "d"); - static List itemsReverse = Arrays.asList("d", "c", "b", "a"); - - @Test public void reverse_01() - { - List modified = new ArrayList<>(items); - Collections.sort(modified, reverse); - - test(itemsReverse, modified); - } - - @Test public void reverse_02() - { - List modified = new ArrayList<>(items); - Collections.sort(modified, reverseMaxMin); - - test(itemsReverse, modified); - } - - private void test(List expected, List actual) - { - assertEquals(expected.size(), actual.size()); - - for (int i=0; i x = set(1,2,3) ; - test(x,1,2,3) ; - } - - @Test public void set02() - { - Set x1 = set(1,2,3) ; - Set x2 = set(1,2,3) ; - Set x3 = SetUtils.intersection(x1, x2) ; - test(x3, 1,2,3) ; - x3 = SetUtils.intersection(x2, x1) ; - test(x3, 1,2,3) ; - } - - @Test public void set03() - { - Set x1 = set(1,2,3) ; - Set x2 = set(2,9) ; - Set x3 = SetUtils.intersection(x1, x2) ; - test(x3, 2) ; - x3 = SetUtils.intersection(x2, x1) ; - test(x3, 2) ; - } - - @Test public void set04() - { - Set x1 = set(1,2,3) ; - Set x2 = set(6,7,8) ; - Set x3 = SetUtils.intersection(x1, x2) ; - test(x3) ; - x3 = SetUtils.intersection(x2, x1) ; - test(x3) ; - } - - @Test public void set05() - { - Set x1 = set(1,2,3) ; - Set x2 = set(1,2,3) ; - Set x3 = SetUtils.union(x1, x2) ; - test(x3, 1,2,3) ; - x3 = SetUtils.union(x2, x1) ; - test(x3, 1,2,3) ; - } - - @Test public void set06() - { - Set x1 = set(1,2,3) ; - Set x2 = set(2,9) ; - Set x3 = SetUtils.union(x1, x2) ; - test(x3, 1,2,3,9) ; - x3 = SetUtils.union(x2, x1) ; - test(x3, 1,2,3,9) ; - } - - @Test public void set07() - { - Set x1 = set(1,2,3) ; - Set x2 = set() ; - Set x3 = SetUtils.union(x1, x2) ; - test(x3,1,2,3) ; - x3 = SetUtils.union(x2, x1) ; - test(x3,1,2,3) ; - } - - @Test public void set08() - { - Set x1 = set(1,2,3) ; - Set x2 = set() ; - Set x3 = SetUtils.difference(x1, x2) ; - test(x3,1,2,3) ; - x3 = SetUtils.difference(x2, x1) ; - test(x3) ; - } - - @Test public void set09() - { - Set x1 = set(1,2,3) ; - Set x2 = set(3) ; - Set x3 = SetUtils.difference(x1, x2) ; - test(x3,1,2) ; - x3 = SetUtils.difference(x2, x1) ; - test(x3) ; - } - - @Test public void set10() - { - Set x1 = set(1,2,3) ; - Set x2 = set(4,5,6) ; - Set x3 = SetUtils.difference(x1, x2) ; - test(x3,1,2,3) ; - x3 = SetUtils.difference(x2, x1) ; - test(x3,4,5,6) ; - } - - // -------- - - private static Set set(int... values) - { - return new HashSet<>(asList(values)) ; - } - - private void test(Set x, int...values) - { - List y = asList(values) ; - assertEquals(y.size(), x.size()) ; - - for ( Integer aY : y ) - { - assertTrue( x.contains( aY ) ); - } - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestStrUtils.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestStrUtils.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestStrUtils.java deleted file mode 100644 index ff1e8c6..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestStrUtils.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import org.apache.jena.atlas.junit.BaseTest ; -import org.apache.jena.atlas.lib.StrUtils ; -import org.junit.Test ; - -public class TestStrUtils extends BaseTest -{ - static char marker = '_' ; - static char esc[] = { ' ' , '_' } ; - - static void test(String x) - { - test(x, null) ; - } - - static void test(String x, String z) - { - String y = StrUtils.encodeHex(x, marker, esc) ; - if ( z != null ) - assertEquals(z, y) ; - String x2 = StrUtils.decodeHex(y, marker) ; - assertEquals(x, x2) ; - } - - @Test public void enc01() { test("abc") ; } - - @Test public void enc02() { test("") ; } - - @Test public void enc03() { test("_", "_5F" ) ; } - - @Test public void enc04() { test(" ", "_20" ) ; } - - @Test public void enc05() { test("_ _", "_5F_20_5F" ) ; } - - @Test public void enc06() { test("_5F", "_5F5F" ) ; } - - @Test public void enc07() { test("_2") ; } - - @Test public void enc08() { test("AB_CD", "AB_5FCD") ; } -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestTrie.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestTrie.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestTrie.java deleted file mode 100644 index 1cb9e2e..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestTrie.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; - -/** - * Tests for the {@link Trie} class - * - */ -public class TestTrie { - - /** - * Add a single key value - */ - @Test - public void trie_add_01() { - Trie trie = new Trie<>(); - trie.add("test", 123); - Assert.assertTrue(trie.contains("test")); - Assert.assertEquals((Integer) 123, trie.get("test")); - } - - /** - * Add two key values - */ - @Test - public void trie_add_02() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("other", 456); - Assert.assertTrue(trie.contains("test")); - Assert.assertTrue(trie.contains("other")); - Assert.assertEquals((Integer) 123, trie.get("test")); - Assert.assertEquals((Integer) 456, trie.get("other")); - } - - /** - * Replace an existing key value - */ - @Test - public void trie_add_03() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("test", 456); - Assert.assertTrue(trie.contains("test")); - Assert.assertEquals((Integer) 456, trie.get("test")); - } - - /** - * Adding a null value is ignored - */ - @Test - public void trie_add_04() { - Trie trie = new Trie<>(); - trie.add("test", null); - Assert.assertFalse(trie.contains("test")); - } - - /** - * Adding a null key is permitted - provides access to root of Trie - */ - @Test - public void trie_add_05() { - Trie trie = new Trie<>(); - trie.add(null, 123); - Assert.assertTrue(trie.contains(null)); - Assert.assertEquals((Integer)123, trie.get(null)); - } - - /** - * Adding an empty key is permitted - provides access to root of Trie - */ - @Test - public void trie_add_06() { - Trie trie = new Trie<>(); - trie.add("", 123); - Assert.assertTrue(trie.contains("")); - Assert.assertEquals((Integer)123, trie.get("")); - } - - /** - * Test for non-existent key - */ - @Test - public void trie_contains_01() { - Trie trie = new Trie<>(); - Assert.assertFalse(trie.contains("test")); - } - - /** - * Test for keys with and without values required - */ - @Test - public void trie_contains_02() { - Trie trie = new Trie<>(); - trie.add("test", 123); - Assert.assertTrue(trie.contains("test")); - Assert.assertTrue(trie.contains("test", true)); - Assert.assertTrue(trie.contains("test", 123)); - - // Any prefix of an added key exists if we don't require it to have a - // value - Assert.assertFalse(trie.contains("t")); - Assert.assertTrue(trie.contains("t", false)); - } - - /** - * Test for non-existent null key - */ - @Test - public void trie_contains_03() { - Trie trie = new Trie<>(); - Assert.assertFalse(trie.contains(null)); - Assert.assertTrue(trie.contains(null, false)); - } - - /** - * Test for empty key - */ - @Test - public void trie_contains_04() { - Trie trie = new Trie<>(); - Assert.assertFalse(trie.contains("")); - Assert.assertTrue(trie.contains("", false)); - } - - /** - * Removing a key value - */ - @Test - public void trie_remove_01() { - Trie trie = new Trie<>(); - trie.add("test", 123); - Assert.assertTrue(trie.contains("test")); - Assert.assertEquals((Integer) 123, trie.get("test")); - - // Removing does not fully remove the key it merely nulls the value - trie.remove("test"); - Assert.assertFalse(trie.contains("test")); - Assert.assertTrue(trie.contains("test", false)); - Assert.assertNull(trie.get("test")); - } - - /** - * Removing a key value, removing a key which is a prefix of another leaves - * the other intact - */ - @Test - public void trie_remove_02() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("testing", 456); - Assert.assertTrue(trie.contains("test")); - Assert.assertEquals((Integer) 123, trie.get("test")); - Assert.assertTrue(trie.contains("testing")); - Assert.assertEquals((Integer) 456, trie.get("testing")); - - // Removing does not fully remove the key it merely nulls the value - trie.remove("test"); - Assert.assertFalse(trie.contains("test")); - Assert.assertTrue(trie.contains("test", false)); - Assert.assertNull(trie.get("test")); - - // It also does not remove any keys who had the removed key as a prefix - Assert.assertTrue(trie.contains("testing")); - Assert.assertEquals((Integer) 456, trie.get("testing")); - } - - /** - * Test for removing null key - provides access to trie root - */ - @Test - public void trie_remove_03() { - Trie trie = new Trie<>(); - trie.add(null, 123); - Assert.assertTrue(trie.contains(null)); - Assert.assertEquals((Integer)123, trie.get(null)); - - trie.remove(null); - Assert.assertFalse(trie.contains(null)); - } - - /** - * Test for removing null key - provides access to trie root - */ - @Test - public void trie_remove_04() { - Trie trie = new Trie<>(); - trie.add("", 123); - Assert.assertTrue(trie.contains("")); - Assert.assertEquals((Integer)123, trie.get("")); - - trie.remove(""); - Assert.assertFalse(trie.contains("")); - } - - /** - * Test prefix search - */ - @Test - public void trie_prefix_search_01() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("testing", 456); - - //Prefix search on "test" should return two values - List matches = trie.prefixSearch("test"); - Assert.assertEquals(2, matches.size()); - - //Prefix search on "testi" should return one value - matches = trie.prefixSearch("testi"); - Assert.assertEquals(1, matches.size()); - - //Prefix search on "testingly" should return no values - matches = trie.prefixSearch("testingly"); - Assert.assertEquals(0, matches.size()); - - //Prefix search on null key should give two values - matches = trie.prefixSearch(null); - Assert.assertEquals(2, matches.size()); - } - - /** - * Test partial search - */ - @Test - public void trie_partial_search_01() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("testing", 456); - - //Partial search on "test" should return one values - List matches = trie.partialSearch("test"); - Assert.assertEquals(1, matches.size()); - - //Prefix search on "testi" should return one values - matches = trie.partialSearch("testi"); - Assert.assertEquals(1, matches.size()); - - //Prefix search on "testingly" should return two values - matches = trie.partialSearch("testingly"); - Assert.assertEquals(2, matches.size()); - - //Prefix search on null key should give no values - matches = trie.partialSearch(null); - Assert.assertEquals(0, matches.size()); - } - - /** - * Test longest match - */ - @Test - public void trie_longest_match_01() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("testing", 456); - Assert.assertTrue(trie.contains("test")); - Assert.assertTrue(trie.contains("testing")); - - Assert.assertEquals((Integer)456, trie.longestMatch("testing")); - } - - /** - * Test longest match - */ - @Test - public void trie_longest_match_02() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("testing", 456); - - Assert.assertEquals((Integer)456, trie.longestMatch("testingly")); - } - - /** - * Test longest match - */ - @Test - public void trie_longest_match_03() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("testing", 456); - trie.remove("testing"); - - Assert.assertEquals((Integer)123, trie.longestMatch("testing")); - } - - /** - * Test shortest match - */ - @Test - public void trie_shortest_match_01() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("testing", 456); - Assert.assertTrue(trie.contains("test")); - Assert.assertTrue(trie.contains("testing")); - - Assert.assertEquals((Integer)123, trie.shortestMatch("testing")); - } - - /** - * Test shortest match - */ - @Test - public void trie_shortest_match_02() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("testing", 456); - - Assert.assertEquals((Integer)123, trie.shortestMatch("testingly")); - } - - /** - * Test shortest match - */ - @Test - public void trie_shortest_match_03() { - Trie trie = new Trie<>(); - trie.add("test", 123); - trie.add("testing", 456); - trie.remove("test"); - - Assert.assertEquals((Integer)456, trie.shortestMatch("testing")); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestXMLLib.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestXMLLib.java b/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestXMLLib.java deleted file mode 100644 index cae99ef..0000000 --- a/jena-arq/src/test/java/org/apache/jena/atlas/lib/TestXMLLib.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.jena.atlas.lib; - -import org.apache.jena.atlas.lib.XMLLib ; -import org.junit.Assert ; -import org.junit.Test ; - -/** XML related functionality */ -public class TestXMLLib -{ - @Test public void ws_collapse_01() { test("abc", "abc") ; } - @Test public void ws_collapse_02() { test(" abc", "abc") ; } - @Test public void ws_collapse_03() { test(" abc ", "abc") ; } - @Test public void ws_collapse_04() { test(" a b c ", "a b c") ; } - @Test public void ws_collapse_05() { test("\babc", "\babc") ; } - @Test public void ws_collapse_06() { test("", "") ; } - @Test public void ws_collapse_07() { test(" ", "") ; } - @Test public void ws_collapse_08() { test(" \t\t\t\t\t\t\t ", "") ; } - - // String.trim : "Returns a copy of the string, with leading and trailing whitespace omitted." - // but later says it trims anything <= 0x20. There are lots of control characters in x01-x1F. - // We only want to trim \n \r \t and space. - - private static void test(String str1, String str2) - { - String result = XMLLib.WScollapse(str1) ; - Assert.assertEquals(str2, result) ; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/riot/lang/TS_Lang.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/riot/lang/TS_Lang.java b/jena-arq/src/test/java/org/apache/jena/riot/lang/TS_Lang.java index 517ea95..d0cb3ec 100644 --- a/jena-arq/src/test/java/org/apache/jena/riot/lang/TS_Lang.java +++ b/jena-arq/src/test/java/org/apache/jena/riot/lang/TS_Lang.java @@ -18,7 +18,7 @@ package org.apache.jena.riot.lang; -import org.apache.jena.atlas.junit.BaseTest ; +import org.apache.jena.atlas.legacy.BaseTest2 ; import org.junit.AfterClass ; import org.junit.BeforeClass ; import org.junit.runner.RunWith ; @@ -50,7 +50,7 @@ import org.junit.runners.Suite ; public class TS_Lang { - @BeforeClass public static void beforeClass() { BaseTest.setTestLogging() ; } - @AfterClass public static void afterClass() { BaseTest.unsetTestLogging() ; } + @BeforeClass public static void beforeClass() { BaseTest2.setTestLogging() ; } + @AfterClass public static void afterClass() { BaseTest2.unsetTestLogging() ; } } http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/riot/langsuite/LangTestCase.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/LangTestCase.java b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/LangTestCase.java index 804251c..903558c 100644 --- a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/LangTestCase.java +++ b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/LangTestCase.java @@ -18,7 +18,7 @@ package org.apache.jena.riot.langsuite; -import org.apache.jena.atlas.junit.BaseTest ; +import org.apache.jena.atlas.legacy.BaseTest2 ; import org.apache.jena.riot.SysRIOT ; import org.apache.jena.riot.system.ErrorHandlerFactory ; import org.apache.jena.sparql.junit.EarlReport ; @@ -40,7 +40,7 @@ public abstract class LangTestCase extends EarlTestCase { // The W3C Turtle and TriG test suites contain IRIs that generate warnings. // They are bad NFC for the version of UTF-8 that Java6 understands. - BaseTest.setTestLogging(ErrorHandlerFactory.errorHandlerNoWarnings) ; + BaseTest2.setTestLogging(ErrorHandlerFactory.errorHandlerNoWarnings) ; // If the test suite is sloppy, with IRIs that are not good practice, you may need // to run with warnings as not-errors .... @@ -59,7 +59,7 @@ public abstract class LangTestCase extends EarlTestCase _tearDown() ; SysRIOT.strictMode = sysRIOT_strictMode ; SysRIOT.StrictXSDLexicialForms = sysRIOT_strictXSDLexicialForms ; - BaseTest.unsetTestLogging() ; + BaseTest2.unsetTestLogging() ; } } http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadSyntax.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadSyntax.java b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadSyntax.java index c7a0ea7..adeab4e 100644 --- a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadSyntax.java +++ b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadSyntax.java @@ -19,7 +19,7 @@ package org.apache.jena.riot.langsuite; import static org.apache.jena.riot.SysRIOT.fmtMessage ; -import org.apache.jena.atlas.junit.BaseTest ; +import org.apache.jena.atlas.legacy.BaseTest2 ; import org.apache.jena.query.Dataset ; import org.apache.jena.query.DatasetFactory ; import org.apache.jena.rdf.model.Model ; @@ -69,10 +69,10 @@ public class UnitTestBadSyntax extends LangTestCase } ; @Override - protected void _setUp() { BaseTest.setTestLogging(ErrorHandlerFactory.errorHandlerStrictNoLogging) ; } + protected void _setUp() { BaseTest2.setTestLogging(ErrorHandlerFactory.errorHandlerStrictNoLogging) ; } @Override - protected void _tearDown() { BaseTest.unsetTestLogging() ; } + protected void _tearDown() { BaseTest2.unsetTestLogging() ; } @Override public void runTestForReal() http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/sparql/ARQTestSuite.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/ARQTestSuite.java b/jena-arq/src/test/java/org/apache/jena/sparql/ARQTestSuite.java index c5b7cac..5807000 100644 --- a/jena-arq/src/test/java/org/apache/jena/sparql/ARQTestSuite.java +++ b/jena-arq/src/test/java/org/apache/jena/sparql/ARQTestSuite.java @@ -20,8 +20,8 @@ package org.apache.jena.sparql; import junit.framework.JUnit4TestAdapter ; import junit.framework.TestSuite ; -import org.apache.jena.atlas.TC_Atlas ; -import org.apache.jena.atlas.junit.BaseTest ; +import org.apache.jena.atlas.legacy.BaseTest2 ; +import org.apache.jena.atlas.legacy.TC_Atlas_ARQ ; import org.apache.jena.common.TC_Common ; import org.apache.jena.query.ARQ ; import org.apache.jena.riot.TC_Riot ; @@ -53,10 +53,10 @@ public class ARQTestSuite extends TestSuite TestSuite ts = new ARQTestSuite() ; // No warnings (e.g. bad lexical forms). - BaseTest.setTestLogging() ; + BaseTest2.setTestLogging() ; // ARQ dependencies - ts.addTest(new JUnit4TestAdapter(TC_Atlas.class)) ; + ts.addTest(new JUnit4TestAdapter(TC_Atlas_ARQ.class)) ; ts.addTest(new JUnit4TestAdapter(TC_Common.class)) ; ts.addTest(new JUnit4TestAdapter(TC_Riot.class)) ; http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/org/apache/jena/sparql/engine/binding/TestBindingStreams.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/engine/binding/TestBindingStreams.java b/jena-arq/src/test/java/org/apache/jena/sparql/engine/binding/TestBindingStreams.java index e651a13..d8bbb26 100644 --- a/jena-arq/src/test/java/org/apache/jena/sparql/engine/binding/TestBindingStreams.java +++ b/jena-arq/src/test/java/org/apache/jena/sparql/engine/binding/TestBindingStreams.java @@ -24,12 +24,13 @@ import java.util.ArrayList ; import java.util.List ; import org.apache.jena.atlas.junit.BaseTest ; +import org.apache.jena.atlas.legacy.BaseTest2 ; import org.apache.jena.graph.Node ; import org.apache.jena.graph.NodeFactory ; import org.apache.jena.rdf.model.AnonId ; import org.apache.jena.riot.RiotException ; -import org.apache.jena.riot.system.PrefixMap; -import org.apache.jena.riot.system.PrefixMapFactory; +import org.apache.jena.riot.system.PrefixMap ; +import org.apache.jena.riot.system.PrefixMapFactory ; import org.apache.jena.riot.tokens.Tokenizer ; import org.apache.jena.riot.tokens.TokenizerFactory ; import org.apache.jena.sparql.core.Var ; @@ -47,12 +48,12 @@ public class TestBindingStreams extends BaseTest { @BeforeClass public static void beforeClass() { - setTestLogging() ; + BaseTest2.setTestLogging() ; } @AfterClass public static void afterClass() { - unsetTestLogging() ; + BaseTest2.unsetTestLogging() ; } static Binding b12 = build("(?a 1) (?b 2)") ; http://git-wip-us.apache.org/repos/asf/jena/blob/9eedadcd/jena-arq/src/test/java/riotcmd/rdflangtest.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/test/java/riotcmd/rdflangtest.java b/jena-arq/src/test/java/riotcmd/rdflangtest.java index 214284b..97a46d0 100644 --- a/jena-arq/src/test/java/riotcmd/rdflangtest.java +++ b/jena-arq/src/test/java/riotcmd/rdflangtest.java @@ -19,7 +19,7 @@ package riotcmd; import junit.framework.TestSuite ; -import org.apache.jena.atlas.junit.BaseTest ; +import org.apache.jena.atlas.legacy.BaseTest2 ; import org.apache.jena.atlas.lib.Lib ; import org.apache.jena.graph.Node ; import org.apache.jena.query.ARQ ; @@ -111,7 +111,7 @@ public class rdflangtest extends CmdGeneral protected void exec() { // Paradoxical naming - the boolean is a visibility flag. - BaseTest.setTestLogging() ; + BaseTest2.setTestLogging() ; if ( contains(strictDecl) ) {