diff --git a/pom.xml b/pom.xml index f1ef89c..77421a3 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,6 @@ docker repo - rest - 10.0.0 - 5.6.0 - - 21 - UTF-8 - 24.6.0 - webprofile - - 3.12.1 - 3.3.0 - 3.4.0 - - - - - jakarta.platform - jakarta.jakartaee-web-api - ${jakarta.version} - provided - - - - org.junit.jupiter - junit-jupiter-api - ${junit.version} - test - - - org.junit.jupiter - junit-jupiter-engine - ${junit.version} - test - - - org.junit.jupiter - junit-jupiter-params - ${junit.version} - test - - - - api - - - cloud.piranha.maven.plugins - piranha-maven-plugin - ${piranha.version} - - - pre-integration-test - pre-integration-test - - start - - - - post-integration-test - post-integration-test - - stop - - - - - webprofile - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - - - - org.apache.maven.plugins - maven-failsafe-plugin - ${maven-failsafe-plugin.version} - - - - integration-test - verify - - - - - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - false - - - - - diff --git a/rest/src/main/java/com/manorrock/aegean/rest/ApplicationBean.java b/rest/src/main/java/com/manorrock/aegean/rest/ApplicationBean.java deleted file mode 100644 index 4b60690..0000000 --- a/rest/src/main/java/com/manorrock/aegean/rest/ApplicationBean.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2002-2024, Manorrock.com. All Rights Reserved. - * - * 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.manorrock.aegean.rest; - -import jakarta.annotation.PostConstruct; -import jakarta.enterprise.context.ApplicationScoped; -import java.io.File; -import static java.util.logging.Level.INFO; -import java.util.logging.Logger; - -/** - * The one and only application bean. - * - * @author Manfred Riem (mriem@manorrock.com) - */ -@ApplicationScoped -public class ApplicationBean { - - /** - * Stores the logger. - */ - private static final Logger LOGGER = Logger.getLogger(ApplicationBean.class.getName()); - - /** - * Stores the repositories directory. - */ - private File repositoriesDirectory; - - /** - * Initialize. - */ - @PostConstruct - public void initialize() { - String rootDirectoryFilename = System.getenv("ROOT_DIRECTORY"); - if (rootDirectoryFilename == null) { - rootDirectoryFilename = System.getProperty("ROOT_DIRECTORY", - System.getProperty("user.home") + "/.manorrock/aegean"); - } - - if (LOGGER.isLoggable(INFO)) { - LOGGER.log(INFO, "Base directory: {0}", rootDirectoryFilename); - } - - repositoriesDirectory = new File(rootDirectoryFilename, "repositories"); - - if (!repositoriesDirectory.exists()) { - repositoriesDirectory.mkdirs(); - } - } - - /** - * Get the repositories directory. - * - * @return the repositories directory. - */ - public File getRepositoriesDirectory() { - return repositoriesDirectory; - } - - /** - * Set the repositories directory. - * - * @param repositoriesDirectory the repositories directory. - */ - public void setRepositoriesDirectory(File repositoriesDirectory) { - this.repositoriesDirectory = repositoriesDirectory; - } -} diff --git a/rest/src/main/java/com/manorrock/aegean/rest/PingResource.java b/rest/src/main/java/com/manorrock/aegean/rest/PingResource.java deleted file mode 100644 index c421cf6..0000000 --- a/rest/src/main/java/com/manorrock/aegean/rest/PingResource.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2002-2024, Manorrock.com. All Rights Reserved. - * - * 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.manorrock.aegean.rest; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.core.Response; - -/** - * The Ping resource. - * - * @author Manfred Riem (mriem@manorrock.com) - */ -@Path("ping") -public class PingResource { - - /** - * Ping. - * - * @return "OK". - */ - @GET - public Response ping(){ - return Response.ok("OK").build(); - } -} diff --git a/rest/src/main/java/com/manorrock/aegean/rest/Repository.java b/rest/src/main/java/com/manorrock/aegean/rest/Repository.java deleted file mode 100644 index c81fdda..0000000 --- a/rest/src/main/java/com/manorrock/aegean/rest/Repository.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002-2024, Manorrock.com. All Rights Reserved. - * - * 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.manorrock.aegean.rest; - -/** - * The repository. - * - * @author Manfred Riem (mriem@manorrock.com) - */ -public class Repository { - - /** - * Stores the name. - */ - private String name; - - /** - * Get the name. - * - * @return the name. - */ - public String getName() { - return name; - } - - /** - * Set the name. - * - * @param name the name. - */ - public void setName(String name) { - this.name = name; - } -} diff --git a/rest/src/main/java/com/manorrock/aegean/rest/RepositoryResource.java b/rest/src/main/java/com/manorrock/aegean/rest/RepositoryResource.java deleted file mode 100644 index fac3852..0000000 --- a/rest/src/main/java/com/manorrock/aegean/rest/RepositoryResource.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2002-2024, Manorrock.com. All Rights Reserved. - * - * 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.manorrock.aegean.rest; - -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Response; - -/** - * The Repository resource. - * - * @author Manfred Riem (mriem@manorrock.com) - */ -@Path("repository") -public class RepositoryResource { - - /** - * Create the given repository. - * - * @param repository the repository to create. - * @return the created repository. - */ - @PUT - @Consumes("application/json") - @Produces("application/json") - @Path("") - public Repository create(Repository repository) { - return repository; - } - - /** - * Delete the given repository. - * - * @param name the name of the repository. - */ - @DELETE - @Path("{name}") - public void delete(@PathParam("name") String name) { - } - - /** - * Get details for the given repository. - * - * @param name the name of the repository. - * @return the repository. - */ - @Produces("application/json") - @GET - @Path("{name}") - public Repository view(@PathParam("name") String name) { - Repository result = new Repository(); - result.setName(name); - return result; - } - - /** - * List the available repositories. - * - * @return the list of repositories. - */ - @Produces("application/json") - @GET - public Response list(){ - return Response.ok("{}").build(); - } -} diff --git a/rest/src/main/java/com/manorrock/aegean/rest/RestApplication.java b/rest/src/main/java/com/manorrock/aegean/rest/RestApplication.java deleted file mode 100644 index e4122cb..0000000 --- a/rest/src/main/java/com/manorrock/aegean/rest/RestApplication.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002-2024, Manorrock.com. All Rights Reserved. - * - * 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.manorrock.aegean.rest; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; - -/** - * The Aegean REST application. - * - * @author Manfred Riem (mriem@manorrock.com) - */ -@ApplicationPath("") -public class RestApplication extends Application { -} diff --git a/rest/src/main/resources/META-INF/persistence.xml b/rest/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 7582bf1..0000000 --- a/rest/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/rest/src/main/webapp/WEB-INF/beans.xml b/rest/src/main/webapp/WEB-INF/beans.xml deleted file mode 100644 index 8547f7b..0000000 --- a/rest/src/main/webapp/WEB-INF/beans.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/rest/src/main/webapp/WEB-INF/web.xml b/rest/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 2fb15c6..0000000 --- a/rest/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - 30 - - diff --git a/rest/src/test/java/it/PingIT.java b/rest/src/test/java/it/PingIT.java deleted file mode 100644 index 313e0b5..0000000 --- a/rest/src/test/java/it/PingIT.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2024, Manorrock.com. All Rights Reserved. - * - * 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. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * 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 it; - -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.net.http.HttpResponse.BodyHandlers; -import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.Test; - -/** - * The integration tests for Forum. - * - * @author Manfred Riem (mriem@manorrock.com) - */ -class PingIT { - - @Test - void testPing() throws Exception { - HttpClient client = HttpClient.newHttpClient(); - HttpRequest request = HttpRequest - .newBuilder(new URI("http://localhost:8080/api/ping")) - .build(); - HttpResponse response = client.send(request, BodyHandlers.ofString()); - assertTrue(response.body().contains("OK")); - } -} \ No newline at end of file diff --git a/rest/src/test/java/it/RepositoryResourceIT.java b/rest/src/test/java/it/RepositoryResourceIT.java deleted file mode 100644 index 4986ad9..0000000 --- a/rest/src/test/java/it/RepositoryResourceIT.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2002-2024, Manorrock.com. All Rights Reserved. - * - * 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. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * 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 it; - -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.net.http.HttpResponse.BodyHandlers; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.Test; - -/** - * The integration tests for RepositoryResource. - * - * @author Manfred Riem (mriem@manorrock.com) - */ -class RepositoryResourceIT { - - @Test - void testDelete() throws Exception { - HttpClient client = HttpClient.newHttpClient(); - HttpRequest request = HttpRequest - .newBuilder(new URI("http://localhost:8080/api/repository/test")) - .DELETE() - .build(); - HttpResponse response = client.send(request, BodyHandlers.ofString()); - assertEquals(204, response.statusCode()); - } - - @Test - void testList() throws Exception { - HttpClient client = HttpClient.newHttpClient(); - HttpRequest request = HttpRequest - .newBuilder(new URI("http://localhost:8080/api/repository")) - .build(); - HttpResponse response = client.send(request, BodyHandlers.ofString()); - System.out.println(response.body()); - assertTrue(response.body().trim().length() > 0); - } - - @Test - void testGetRepository() throws Exception { - HttpClient client = HttpClient.newHttpClient(); - HttpRequest request = HttpRequest - .newBuilder(new URI("http://localhost:8080/api/repository/myrepo")) - .build(); - HttpResponse response = client.send(request, BodyHandlers.ofString()); - System.out.println(response.body()); - assertTrue(response.body().trim().length() > 0); - } -}