This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 6a174ec37 Maven housekeeping (#1695)
6a174ec37 is described below
commit 6a174ec379bf3825c7c0ef51e5ee2bd0955c1348
Author: Dominik Riemer <[email protected]>
AuthorDate: Wed Jun 21 21:13:44 2023 +0200
Maven housekeeping (#1695)
* Add several code improvements to reduce bundle size of core service
* Exclude JSON-LD dependency from pom
* Fix header
---
pom.xml | 2 +-
streampipes-client/pom.xml | 4 --
streampipes-commons/pom.xml | 10 +++++
.../streampipes/commons/resources/Resources.java | 26 +++++--------
.../src/test/java/TestResources.java | 27 +++++--------
streampipes-commons/src/test/resources/test.txt | 1 +
streampipes-config/pom.xml | 6 ---
.../param/model/SelectClauseParams.java | 6 +--
.../writer/TestConfiguredCsvOutputWriter.java | 4 +-
.../writer/TestConfiguredJsonOutputWriter.java | 4 +-
.../apache/streampipes/mail/utils/MailUtils.java | 7 ++--
streampipes-measurement-units/pom.xml | 3 +-
.../java/com/github/jqudt/onto/UnitFactory.java | 24 ------------
.../java/com/github/jqudt/onto/units/AreaUnit.java | 23 -----------
.../github/jqudt/onto/units/ConcentrationUnit.java | 25 ------------
.../com/github/jqudt/onto/units/CountingUnit.java | 16 --------
.../com/github/jqudt/onto/units/EnergyUnit.java | 16 --------
.../com/github/jqudt/onto/units/LengthUnit.java | 19 ----------
.../java/com/github/jqudt/onto/units/MassUnit.java | 23 -----------
.../jqudt/onto/units/PressureOrStressUnit.java | 15 --------
.../github/jqudt/onto/units/TemperatureUnit.java | 18 ---------
.../com/github/jqudt/onto/units/VolumeUnit.java | 18 ---------
streampipes-model/pom.xml | 12 +-----
.../streampipes/model/schema/EventProperty.java | 2 +-
.../streampipes/model/schema/EventSchema.java | 3 +-
.../apache/streampipes/model/util/ListUtils.java | 38 +++++++++++--------
.../manager/assets/DocumentationParser.java | 6 +--
.../manager/endpoint/EndpointItemFetcher.java | 3 +-
.../manager/endpoint/EndpointItemParser.java | 3 +-
.../manager/pipeline/PipelineManager.java | 10 ++---
streampipes-sdk/pom.xml | 9 +++--
.../org/apache/streampipes/sdk/helpers/Labels.java | 13 ++-----
streampipes-service-base/pom.xml | 4 --
.../service/core/WebSecurityConfig.java | 2 +-
.../core}/filter/TokenAuthenticationFilter.java | 2 +-
streampipes-service-discovery-consul/pom.xml | 4 --
streampipes-storage-couchdb/pom.xml | 8 ++--
.../couchdb/impl/ConnectionStorageImpl.java | 5 +--
.../storage/couchdb/impl/GenericStorageImpl.java | 5 +--
.../streampipes/storage/couchdb/utils/Utils.java | 5 +++
.../storage/couchdb/utils/TestUrlEscapers.java | 44 ++++++++++++++++++++++
streampipes-user-management/pom.xml | 4 +-
42 files changed, 148 insertions(+), 331 deletions(-)
diff --git a/pom.xml b/pom.xml
index d33595850..b13220b53 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,7 +42,7 @@
<asm.version>9.4</asm.version>
<cloning.version>1.9.12</cloning.version>
<commons-beanutils.version>1.9.4</commons-beanutils.version>
- <commons-codec.version>1.11</commons-codec.version>
+ <commons-codec.version>1.15</commons-codec.version>
<commons-collections.version>3.2.2</commons-collections.version>
<commons-io.version>2.11.0</commons-io.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
diff --git a/streampipes-client/pom.xml b/streampipes-client/pom.xml
index 3eb39855d..263ffa43d 100644
--- a/streampipes-client/pom.xml
+++ b/streampipes-client/pom.xml
@@ -83,10 +83,6 @@
</dependency>
<!-- 3rd party Dependencies -->
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
diff --git a/streampipes-commons/pom.xml b/streampipes-commons/pom.xml
index 18cf8dc38..3667bc39a 100644
--- a/streampipes-commons/pom.xml
+++ b/streampipes-commons/pom.xml
@@ -39,10 +39,20 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<extensions>
diff --git
a/streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
b/streampipes-commons/src/main/java/org/apache/streampipes/commons/resources/Resources.java
similarity index 52%
copy from
streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
copy to
streampipes-commons/src/main/java/org/apache/streampipes/commons/resources/Resources.java
index d82066f1b..32c0bdd2f 100644
---
a/streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
+++
b/streampipes-commons/src/main/java/org/apache/streampipes/commons/resources/Resources.java
@@ -15,29 +15,23 @@
* limitations under the License.
*
*/
-package org.apache.streampipes.mail.utils;
-import org.apache.streampipes.config.backend.BackendConfig;
-import org.apache.streampipes.config.backend.model.GeneralConfig;
+package org.apache.streampipes.commons.resources;
-import com.google.common.base.Charsets;
-import com.google.common.io.Resources;
+import org.apache.commons.io.IOUtils;
import java.io.IOException;
+import java.net.URL;
+import java.nio.charset.Charset;
-public class MailUtils {
+public class Resources {
- public static String extractBaseUrl() {
- GeneralConfig config = BackendConfig.INSTANCE.getGeneralConfig();
-
- return config.getProtocol() + "://" + config.getHostname() + ":" +
config.getPort();
- }
-
- public static String extractAppName() {
- return BackendConfig.INSTANCE.getGeneralConfig().getAppName();
+ public static String asString(String resourceName,
+ Charset charset) throws IOException {
+ return IOUtils.resourceToString(resourceName, charset,
ClassLoader.getSystemClassLoader());
}
- public static String readResourceFileToString(String filename) throws
IOException {
- return Resources.toString(Resources.getResource(filename), Charsets.UTF_8);
+ public static URL asUrl(String resourceName) throws IOException {
+ return IOUtils.resourceToURL(resourceName,
ClassLoader.getSystemClassLoader());
}
}
diff --git
a/streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
b/streampipes-commons/src/test/java/TestResources.java
similarity index 52%
copy from
streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
copy to streampipes-commons/src/test/java/TestResources.java
index d82066f1b..ec7174e33 100644
---
a/streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
+++ b/streampipes-commons/src/test/java/TestResources.java
@@ -15,29 +15,22 @@
* limitations under the License.
*
*/
-package org.apache.streampipes.mail.utils;
-import org.apache.streampipes.config.backend.BackendConfig;
-import org.apache.streampipes.config.backend.model.GeneralConfig;
+import org.apache.streampipes.commons.resources.Resources;
-import com.google.common.base.Charsets;
-import com.google.common.io.Resources;
+import org.junit.Test;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
-public class MailUtils {
+import static junit.framework.TestCase.assertEquals;
- public static String extractBaseUrl() {
- GeneralConfig config = BackendConfig.INSTANCE.getGeneralConfig();
+public class TestResources {
- return config.getProtocol() + "://" + config.getHostname() + ":" +
config.getPort();
- }
-
- public static String extractAppName() {
- return BackendConfig.INSTANCE.getGeneralConfig().getAppName();
- }
-
- public static String readResourceFileToString(String filename) throws
IOException {
- return Resources.toString(Resources.getResource(filename), Charsets.UTF_8);
+ @Test
+ public void testResourceLoader() throws IOException {
+ String filename = "test.txt";
+ String content = Resources.asString(filename, StandardCharsets.UTF_8);
+ assertEquals("HelloWorld", content.replaceAll("\\s+",""));
}
}
diff --git a/streampipes-commons/src/test/resources/test.txt
b/streampipes-commons/src/test/resources/test.txt
new file mode 100644
index 000000000..3da1ec26e
--- /dev/null
+++ b/streampipes-commons/src/test/resources/test.txt
@@ -0,0 +1 @@
+HelloWorld
diff --git a/streampipes-config/pom.xml b/streampipes-config/pom.xml
index 1c57e371d..6f70e62e5 100644
--- a/streampipes-config/pom.xml
+++ b/streampipes-config/pom.xml
@@ -49,12 +49,6 @@
<artifactId>streampipes-service-discovery</artifactId>
<version>0.93.0-SNAPSHOT</version>
</dependency>
-
- <!-- External dependencies -->
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- </dependency>
</dependencies>
<build>
diff --git
a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/param/model/SelectClauseParams.java
b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/param/model/SelectClauseParams.java
index 6861b4915..fe7f8d0f6 100644
---
a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/param/model/SelectClauseParams.java
+++
b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/param/model/SelectClauseParams.java
@@ -22,8 +22,6 @@ package org.apache.streampipes.dataexplorer.param.model;
import org.apache.streampipes.dataexplorer.api.IQueryStatement;
import org.apache.streampipes.dataexplorer.querybuilder.IDataLakeQueryBuilder;
-import javax.annotation.Nullable;
-
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -56,8 +54,8 @@ public class SelectClauseParams implements IQueryStatement {
}
}
- public static SelectClauseParams from(@Nullable String columns,
- @Nullable String aggregationFunction) {
+ public static SelectClauseParams from(String columns,
+ String aggregationFunction) {
return new SelectClauseParams(columns, aggregationFunction);
}
diff --git
a/streampipes-data-explorer/src/test/java/org/apache/streampipes/dataexplorer/query/writer/TestConfiguredCsvOutputWriter.java
b/streampipes-data-explorer/src/test/java/org/apache/streampipes/dataexplorer/query/writer/TestConfiguredCsvOutputWriter.java
index 5b64b4421..f929f7165 100644
---
a/streampipes-data-explorer/src/test/java/org/apache/streampipes/dataexplorer/query/writer/TestConfiguredCsvOutputWriter.java
+++
b/streampipes-data-explorer/src/test/java/org/apache/streampipes/dataexplorer/query/writer/TestConfiguredCsvOutputWriter.java
@@ -20,11 +20,11 @@ package org.apache.streampipes.dataexplorer.query.writer;
import org.apache.streampipes.dataexplorer.param.ProvidedRestQueryParams;
-import com.google.common.base.Charsets;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import static org.junit.Assert.assertEquals;
@@ -46,7 +46,7 @@ public class TestConfiguredCsvOutputWriter extends
TestConfiguredOutputWriter {
}
writer.afterLastItem(outputStream);
- assertEquals(Expected, outputStream.toString(Charsets.UTF_8));
+ assertEquals(Expected, outputStream.toString(StandardCharsets.UTF_8));
}
}
}
diff --git
a/streampipes-data-explorer/src/test/java/org/apache/streampipes/dataexplorer/query/writer/TestConfiguredJsonOutputWriter.java
b/streampipes-data-explorer/src/test/java/org/apache/streampipes/dataexplorer/query/writer/TestConfiguredJsonOutputWriter.java
index 2e0431cf7..1acecffda 100644
---
a/streampipes-data-explorer/src/test/java/org/apache/streampipes/dataexplorer/query/writer/TestConfiguredJsonOutputWriter.java
+++
b/streampipes-data-explorer/src/test/java/org/apache/streampipes/dataexplorer/query/writer/TestConfiguredJsonOutputWriter.java
@@ -20,11 +20,11 @@ package org.apache.streampipes.dataexplorer.query.writer;
import org.apache.streampipes.dataexplorer.param.ProvidedRestQueryParams;
-import com.google.common.base.Charsets;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import static org.junit.Assert.assertEquals;
@@ -47,7 +47,7 @@ public class TestConfiguredJsonOutputWriter extends
TestConfiguredOutputWriter {
}
writer.afterLastItem(outputStream);
- assertEquals(Expected, outputStream.toString(Charsets.UTF_8));
+ assertEquals(Expected, outputStream.toString(StandardCharsets.UTF_8));
}
}
}
diff --git
a/streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
b/streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
index d82066f1b..317f53496 100644
---
a/streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
+++
b/streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
@@ -17,13 +17,12 @@
*/
package org.apache.streampipes.mail.utils;
+import org.apache.streampipes.commons.resources.Resources;
import org.apache.streampipes.config.backend.BackendConfig;
import org.apache.streampipes.config.backend.model.GeneralConfig;
-import com.google.common.base.Charsets;
-import com.google.common.io.Resources;
-
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
public class MailUtils {
@@ -38,6 +37,6 @@ public class MailUtils {
}
public static String readResourceFileToString(String filename) throws
IOException {
- return Resources.toString(Resources.getResource(filename), Charsets.UTF_8);
+ return Resources.asString(filename, StandardCharsets.UTF_8);
}
}
diff --git a/streampipes-measurement-units/pom.xml
b/streampipes-measurement-units/pom.xml
index 839f5d619..896bf4cab 100644
--- a/streampipes-measurement-units/pom.xml
+++ b/streampipes-measurement-units/pom.xml
@@ -16,7 +16,8 @@
~
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.streampipes</groupId>
diff --git
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/UnitFactory.java
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/UnitFactory.java
index 495da2912..d9fdf6b75 100644
---
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/UnitFactory.java
+++
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/UnitFactory.java
@@ -13,7 +13,6 @@ import org.eclipse.rdf4j.model.impl.LinkedHashModel;
import org.eclipse.rdf4j.model.impl.ValueFactoryImpl;
import org.eclipse.rdf4j.model.vocabulary.RDF;
import org.eclipse.rdf4j.model.vocabulary.RDFS;
-import org.eclipse.rdf4j.model.vocabulary.XMLSchema;
import java.net.URI;
import java.net.URISyntaxException;
@@ -90,8 +89,6 @@ public class UnitFactory {
unit.setType(new
URI(typeURI.stringValue()));
}
}
- } else {
- // System.out.println("Ignoring: " +
statement);
}
}
unit.setMultiplier(multiplier);
@@ -102,27 +99,6 @@ public class UnitFactory {
return unit;
}
- public List<Unit> findUnits(String symbol) {
- if (symbol == null) throw new IllegalArgumentException("The
symbol cannot be null");
-
- ValueFactory f = ValueFactoryImpl.getInstance();
- Model statements = repos.filter(null, QUDT.ABBREVIATION,
f.createLiteral(symbol, XMLSchema.STRING));
- if (statements.isEmpty()) return Collections.emptyList();
- List<Unit> foundUnits = new ArrayList<>();
- for (Statement statement : statements) {
- Object type = statement.getSubject();
- try {
- if (type instanceof
org.eclipse.rdf4j.model.URI) {
- org.eclipse.rdf4j.model.URI typeURI =
(org.eclipse.rdf4j.model.URI)type;
-
foundUnits.add(getUnit(typeURI.toString()));
- }
- } catch (Exception exception) {
- // ignore
- }
- }
- return foundUnits;
- }
-
public List<String> getURIs(String type) {
URI uri;
try {
diff --git
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/AreaUnit.java
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/AreaUnit.java
deleted file mode 100644
index 118d47117..000000000
---
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/AreaUnit.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 2012 Egon Willighagen <[email protected]>
- *
- * License: new BSD
- */
-package com.github.jqudt.onto.units;
-
-import com.github.jqudt.Unit;
-import com.github.jqudt.onto.UnitFactory;
-
-public class AreaUnit {
-
- public static Unit SQUARE_METER = UnitFactory
- .getInstance()
-
.getUnit("http://qudt.org/vocab/unit#SquareMeter");
-
- public static Unit SQUARE_ANGSTROM = UnitFactory
- .getInstance()
-
.getUnit("http://www.openphacts.org/units/SquareAngstrom");
-
- private AreaUnit() {}
-
-
-}
diff --git
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/ConcentrationUnit.java
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/ConcentrationUnit.java
deleted file mode 100644
index 0c526b0cf..000000000
---
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/ConcentrationUnit.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2012 Egon Willighagen <[email protected]>
- *
- * License: new BSD
- */
-package com.github.jqudt.onto.units;
-
-import com.github.jqudt.Unit;
-import com.github.jqudt.onto.UnitFactory;
-
-public class ConcentrationUnit {
-
- public static Unit MOLE_PER_CUBIC_METER =
UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#MolePerCubicMeter");
-
- public static Unit MOLAR =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Molar");
- public static Unit MILLIMOLAR =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Millimolar");
- public static Unit NANOMOLAR =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Nanomolar");
- public static Unit MICROMOLAR =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Micromolar");
-
- public static Unit GRAM_PER_LITER =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/GramPerLiter");
- public static Unit MICROGRAM_PER_MILLILITER =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/MicrogramPerMilliliter");
- public static Unit PICOGRAM_PER_MILLILITER =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/PicogramPerMilliliter");
-
- private ConcentrationUnit() {}
-
-}
diff --git
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/CountingUnit.java
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/CountingUnit.java
deleted file mode 100644
index c4363431a..000000000
---
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/CountingUnit.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Copyright (C) 2012 Egon Willighagen <[email protected]>
- *
- * License: new BSD
- */
-package com.github.jqudt.onto.units;
-
-import com.github.jqudt.Unit;
-import com.github.jqudt.onto.UnitFactory;
-
-public class CountingUnit {
-
- public static Unit PERCENT =
UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#Percent");
-
- private CountingUnit() {}
-
-}
diff --git
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/EnergyUnit.java
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/EnergyUnit.java
deleted file mode 100644
index 5f6f671d0..000000000
---
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/EnergyUnit.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Copyright (C) 2012 Egon Willighagen <[email protected]>
- *
- * License: new BSD
- */
-package com.github.jqudt.onto.units;
-
-import com.github.jqudt.Unit;
-import com.github.jqudt.onto.UnitFactory;
-
-public class EnergyUnit {
-
- private EnergyUnit() {}
-
- public static Unit EV =
UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#ElectronVolt");
-
-}
diff --git
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/LengthUnit.java
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/LengthUnit.java
deleted file mode 100644
index 538bf26a8..000000000
---
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/LengthUnit.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (C) 2012 Egon Willighagen <[email protected]>
- *
- * License: new BSD
- */
-package com.github.jqudt.onto.units;
-
-import com.github.jqudt.Unit;
-import com.github.jqudt.onto.UnitFactory;
-
-public class LengthUnit {
-
- private LengthUnit() {
- }
-
- public static Unit NM = UnitFactory
- .getInstance()
- .getUnit("http://www.openphacts.org/units/Nanometer");
-
-}
diff --git
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/MassUnit.java
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/MassUnit.java
deleted file mode 100644
index 7c0cd2d00..000000000
---
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/MassUnit.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 2012 Egon Willighagen <[email protected]>
- *
- * License: new BSD
- */
-package com.github.jqudt.onto.units;
-
-import com.github.jqudt.Unit;
-import com.github.jqudt.onto.UnitFactory;
-
-public class MassUnit {
-
- public static Unit KILOGRAM =
UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#Kilogram");
- public static Unit GRAM =
UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#Gram");
- public static Unit MILLIGRAM =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Milligram");
- public static Unit MICROGRAM =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Microgram");
- public static Unit NANOGRAM =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Nanogram");
- public static Unit PICOGRAM =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Picogram");
- public static Unit FEMTOGRAM =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Femtogram");
-
- private MassUnit() {
- }
-
-}
diff --git
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/PressureOrStressUnit.java
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/PressureOrStressUnit.java
deleted file mode 100644
index f6943caf9..000000000
---
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/PressureOrStressUnit.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Copyright (C) 2012 Egon Willighagen <[email protected]>
- *
- * License: new BSD
- */
-package com.github.jqudt.onto.units;
-
-import com.github.jqudt.Unit;
-import com.github.jqudt.onto.UnitFactory;
-
-public class PressureOrStressUnit {
- private PressureOrStressUnit() {}
-
- public static Unit PASCAL =
UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#Pascal");
-
-}
diff --git
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/TemperatureUnit.java
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/TemperatureUnit.java
deleted file mode 100644
index 388d4f019..000000000
---
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/TemperatureUnit.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (C) 2012 Egon Willighagen <[email protected]>
- *
- * License: new BSD
- */
-package com.github.jqudt.onto.units;
-
-import com.github.jqudt.Unit;
-import com.github.jqudt.onto.UnitFactory;
-
-public class TemperatureUnit {
-
- private TemperatureUnit() {}
-
- public static Unit KELVIN =
UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#Kelvin");
- public static Unit CELSIUS =
UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#DegreeCelsius");
- public static Unit FAHRENHEIT =
UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#DegreeFahrenheit");
-
-}
diff --git
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/VolumeUnit.java
b/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/VolumeUnit.java
deleted file mode 100644
index 04156b085..000000000
---
a/streampipes-measurement-units/src/main/java/com/github/jqudt/onto/units/VolumeUnit.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (C) 2012 Egon Willighagen <[email protected]>
- *
- * License: new BSD
- */
-package com.github.jqudt.onto.units;
-
-import com.github.jqudt.Unit;
-import com.github.jqudt.onto.UnitFactory;
-
-public class VolumeUnit {
-
- private VolumeUnit() {}
-
- public static Unit LITER =
UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#Liter");
- public static Unit MICROLITER =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Microliter");
- public static Unit MILLILITER =
UnitFactory.getInstance().getUnit("http://www.openphacts.org/units/Milliliter");
-
-}
diff --git a/streampipes-model/pom.xml b/streampipes-model/pom.xml
index 6526385f5..059059f41 100644
--- a/streampipes-model/pom.xml
+++ b/streampipes-model/pom.xml
@@ -71,24 +71,16 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
+ <scope>test</scope>
</dependency>
- <dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-stream_2.11</artifactId>
- <version>2.5.21</version>
- <scope>compile</scope>
- </dependency>
</dependencies>
<build>
diff --git
a/streampipes-model/src/main/java/org/apache/streampipes/model/schema/EventProperty.java
b/streampipes-model/src/main/java/org/apache/streampipes/model/schema/EventProperty.java
index 0cdc8f15e..9cc33eae6 100644
---
a/streampipes-model/src/main/java/org/apache/streampipes/model/schema/EventProperty.java
+++
b/streampipes-model/src/main/java/org/apache/streampipes/model/schema/EventProperty.java
@@ -19,10 +19,10 @@
package org.apache.streampipes.model.schema;
import org.apache.streampipes.model.util.ElementIdGenerator;
+import org.apache.streampipes.model.util.ListUtils;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import org.apache.commons.collections.ListUtils;
import java.net.URI;
import java.util.ArrayList;
diff --git
a/streampipes-model/src/main/java/org/apache/streampipes/model/schema/EventSchema.java
b/streampipes-model/src/main/java/org/apache/streampipes/model/schema/EventSchema.java
index d5e21a104..89c978c1a 100644
---
a/streampipes-model/src/main/java/org/apache/streampipes/model/schema/EventSchema.java
+++
b/streampipes-model/src/main/java/org/apache/streampipes/model/schema/EventSchema.java
@@ -19,8 +19,7 @@
package org.apache.streampipes.model.schema;
import org.apache.streampipes.model.util.Cloner;
-
-import org.apache.commons.collections.ListUtils;
+import org.apache.streampipes.model.util.ListUtils;
import java.util.ArrayList;
import java.util.List;
diff --git
a/streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
b/streampipes-model/src/main/java/org/apache/streampipes/model/util/ListUtils.java
similarity index 51%
copy from
streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
copy to
streampipes-model/src/main/java/org/apache/streampipes/model/util/ListUtils.java
index d82066f1b..7e2a1b4c4 100644
---
a/streampipes-mail/src/main/java/org/apache/streampipes/mail/utils/MailUtils.java
+++
b/streampipes-model/src/main/java/org/apache/streampipes/model/util/ListUtils.java
@@ -15,29 +15,35 @@
* limitations under the License.
*
*/
-package org.apache.streampipes.mail.utils;
-import org.apache.streampipes.config.backend.BackendConfig;
-import org.apache.streampipes.config.backend.model.GeneralConfig;
+package org.apache.streampipes.model.util;
-import com.google.common.base.Charsets;
-import com.google.common.io.Resources;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Objects;
-import java.io.IOException;
+public class ListUtils {
-public class MailUtils {
+ public static boolean isEqualList(final Collection<?> list1, final
Collection<?> list2) {
+ if (list1 == list2) {
+ return true;
+ }
+ if (list1 == null || list2 == null || list1.size() != list2.size()) {
+ return false;
+ }
- public static String extractBaseUrl() {
- GeneralConfig config = BackendConfig.INSTANCE.getGeneralConfig();
+ final Iterator<?> it1 = list1.iterator();
+ final Iterator<?> it2 = list2.iterator();
- return config.getProtocol() + "://" + config.getHostname() + ":" +
config.getPort();
- }
+ while (it1.hasNext() && it2.hasNext()) {
+ final Object obj1 = it1.next();
+ final Object obj2 = it2.next();
- public static String extractAppName() {
- return BackendConfig.INSTANCE.getGeneralConfig().getAppName();
- }
+ if (!Objects.equals(obj1, obj2)) {
+ return false;
+ }
+ }
- public static String readResourceFileToString(String filename) throws
IOException {
- return Resources.toString(Resources.getResource(filename), Charsets.UTF_8);
+ return !(it1.hasNext() || it2.hasNext());
}
}
diff --git
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/assets/DocumentationParser.java
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/assets/DocumentationParser.java
index 9ee7c7491..01d1e2a27 100644
---
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/assets/DocumentationParser.java
+++
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/assets/DocumentationParser.java
@@ -17,11 +17,11 @@
*/
package org.apache.streampipes.manager.assets;
-import com.google.common.base.Charsets;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
public class DocumentationParser {
@@ -38,14 +38,14 @@ public class DocumentationParser {
try {
String fileContents = getFileContents();
String newFileContents = new ImagePathReplacer(fileContents,
appId).replaceContent();
- FileUtils.writeStringToFile(file, newFileContents, Charsets.UTF_8);
+ FileUtils.writeStringToFile(file, newFileContents,
StandardCharsets.UTF_8);
} catch (IOException e) {
e.printStackTrace();
}
}
private String getFileContents() throws IOException {
- return FileUtils.readFileToString(file, Charsets.UTF_8);
+ return FileUtils.readFileToString(file, StandardCharsets.UTF_8);
}
}
diff --git
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java
index 0c103e699..0cfda6e2b 100644
---
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java
+++
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java
@@ -27,7 +27,6 @@ import org.apache.http.client.fluent.Request;
import org.apache.http.message.BasicHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.http.MediaType;
import java.io.IOException;
import java.util.ArrayList;
@@ -51,7 +50,7 @@ public class EndpointItemFetcher {
private List<ExtensionsServiceEndpointItem>
getEndpointItems(ExtensionsServiceEndpoint e) {
try {
String result = Request.Get(e.getEndpointUrl())
- .addHeader(new BasicHeader("Accept",
MediaType.APPLICATION_JSON_VALUE))
+ .addHeader(new BasicHeader("Accept", "application/json"))
.connectTimeout(1000)
.execute()
.returnContent()
diff --git
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemParser.java
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemParser.java
index 24eab2689..88a3a22c6 100644
---
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemParser.java
+++
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemParser.java
@@ -23,7 +23,6 @@ import org.apache.streampipes.model.message.NotificationType;
import org.apache.streampipes.model.message.Notifications;
import org.apache.http.client.fluent.Request;
-import org.springframework.http.MediaType;
import java.io.IOException;
import java.net.URLDecoder;
@@ -47,7 +46,7 @@ public class EndpointItemParser {
private String parseURIContent(String url) throws IOException {
return Request
.Get(url)
- .addHeader("Accept", MediaType.APPLICATION_JSON_VALUE)
+ .addHeader("Accept", "application/json")
.execute()
.returnContent()
.asString();
diff --git
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java
index 3fcc77e46..c0f1c12a4 100644
---
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java
+++
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java
@@ -29,8 +29,6 @@ import org.apache.streampipes.storage.api.IPermissionStorage;
import org.apache.streampipes.storage.api.IPipelineStorage;
import org.apache.streampipes.storage.management.StorageDispatcher;
-import com.google.common.collect.Streams;
-
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -129,10 +127,10 @@ public class PipelineManager {
.collect(Collectors.toList());
}
- private static Stream<NamedStreamPipesEntity> mergePipelineElement(Pipeline
pipeline) {
- return Streams.concat(pipeline.getStreams().stream(),
- pipeline.getActions().stream(),
- pipeline.getSepas().stream());
+ private static Stream<? extends NamedStreamPipesEntity>
mergePipelineElement(Pipeline pipeline) {
+ return Stream.concat(
+ Stream.concat(pipeline.getStreams().stream(),
pipeline.getSepas().stream()),
+ pipeline.getActions().stream());
}
private static void preparePipelineBasics(String username,
diff --git a/streampipes-sdk/pom.xml b/streampipes-sdk/pom.xml
index 2ca709b03..5b4671c79 100644
--- a/streampipes-sdk/pom.xml
+++ b/streampipes-sdk/pom.xml
@@ -34,6 +34,11 @@
<artifactId>streampipes-config</artifactId>
<version>0.93.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-commons</artifactId>
+ <version>0.93.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.streampipes</groupId>
<artifactId>streampipes-extensions-api</artifactId>
@@ -51,10 +56,6 @@
</dependency>
<!-- External dependencies -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
<dependency>
<groupId>com.github.drapostolos</groupId>
<artifactId>type-parser</artifactId>
diff --git
a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Labels.java
b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Labels.java
index 1a29aa0e4..378e5372a 100644
---
a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Labels.java
+++
b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Labels.java
@@ -18,13 +18,12 @@
package org.apache.streampipes.sdk.helpers;
-import com.google.common.io.ByteSource;
-import com.google.common.io.Resources;
+import org.apache.streampipes.commons.resources.Resources;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
@@ -117,14 +116,10 @@ public class Labels {
}
private static Properties loadProperties(String filename) throws IOException
{
- URL url = Resources.getResource(filename);
+ URL url = Resources.asUrl(filename);
final Properties props = new Properties();
- final ByteSource byteSource = Resources.asByteSource(url);
- InputStream inputStream = null;
-
- inputStream = byteSource.openBufferedStream();
- props.load(inputStream);
+ props.load(url.openStream());
return props;
}
diff --git a/streampipes-service-base/pom.xml b/streampipes-service-base/pom.xml
index 496781231..8da3f3f26 100644
--- a/streampipes-service-base/pom.xml
+++ b/streampipes-service-base/pom.xml
@@ -121,10 +121,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
- <dependency>
- <groupId>org.hibernate.validator</groupId>
- <artifactId>hibernate-validator</artifactId>
- </dependency>
</dependencies>
<build>
<plugins>
diff --git
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/WebSecurityConfig.java
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/WebSecurityConfig.java
index fb46f2546..214b21b9d 100644
---
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/WebSecurityConfig.java
+++
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/WebSecurityConfig.java
@@ -18,8 +18,8 @@
package org.apache.streampipes.service.core;
-import org.apache.streampipes.rest.filter.TokenAuthenticationFilter;
import
org.apache.streampipes.service.base.security.UnauthorizedRequestEntryPoint;
+import org.apache.streampipes.service.core.filter.TokenAuthenticationFilter;
import org.apache.streampipes.user.management.service.SpUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/TokenAuthenticationFilter.java
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/filter/TokenAuthenticationFilter.java
similarity index 98%
rename from
streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/TokenAuthenticationFilter.java
rename to
streampipes-service-core/src/main/java/org/apache/streampipes/service/core/filter/TokenAuthenticationFilter.java
index fa4e64cac..e389f4afb 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/TokenAuthenticationFilter.java
+++
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/filter/TokenAuthenticationFilter.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.rest.filter;
+package org.apache.streampipes.service.core.filter;
import org.apache.streampipes.commons.constants.HttpConstants;
import org.apache.streampipes.model.client.user.Principal;
diff --git a/streampipes-service-discovery-consul/pom.xml
b/streampipes-service-discovery-consul/pom.xml
index d3a102fa5..f6e34c39c 100644
--- a/streampipes-service-discovery-consul/pom.xml
+++ b/streampipes-service-discovery-consul/pom.xml
@@ -50,10 +50,6 @@
<artifactId>consul-api</artifactId>
<version>1.4.5</version>
</dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>fluent-hc</artifactId>
diff --git a/streampipes-storage-couchdb/pom.xml
b/streampipes-storage-couchdb/pom.xml
index 44f478e5d..963d0a25c 100644
--- a/streampipes-storage-couchdb/pom.xml
+++ b/streampipes-storage-couchdb/pom.xml
@@ -51,14 +51,14 @@
</dependency>
<!-- External dependencies -->
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
<dependency>
<groupId>org.lightcouch</groupId>
<artifactId>lightcouch</artifactId>
diff --git
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/ConnectionStorageImpl.java
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/ConnectionStorageImpl.java
index 6402d4b30..7f98b3746 100644
---
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/ConnectionStorageImpl.java
+++
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/ConnectionStorageImpl.java
@@ -24,7 +24,6 @@ import
org.apache.streampipes.storage.api.IPipelineElementConnectionStorage;
import org.apache.streampipes.storage.couchdb.dao.AbstractDao;
import org.apache.streampipes.storage.couchdb.utils.Utils;
-import com.google.common.net.UrlEscapers;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -67,8 +66,8 @@ public class ConnectionStorageImpl extends
AbstractDao<Connection> implements
}
private String buildQuery(String from) {
- String escapedPath = UrlEscapers.urlPathSegmentEscaper()
- .escape("startkey=[\"" + from + "\"]&endkey=[\"" + from + "\",
{}]&group=true");
+ String escapedPath = Utils
+ .escapePathSegment("startkey=[\"" + from + "\"]&endkey=[\"" + from +
"\", {}]&group=true");
return couchDbClientSupplier.get().getDBUri() +
"_design/connection/_view/frequent?" + escapedPath;
}
diff --git
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/GenericStorageImpl.java
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/GenericStorageImpl.java
index 0817e5229..c0f814b58 100644
---
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/GenericStorageImpl.java
+++
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/GenericStorageImpl.java
@@ -26,7 +26,6 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.net.UrlEscapers;
import org.apache.http.client.fluent.Content;
import org.apache.http.client.fluent.Request;
@@ -52,8 +51,8 @@ public class GenericStorageImpl implements IGenericStorage {
@Override
public List<Map<String, Object>> findAll(String type) throws IOException {
- String query = getDatabaseRoute() +
"/_design/appDocType/_view/appDocType?" + UrlEscapers.urlPathSegmentEscaper()
- .escape("startkey=[\"" + type + "\"]&endkey=[\"" + type +
"\",{}]&include_docs=true");
+ String query = getDatabaseRoute() +
"/_design/appDocType/_view/appDocType?" + Utils
+ .escapePathSegment("startkey=[\"" + type + "\"]&endkey=[\"" + type +
"\",{}]&include_docs=true");
Map<String, Object> queryResult = this.queryDocuments(query);
List<Map<String, Object>> rows = (List<Map<String, Object>>)
queryResult.get("rows");
diff --git
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Utils.java
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Utils.java
index ba4356f0f..4ec1b20a2 100644
---
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Utils.java
+++
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Utils.java
@@ -22,6 +22,7 @@ import org.apache.streampipes.commons.environment.Environment;
import org.apache.streampipes.commons.environment.Environments;
import org.apache.streampipes.storage.couchdb.serializer.GsonSerializer;
+import com.google.common.net.UrlEscapers;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpHeaders;
import org.apache.http.client.fluent.Request;
@@ -35,6 +36,10 @@ public class Utils {
return getCouchDbGsonClient("data-processor");
}
+ public static String escapePathSegment(String urlSegment) {
+ return UrlEscapers.urlPathSegmentEscaper().escape(urlSegment);
+ }
+
public static CouchDbClient getCouchDbDataStreamDescriptionClient() {
return getCouchDbGsonClient("data-stream");
}
diff --git
a/streampipes-storage-couchdb/src/test/java/org/apache/streampipes/storage/couchdb/utils/TestUrlEscapers.java
b/streampipes-storage-couchdb/src/test/java/org/apache/streampipes/storage/couchdb/utils/TestUrlEscapers.java
new file mode 100644
index 000000000..50926ed4f
--- /dev/null
+++
b/streampipes-storage-couchdb/src/test/java/org/apache/streampipes/storage/couchdb/utils/TestUrlEscapers.java
@@ -0,0 +1,44 @@
+/*
+ * 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.streampipes.storage.couchdb.utils;
+
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertEquals;
+
+public class TestUrlEscapers {
+
+ @Test
+ public void testUrlPathEscaper() {
+ String type = "typeDummy";
+ String test = "startkey=[\"" + type + "\"]&endkey=[\"" + type +
"\",{}]&include_docs=true";
+ String escaped = Utils.escapePathSegment(test);
+ String expected =
"startkey=%5B%22typeDummy%22%5D&endkey=%5B%22typeDummy%22,%7B%7D%5D&include_docs=true";
+ assertEquals(expected, escaped);
+ }
+
+ @Test
+ public void testUrlPathEscaper2() {
+ String from = "fromDummy";
+ String test = "startkey=[\"" + from + "\"]&endkey=[\"" + from + "\",
{}]&group=true";
+ String escaped = Utils.escapePathSegment(test);
+ String expected2 =
"startkey=%5B%22fromDummy%22%5D&endkey=%5B%22fromDummy%22,%20%7B%7D%5D&group=true";
+ assertEquals(expected2, escaped);
+ }
+}
diff --git a/streampipes-user-management/pom.xml
b/streampipes-user-management/pom.xml
index 632959c08..8d5592fb7 100644
--- a/streampipes-user-management/pom.xml
+++ b/streampipes-user-management/pom.xml
@@ -52,8 +52,8 @@
<!-- External dependencies -->
<dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-oauth2-client</artifactId>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>