You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2024/04/09 09:02:09 UTC
(sling-org-apache-sling-contentparser-testutils) 02/02: SLING-12281 apply spotless code formatting
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-testutils.git
commit 044f9aac4e8f29490137a88a94dff2b6bae8182c
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Tue Apr 9 10:32:57 2024 +0200
SLING-12281 apply spotless code formatting
---
pom.xml | 8 ++--
.../sling/contentparser/testutils/TestUtils.java | 46 ++++++++++-----------
.../testutils/mapsupport/ContentElement.java | 37 +++++++++--------
.../mapsupport/ContentElementHandler.java | 47 ++++++++++------------
.../mapsupport/ContentElementHandlerException.java | 39 +++++++++---------
5 files changed, 85 insertions(+), 92 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2673948..7b91c37 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -30,15 +30,13 @@
<version>2.0.1-SNAPSHOT</version>
<name>Apache Sling Content Parser Test Utilities</name>
- <description>
- Apache Sling Content Parser Test Utilities for the Content Parser API implementations
- </description>
+ <description>Apache Sling Content Parser Test Utilities for the Content Parser API implementations</description>
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-testutils.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-testutils.git</developerConnection>
- <url>https://github.com/apache/sling-org-apache-sling-contentparser-testutils.git</url>
<tag>HEAD</tag>
+ <url>https://github.com/apache/sling-org-apache-sling-contentparser-testutils.git</url>
</scm>
<dependencies>
diff --git a/src/main/java/org/apache/sling/contentparser/testutils/TestUtils.java b/src/main/java/org/apache/sling/contentparser/testutils/TestUtils.java
index 339f8c5..da53e1b 100644
--- a/src/main/java/org/apache/sling/contentparser/testutils/TestUtils.java
+++ b/src/main/java/org/apache/sling/contentparser/testutils/TestUtils.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.contentparser.testutils;
import java.io.BufferedInputStream;
@@ -31,7 +31,7 @@ import org.apache.sling.contentparser.testutils.mapsupport.ContentElement;
import org.apache.sling.contentparser.testutils.mapsupport.ContentElementHandler;
public final class TestUtils {
-
+
private TestUtils() {
// static methods only
}
@@ -40,15 +40,16 @@ public final class TestUtils {
return parse(contentParser, new ParserOptions(), file);
}
- public static ContentElement parse(ContentParser contentParser, ParserOptions parserOptions, File file) throws IOException {
+ public static ContentElement parse(ContentParser contentParser, ParserOptions parserOptions, File file)
+ throws IOException {
try (FileInputStream fis = new FileInputStream(file);
- BufferedInputStream bis = new BufferedInputStream(fis)) {
+ BufferedInputStream bis = new BufferedInputStream(fis)) {
ContentElementHandler handler = new ContentElementHandler();
contentParser.parse(handler, bis, parserOptions);
return handler.getRoot();
}
}
-
+
public static ContentElement parse(ContentParser contentParser, String jsonContent) throws IOException {
try (ByteArrayInputStream is = new ByteArrayInputStream(jsonContent.getBytes(StandardCharsets.UTF_8))) {
ContentElementHandler handler = new ContentElementHandler();
@@ -56,5 +57,4 @@ public final class TestUtils {
return handler.getRoot();
}
}
-
}
diff --git a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElement.java b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElement.java
index 0a47845..3b80f50 100644
--- a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElement.java
+++ b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElement.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.contentparser.testutils.mapsupport;
import java.util.LinkedHashMap;
@@ -84,5 +84,4 @@ public final class ContentElement {
return child.getChild(remainingPath);
}
}
-
}
diff --git a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandler.java b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandler.java
index b2de181..942d037 100644
--- a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandler.java
+++ b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandler.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.contentparser.testutils.mapsupport;
import java.util.Map;
@@ -29,7 +29,7 @@ import org.apache.sling.contentparser.api.ContentHandler;
* {@link ContentHandler} implementation that produces a tree of {@link ContentElement} items.
*/
public final class ContentElementHandler implements ContentHandler {
-
+
private ContentElement root;
private static final Pattern PATH_PATTERN = Pattern.compile("^((/[^/]+)*)(/([^/]+))$");
@@ -37,8 +37,7 @@ public final class ContentElementHandler implements ContentHandler {
public void resource(String path, Map<String, Object> properties) {
if (StringUtils.equals(path, "/")) {
root = new ContentElement(null, properties);
- }
- else {
+ } else {
if (root == null) {
throw new ContentElementHandlerException("Root resource not set.");
}
@@ -51,8 +50,7 @@ public final class ContentElementHandler implements ContentHandler {
ContentElement parent;
if (StringUtils.isEmpty(relativeParentPath)) {
parent = root;
- }
- else {
+ } else {
parent = root.getChild(relativeParentPath);
}
if (parent == null) {
@@ -61,9 +59,8 @@ public final class ContentElementHandler implements ContentHandler {
parent.getChildren().put(name, new ContentElement(name, properties));
}
}
-
+
public ContentElement getRoot() {
return root;
}
-
}
diff --git a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandlerException.java b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandlerException.java
index 7f1dd71..ba45b34 100644
--- a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandlerException.java
+++ b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandlerException.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.contentparser.testutils.mapsupport;
/**
@@ -23,8 +23,7 @@ package org.apache.sling.contentparser.testutils.mapsupport;
*/
public class ContentElementHandlerException extends RuntimeException {
- public ContentElementHandlerException() {
- }
+ public ContentElementHandlerException() {}
/**
* {@inheritDoc}