From 814f55617f400defc5c70fd0541140556502d35d Mon Sep 17 00:00:00 2001 From: Jeffrey Alexander Date: Fri, 6 Oct 2023 15:20:17 -0400 Subject: [PATCH 1/3] Added string test for multiple word configured values --- LICENSE.txt | 4 ++-- .../config/ConfigurationManagerTest.java | 2 +- .../olcut/config/StringMultiwordTest.java | 21 +++++++++++++++++++ .../labs/mlrg/olcut/config/stringConfig.xml | 6 ++++++ pom.xml | 2 ++ 5 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 olcut-core/src/test/java/com/oracle/labs/mlrg/olcut/config/StringMultiwordTest.java diff --git a/LICENSE.txt b/LICENSE.txt index 0ba4debe..759a6946 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ BSD 2-Clause License -Copyright (c) 2020, Oracle and/or its affiliates. +Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -22,4 +22,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/olcut-core/src/test/java/com/oracle/labs/mlrg/olcut/config/ConfigurationManagerTest.java b/olcut-core/src/test/java/com/oracle/labs/mlrg/olcut/config/ConfigurationManagerTest.java index 7cd2f22d..695e7f4c 100644 --- a/olcut-core/src/test/java/com/oracle/labs/mlrg/olcut/config/ConfigurationManagerTest.java +++ b/olcut-core/src/test/java/com/oracle/labs/mlrg/olcut/config/ConfigurationManagerTest.java @@ -111,6 +111,6 @@ public void testMultipleLoading() { Configurable c = cm.lookup("default"); assertNotNull(c); - assertEquals(12,cm.getComponentNames().size()); + assertEquals(13,cm.getComponentNames().size()); } } diff --git a/olcut-core/src/test/java/com/oracle/labs/mlrg/olcut/config/StringMultiwordTest.java b/olcut-core/src/test/java/com/oracle/labs/mlrg/olcut/config/StringMultiwordTest.java new file mode 100644 index 00000000..65b0021d --- /dev/null +++ b/olcut-core/src/test/java/com/oracle/labs/mlrg/olcut/config/StringMultiwordTest.java @@ -0,0 +1,21 @@ +package com.oracle.labs.mlrg.olcut.config; + +import org.junit.jupiter.api.Test; + +import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class StringMultiwordTest { + + @Test + public void multiWord() throws IOException { + ConfigurationManager cm = new ConfigurationManager("stringConfig.xml"); + StringConfigurable sc = (StringConfigurable) cm.lookup( + "words"); + assertEquals("rhesus monkey", sc.one); + assertEquals("-Xmx16g -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005", sc.two); + assertEquals("test/value whitespace", sc.three); + + } +} diff --git a/olcut-core/src/test/resources/com/oracle/labs/mlrg/olcut/config/stringConfig.xml b/olcut-core/src/test/resources/com/oracle/labs/mlrg/olcut/config/stringConfig.xml index 698e8da8..d1737073 100644 --- a/olcut-core/src/test/resources/com/oracle/labs/mlrg/olcut/config/stringConfig.xml +++ b/olcut-core/src/test/resources/com/oracle/labs/mlrg/olcut/config/stringConfig.xml @@ -66,4 +66,10 @@ + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index d5cc791a..68d263eb 100644 --- a/pom.xml +++ b/pom.xml @@ -286,6 +286,7 @@ org.apache.maven.plugins maven-source-plugin + 3.2.1 attach-sources @@ -306,6 +307,7 @@ org.apache.maven.plugins maven-javadoc-plugin + 3.4.1 attach-javadocs From 21cb4cdde49d0b417890b16e2188baa00b0e2831 Mon Sep 17 00:00:00 2001 From: Jeffrey Alexander Date: Fri, 6 Oct 2023 15:39:47 -0400 Subject: [PATCH 2/3] Removed explicit versions from pom.xml These were added accidentally --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index 487c582a..64d1da15 100644 --- a/pom.xml +++ b/pom.xml @@ -285,7 +285,6 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 attach-sources @@ -306,7 +305,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.1 attach-javadocs From 0ee70e592c66f0d6c10ee622b755097f026f7c65 Mon Sep 17 00:00:00 2001 From: Jeffrey Alexander Date: Fri, 6 Oct 2023 15:52:25 -0400 Subject: [PATCH 3/3] Added license to StringMultiwordTest Sometimes the IDE hiding the license gets you... --- .../config_tests/StringMultiwordTest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/olcut-core-test/src/test/java/com/oracle/labs/mlrg/olcut/test/config_tests/StringMultiwordTest.java b/olcut-core-test/src/test/java/com/oracle/labs/mlrg/olcut/test/config_tests/StringMultiwordTest.java index fa244916..089e8bc4 100644 --- a/olcut-core-test/src/test/java/com/oracle/labs/mlrg/olcut/test/config_tests/StringMultiwordTest.java +++ b/olcut-core-test/src/test/java/com/oracle/labs/mlrg/olcut/test/config_tests/StringMultiwordTest.java @@ -1,3 +1,31 @@ +/* + * Copyright (c) 2004-2023, Oracle and/or its affiliates. + * + * Licensed under the 2-clause BSD license. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + package com.oracle.labs.mlrg.olcut.test.config_tests; import com.oracle.labs.mlrg.olcut.config.ConfigurationManager;