lift tests to module path

This commit is contained in:
Jörg Prante 2024-03-04 16:03:29 +01:00
parent 8ea5472223
commit 8ddf8ebd3b
83 changed files with 410 additions and 78 deletions

View file

@ -1,3 +1,3 @@
group = org.xbib group = org.xbib
name = net-http name = net-http
version = 4.2.0 version = 4.3.0

View file

@ -17,13 +17,28 @@ jar {
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
doFirst {
options.fork = true options.fork = true
options.forkOptions.jvmArgs += ['-Duser.language=en','-Duser.country=US'] options.forkOptions.jvmArgs += ['-Duser.language=en','-Duser.country=US']
options.compilerArgs.add('-Xlint:all')
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
options.compilerArgs.add('-Xlint:all')
options.compilerArgs.add("--module-path")
options.compilerArgs.add(classpath.asPath)
classpath = files()
}
} }
tasks.withType(Javadoc) { tasks.withType(Javadoc) {
doFirst {
options.addStringOption('Xdoclint:none', '-quiet') options.addStringOption('Xdoclint:none', '-quiet')
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
}
tasks.withType(JavaExec) {
doFirst {
jvmArguments.add("--module-path")
jvmArguments.add(classpath.asPath)
classpath = files()
}
}

View file

@ -19,6 +19,12 @@ test {
'--add-opens=java.base/java.util=ALL-UNNAMED' '--add-opens=java.base/java.util=ALL-UNNAMED'
systemProperty 'java.util.logging.config.file', 'src/test/resources/logging.properties' systemProperty 'java.util.logging.config.file', 'src/test/resources/logging.properties'
systemProperty 'io.netty.tryReflectionSetAccessible', 'false' systemProperty 'io.netty.tryReflectionSetAccessible', 'false'
systemProperty 'io.netty.allocator.typ', 'pooled'
systemProperty 'io.netty.noUnsafe', 'true'
systemProperty 'io.netty.noKeySetOptimization', 'true'
systemProperty 'io.netty.eventLoopThreads', '8'
systemProperty 'io.netty.recycler.maxCapacityPerThread', '0'
systemProperty 'io.netty.transport.noNative', 'true'
testLogging { testLogging {
events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED' events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED'
} }

View file

@ -5,3 +5,14 @@ dependencies {
api libs.netty.handler.proxy api libs.netty.handler.proxy
testImplementation project(':net-http-netty-boringssl') testImplementation project(':net-http-netty-boringssl')
} }
def moduleName = 'org.xbib.net.http.client.netty.secure.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -0,0 +1,15 @@
module org.xbib.net.http.client.netty.secure.test {
requires java.management;
requires jdk.management;
requires java.net.http;
requires transitive org.junit.jupiter.api;
requires io.netty.buffer;
requires io.netty.transport;
requires org.xbib.net;
requires org.xbib.net.http;
requires org.xbib.net.http.client;
requires org.xbib.net.http.client.netty;
requires org.xbib.net.http.client.netty.secure;
exports org.xbib.net.http.client.netty.secure.test;
opens org.xbib.net.http.client.netty.secure.test;
}

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.net.http.client.BackOff; import org.xbib.net.http.client.BackOff;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import com.sun.management.UnixOperatingSystemMXBean; import com.sun.management.UnixOperatingSystemMXBean;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import io.netty.handler.proxy.Socks5ProxyHandler; import io.netty.handler.proxy.Socks5ProxyHandler;
import java.io.IOException; import java.io.IOException;

View file

@ -1,6 +1,5 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import io.netty.handler.codec.http.HttpMethod;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder; import java.net.URLEncoder;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import org.xbib.net.http.client.BackOff; import org.xbib.net.http.client.BackOff;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import java.io.IOException; import java.io.IOException;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;
@ -33,7 +33,6 @@ import java.util.logging.Logger;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.ExtendWith;
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
class SimpleHttp1Test { class SimpleHttp1Test {

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.client.secure; package org.xbib.net.http.client.netty.secure.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;

View file

@ -3,3 +3,14 @@ dependencies {
api libs.netty.codec.http2 api libs.netty.codec.http2
api libs.netty.handler.proxy api libs.netty.handler.proxy
} }
def moduleName = 'org.xbib.net.http.client.netty.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -0,0 +1,15 @@
import org.xbib.net.http.client.netty.ClientTransportProvider;
import org.xbib.net.http.client.netty.HttpChannelInitializer;
module org.xbib.net.http.client.netty.test {
requires java.logging;
requires transitive org.junit.jupiter.api;
requires org.xbib.net;
requires org.xbib.net.http;
requires org.xbib.net.http.client;
requires org.xbib.net.http.client.netty;
uses ClientTransportProvider;
uses HttpChannelInitializer;
exports org.xbib.net.http.client.netty.test;
opens org.xbib.net.http.client.netty.test;
}

View file

@ -1,10 +1,14 @@
package org.xbib.net.http.client.netty; package org.xbib.net.http.client.netty.test;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.net.http.client.netty.HttpRequest;
import org.xbib.net.http.client.netty.NettyHttpClient;
import org.xbib.net.http.client.netty.NettyHttpClientConfig;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
class Http1Test { class Http1Test {

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.client.netty; package org.xbib.net.http.client.netty.test;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -8,6 +8,9 @@ import java.util.logging.Logger;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.net.http.HttpVersion; import org.xbib.net.http.HttpVersion;
import org.xbib.net.http.client.netty.HttpRequest;
import org.xbib.net.http.client.netty.NettyHttpClient;
import org.xbib.net.http.client.netty.NettyHttpClientConfig;
class Http2Test { class Http2Test {

View file

@ -1,7 +1,8 @@
package org.xbib.net.http.client.netty; package org.xbib.net.http.client.netty.test;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.net.URL; import org.xbib.net.URL;
import org.xbib.net.http.client.netty.HttpRequest;
import java.util.Map; import java.util.Map;

View file

@ -1,3 +1,14 @@
dependencies { dependencies {
api project(':net-http-client') api project(':net-http-client')
} }
def moduleName = 'org.xbib.net.http.client.simple.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -1,3 +1,14 @@
dependencies { dependencies {
api project(':net-http') api project(':net-http')
} }
def moduleName = 'org.xbib.net.http.client.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -0,0 +1,8 @@
module org.xbib.net.http.client.test {
requires transitive org.junit.jupiter.api;
requires org.xbib.net;
requires org.xbib.net.http;
requires org.xbib.net.http.client;
exports org.xbib.net.http.client.test;
opens org.xbib.net.http.client.test;
}

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.client; package org.xbib.net.http.client.test;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
@ -17,7 +17,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
class CookieDecoderTest { class ClientCookieDecoderTest {
@Test @Test
void testDecodingSingleCookieV0() { void testDecodingSingleCookieV0() {

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.client; package org.xbib.net.http.client.test;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.net.http.client.cookie.CookieEncoder; import org.xbib.net.http.client.cookie.CookieEncoder;

View file

@ -0,0 +1,4 @@
The htmlflow project is not enabled for Java modules.
Maybe the dependencies are wrong. The asm-parent pom dependency can not be a module.

View file

@ -2,3 +2,14 @@ dependencies {
api project(':net-http-server') api project(':net-http-server')
api libs.j2html api libs.j2html
} }
def moduleName = 'org.xbib.net.http.j2html.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -4,6 +4,6 @@ module org.xbib.net.http.j2html {
requires org.xbib.net.http; requires org.xbib.net.http;
requires org.xbib.net.http.server; requires org.xbib.net.http.server;
requires org.xbib.config; requires org.xbib.config;
requires com.j2html; requires org.xbib.j2html;
requires java.logging; requires java.logging;
} }

View file

@ -13,8 +13,8 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Objects; import java.util.Objects;
import static j2html.TagCreator.body; import static org.xbib.j2html.TagCreator.body;
import static j2html.TagCreator.h1; import static org.xbib.j2html.TagCreator.h1;
import static org.xbib.net.http.HttpHeaderNames.CONTENT_TYPE; import static org.xbib.net.http.HttpHeaderNames.CONTENT_TYPE;
public class J2HtmlResourceHandler extends HtmlTemplateResourceHandler { public class J2HtmlResourceHandler extends HtmlTemplateResourceHandler {
@ -51,7 +51,6 @@ public class J2HtmlResourceHandler extends HtmlTemplateResourceHandler {
if (httpResponseStatus == null) { if (httpResponseStatus == null) {
httpResponseStatus = HttpResponseStatus.OK; httpResponseStatus = HttpResponseStatus.OK;
} }
//context.getAttributes().get(HttpResponseStatus.class, "_status", HttpResponseStatus.OK);
context.status(httpResponseStatus) context.status(httpResponseStatus)
.header("cache-control", "no-cache") // override default must-revalidate behavior .header("cache-control", "no-cache") // override default must-revalidate behavior
.header("content-length", Integer.toString(dataBuffer.writePosition())) .header("content-length", Integer.toString(dataBuffer.writePosition()))
@ -59,6 +58,12 @@ public class J2HtmlResourceHandler extends HtmlTemplateResourceHandler {
.body(dataBuffer); .body(dataBuffer);
} }
/**
* By subclassing this handler, this method should be overriden by custom j2html code.
* The body here is just a greeting as an example.
* @param context the router context
* @return the body string fo the HTTP response
*/
protected String renderBody(HttpRouterContext context) { protected String renderBody(HttpRouterContext context) {
return body( return body(
h1("Hello World") h1("Hello World")

View file

@ -3,3 +3,14 @@ dependencies {
api project(':net-http-client-netty-secure') api project(':net-http-client-netty-secure')
api libs.conscrypt api libs.conscrypt
} }
def moduleName = 'org.xbib.net.http.netty.conscrypt.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -0,0 +1,10 @@
module org.xbib.net.http.netty.conscrypt.test {
requires transitive org.junit.jupiter.api;
requires org.xbib.net;
requires org.xbib.net.http;
requires org.xbib.net.http.client;
requires org.xbib.net.http.client.netty;
requires org.xbib.net.http.client.netty.secure;
exports org.xbib.net.http.netty.conscrypt.test;
opens org.xbib.net.http.netty.conscrypt.test;
}

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.conscrypt; package org.xbib.net.http.netty.conscrypt.test;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.logging.Level; import java.util.logging.Level;
@ -31,6 +31,7 @@ public class Http1Test {
resp.getBodyAsChars(StandardCharsets.UTF_8) + resp.getBodyAsChars(StandardCharsets.UTF_8) +
" status=" + resp.getStatus())) " status=" + resp.getStatus()))
.build(); .build();
// we just log the request and we do not care if the response was there
logger.log(Level.INFO, "request = " + request); logger.log(Level.INFO, "request = " + request);
client.execute(request).get().close(); client.execute(request).get().close();
} }

View file

@ -5,7 +5,6 @@ dependencies {
api project(':net-http-server-application-config') api project(':net-http-server-application-config')
api project(':net-http-template-groovy') api project(':net-http-template-groovy')
api project(':net-http-j2html') api project(':net-http-j2html')
api project(':net-http-htmlflow')
api libs.jdbc.query api libs.jdbc.query
implementation libs.webjars.bootstrap implementation libs.webjars.bootstrap
implementation libs.webjars.jquery implementation libs.webjars.jquery

View file

@ -14,5 +14,6 @@ module org.xbib.net.http.server.application.web {
requires org.xbib.jdbc.query; requires org.xbib.jdbc.query;
requires org.xbib.config; requires org.xbib.config;
requires java.logging; requires java.logging;
requires com.j2html; // for error handler code
requires org.xbib.j2html;
} }

View file

@ -9,11 +9,11 @@ import org.xbib.net.util.ExceptionFormatter;
import java.io.IOException; import java.io.IOException;
import static j2html.TagCreator.body; import static org.xbib.j2html.TagCreator.body;
import static j2html.TagCreator.code; import static org.xbib.j2html.TagCreator.code;
import static j2html.TagCreator.div; import static org.xbib.j2html.TagCreator.div;
import static j2html.TagCreator.h1; import static org.xbib.j2html.TagCreator.h1;
import static j2html.TagCreator.pre; import static org.xbib.j2html.TagCreator.pre;
public class InternalServerErrorHandler extends J2HtmlResourceHandler { public class InternalServerErrorHandler extends J2HtmlResourceHandler {

View file

@ -11,3 +11,14 @@ test {
systemProperty 'application.home', 'src/test/resources' systemProperty 'application.home', 'src/test/resources'
systemProperty 'application.profile', 'test' systemProperty 'application.profile', 'test'
} }
def moduleName = 'org.xbib.net.http.server.netty.secure.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -1,5 +1,8 @@
import org.xbib.net.http.server.netty.HttpChannelInitializer;
import org.xbib.net.http.server.netty.secure.JdkServerSecureSocketProvider; import org.xbib.net.http.server.netty.secure.JdkServerSecureSocketProvider;
import org.xbib.net.http.server.netty.secure.ServerSecureSocketProvider; import org.xbib.net.http.server.netty.secure.ServerSecureSocketProvider;
import org.xbib.net.http.server.netty.secure.http1.Https1ChannelInitializer;
import org.xbib.net.http.server.netty.secure.http2.Https2ChannelInitializer;
import org.xbib.net.security.CertificateProvider; import org.xbib.net.security.CertificateProvider;
module org.xbib.net.http.server.netty.secure { module org.xbib.net.http.server.netty.secure {
@ -18,7 +21,9 @@ module org.xbib.net.http.server.netty.secure {
requires io.netty.handler; requires io.netty.handler;
requires io.netty.transport; requires io.netty.transport;
requires java.logging; requires java.logging;
uses CertificateProvider; uses HttpChannelInitializer;
provides HttpChannelInitializer with Https1ChannelInitializer, Https2ChannelInitializer;
uses ServerSecureSocketProvider; uses ServerSecureSocketProvider;
provides ServerSecureSocketProvider with JdkServerSecureSocketProvider; provides ServerSecureSocketProvider with JdkServerSecureSocketProvider;
uses CertificateProvider;
} }

View file

@ -0,0 +1,25 @@
import org.xbib.net.http.server.netty.HttpChannelInitializer;
import org.xbib.net.security.CertificateProvider;
import org.xbib.net.http.server.netty.ServerTransportProvider;
module org.xbib.net.http.server.netty.secure.test {
requires transitive org.junit.jupiter.api;
requires io.netty.transport;
requires io.netty.common;
requires org.xbib.net;
requires org.xbib.net.http;
requires org.xbib.net.http.server;
requires org.xbib.net.http.server.netty;
requires org.xbib.net.http.server.netty.secure;
requires org.xbib.net.http.client;
requires org.xbib.net.http.client.netty;
requires org.xbib.net.http.client.netty.secure;
requires org.xbib.net.security;
requires org.xbib.net.http.netty.boringssl;
requires org.xbib.net.bouncycastle;
exports org.xbib.net.http.server.netty.secure.test;
opens org.xbib.net.http.server.netty.secure.test;
uses HttpChannelInitializer;
uses ServerTransportProvider;
uses CertificateProvider;
}

View file

@ -11,3 +11,14 @@ test {
systemProperty 'application.home', 'src/test/resources' systemProperty 'application.home', 'src/test/resources'
systemProperty 'application.profile', 'test' systemProperty 'application.profile', 'test'
} }
def moduleName = 'org.xbib.net.http.server.netty.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -0,0 +1,19 @@
module org.xbib.net.http.server.netty.test {
requires transitive org.junit.jupiter.api;
requires io.netty.transport;
requires io.netty.common;
requires org.xbib.datastructures.api;
requires org.xbib.datastructures.json.tiny;
requires org.xbib.net;
requires org.xbib.net.http;
requires org.xbib.net.http.server;
requires org.xbib.net.http.server.netty;
requires org.xbib.net.http.client;
requires org.xbib.net.http.client.netty;
exports org.xbib.net.http.server.netty.test;
exports org.xbib.net.http.server.netty.test.pipelining;
exports org.xbib.net.http.server.netty.test.simple;
opens org.xbib.net.http.server.netty.test;
opens org.xbib.net.http.server.netty.test.pipelining;
opens org.xbib.net.http.server.netty.test.simple;
}

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test; package org.xbib.net.http.server.netty.test;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.datastructures.api.Builder; import org.xbib.datastructures.api.Builder;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test; package org.xbib.net.http.server.netty.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.util.ResourceLeakDetector; import io.netty.util.ResourceLeakDetector;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test; package org.xbib.net.http.server.netty.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test; package org.xbib.net.http.server.netty.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test; package org.xbib.net.http.server.netty.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test; package org.xbib.net.http.server.netty.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import java.io.BufferedReader; import java.io.BufferedReader;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test; package org.xbib.net.http.server.netty.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import java.io.InputStream; import java.io.InputStream;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test; package org.xbib.net.http.server.netty.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.util.ResourceLeakDetector; import io.netty.util.ResourceLeakDetector;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test; package org.xbib.net.http.server.netty.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test; package org.xbib.net.http.server.netty.test;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test.pipelining; package org.xbib.net.http.server.netty.test.pipelining;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil; import io.netty.buffer.ByteBufUtil;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test.simple; package org.xbib.net.http.server.netty.test.simple;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test.simple; package org.xbib.net.http.server.netty.test.simple;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.netty.test.simple; package org.xbib.net.http.server.netty.test.simple;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;

View file

@ -7,3 +7,14 @@ test {
systemProperty 'application.home', 'src/test/resources' systemProperty 'application.home', 'src/test/resources'
systemProperty 'application.profile', 'test' systemProperty 'application.profile', 'test'
} }
def moduleName = 'org.xbib.net.http.server.nio.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -0,0 +1,9 @@
module org.xbib.net.http.server.nio.test {
requires transitive org.junit.jupiter.api;
requires org.xbib.net;
requires org.xbib.net.http;
requires org.xbib.net.http.server;
requires org.xbib.net.http.server.nio;
exports org.xbib.net.http.server.nio.test;
opens org.xbib.net.http.server.nio.test;
}

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.nio.test; package org.xbib.net.http.server.nio.test;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.net.http.server.nio.demo.ByteArray; import org.xbib.net.http.server.nio.demo.ByteArray;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.nio.test; package org.xbib.net.http.server.nio.test;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.net.http.server.nio.demo.HttpHeader; import org.xbib.net.http.server.nio.demo.HttpHeader;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.nio.test; package org.xbib.net.http.server.nio.test;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View file

@ -9,3 +9,14 @@ test {
systemProperty 'application.home', 'src/test/resources' systemProperty 'application.home', 'src/test/resources'
systemProperty 'application.profile', 'test' systemProperty 'application.profile', 'test'
} }
def moduleName = 'org.xbib.net.http.server.simple.secure.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -1,4 +1,5 @@
module org.xbib.net.http.server.simple.secure { module org.xbib.net.http.server.simple.secure {
exports org.xbib.net.http.server.simple.secure;
uses org.xbib.net.security.CertificateProvider; uses org.xbib.net.security.CertificateProvider;
requires org.xbib.net; requires org.xbib.net;
requires org.xbib.net.http; requires org.xbib.net.http;

View file

@ -0,0 +1,12 @@
module org.xbib.net.http.server.simple.secure.test {
requires transitive org.junit.jupiter.api;
requires org.xbib.net;
requires org.xbib.net.http;
requires org.xbib.net.http.server;
requires org.xbib.net.http.server.simple;
requires org.xbib.net.http.server.simple.secure;
requires org.xbib.net.security;
uses org.xbib.net.security.CertificateProvider;
exports org.xbib.net.http.server.simple.secure.test;
opens org.xbib.net.http.server.simple.secure.test;
}

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.server.simple.secure; package org.xbib.net.http.server.simple.secure.test;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -16,6 +16,9 @@ import org.xbib.net.http.server.route.HttpRouter;
import org.xbib.net.http.server.service.BaseHttpService; import org.xbib.net.http.server.service.BaseHttpService;
import org.xbib.net.http.server.HttpServerConfig; import org.xbib.net.http.server.HttpServerConfig;
import org.xbib.net.http.server.simple.SimpleHttpServer; import org.xbib.net.http.server.simple.SimpleHttpServer;
import org.xbib.net.http.server.simple.secure.HttpsAddress;
import org.xbib.net.http.server.simple.secure.HttpsRequest;
import org.xbib.net.http.server.simple.secure.SimpleHttpsServer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

View file

@ -7,3 +7,14 @@ test {
systemProperty 'application.home', 'src/test/resources' systemProperty 'application.home', 'src/test/resources'
systemProperty 'application.profile', 'test' systemProperty 'application.profile', 'test'
} }
def moduleName = 'org.xbib.net.http.server.simple.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -0,0 +1,9 @@
module org.xbib.net.http.server.simple.test {
requires transitive org.junit.jupiter.api;
requires org.xbib.net;
requires org.xbib.net.http;
requires org.xbib.net.http.server;
requires org.xbib.net.http.server.simple;
exports org.xbib.net.http.server.simple.test;
opens org.xbib.net.http.server.simple.test;
}

View file

@ -4,3 +4,14 @@ dependencies {
implementation libs.datastructures.tiny implementation libs.datastructures.tiny
implementation libs.datastructures.json.tiny implementation libs.datastructures.json.tiny
} }
def moduleName = 'org.xbib.net.http.server.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -0,0 +1,12 @@
module org.xbib.net.http.server.test {
requires transitive org.junit.jupiter.api;
requires org.xbib.net;
requires org.xbib.net.http;
requires org.xbib.net.http.server;
exports org.xbib.net.http.server.test.base;
exports org.xbib.net.http.server.test.ldap;
exports org.xbib.net.http.server.test.session;
opens org.xbib.net.http.server.test.base;
opens org.xbib.net.http.server.test.ldap;
opens org.xbib.net.http.server.test.session;
}

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.server.route.base; package org.xbib.net.http.server.test.base;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.net.http.HttpAddress; import org.xbib.net.http.HttpAddress;

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.server.ldap; package org.xbib.net.http.server.test.ldap;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -10,6 +10,11 @@ import org.xbib.net.Authenticator;
import org.xbib.net.GroupsProvider; import org.xbib.net.GroupsProvider;
import org.xbib.net.UsersProvider; import org.xbib.net.UsersProvider;
import org.xbib.net.UserDetails; import org.xbib.net.UserDetails;
import org.xbib.net.http.server.ldap.LdapContextFactory;
import org.xbib.net.http.server.ldap.LdapGroupMapping;
import org.xbib.net.http.server.ldap.LdapRealm;
import org.xbib.net.http.server.ldap.LdapUserMapping;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;

View file

@ -1,10 +1,14 @@
package org.xbib.net.http.server.ldap; package org.xbib.net.http.server.test.ldap;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.net.http.server.ldap.LdapAuthenticator;
import org.xbib.net.http.server.ldap.LdapContextFactory;
import org.xbib.net.http.server.ldap.LdapUserMapping;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
public class LdapTest { public class LdapTest {

View file

@ -1,4 +1,4 @@
package org.xbib.net.http.server.session; package org.xbib.net.http.server.test.session;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Paths; import java.nio.file.Paths;
@ -8,6 +8,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.net.http.server.persist.Codec; import org.xbib.net.http.server.persist.Codec;
import org.xbib.net.http.server.session.Session;
import org.xbib.net.http.server.session.file.FileJsonSessionCodec; import org.xbib.net.http.server.session.file.FileJsonSessionCodec;
import org.xbib.net.util.RandomUtil; import org.xbib.net.util.RandomUtil;

View file

@ -2,3 +2,14 @@ dependencies {
api project(':net-http-server') api project(':net-http-server')
api libs.groovy.templates api libs.groovy.templates
} }
def moduleName = 'org.xbib.net.http.template.groovy.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -2,3 +2,14 @@ dependencies {
api libs.net api libs.net
api libs.net.mime api libs.net.mime
} }
def moduleName = 'org.xbib.net.http.test'
def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ]
tasks.named('compileTestJava') {
options.compilerArgs += patchArgs
}
tasks.named('test') {
jvmArgs += patchArgs
}

View file

@ -1,11 +0,0 @@
package org.xbib.net.http.test;
import org.junit.jupiter.api.Test;
public class MimeParserTest {
@Test
public void simpleMimeTest() throws Exception {
}
}

View file

@ -6,7 +6,7 @@ dependencyResolutionManagement {
version('netty', '4.1.107.Final') version('netty', '4.1.107.Final')
version('netty-tcnative', '2.0.62.Final') version('netty-tcnative', '2.0.62.Final')
version('datastructures', '5.0.6') version('datastructures', '5.0.6')
version('net', '4.2.0') version('net', '4.3.0')
library('netty-codec-http2', 'io.netty', 'netty-codec-http2').versionRef('netty') library('netty-codec-http2', 'io.netty', 'netty-codec-http2').versionRef('netty')
library('netty-handler', 'io.netty', 'netty-handler').versionRef('netty') library('netty-handler', 'io.netty', 'netty-handler').versionRef('netty')
library('netty-handler-proxy', 'io.netty', 'netty-handler-proxy').versionRef('netty') library('netty-handler-proxy', 'io.netty', 'netty-handler-proxy').versionRef('netty')
@ -17,7 +17,7 @@ dependencyResolutionManagement {
library('jackson', 'com.fasterxml.jackson.core', 'jackson-databind').version('2.16.0') library('jackson', 'com.fasterxml.jackson.core', 'jackson-databind').version('2.16.0')
library('jna', 'net.java.dev.jna', 'jna').version('5.14.0') library('jna', 'net.java.dev.jna', 'jna').version('5.14.0')
library('groovy-templates', 'org.apache.groovy', 'groovy-templates').versionRef('groovy') library('groovy-templates', 'org.apache.groovy', 'groovy-templates').versionRef('groovy')
library('j2html', 'com.j2html', 'j2html').version('1.6.0') library('j2html', 'org.xbib', 'j2html').version('1.6.0')
library('htmlflow', 'com.github.xmlet', 'htmlflow').version('4.0') library('htmlflow', 'com.github.xmlet', 'htmlflow').version('4.0')
library('webjars-bootstrap', 'org.webjars', 'bootstrap').version('5.2.3') library('webjars-bootstrap', 'org.webjars', 'bootstrap').version('5.2.3')
library('webjars-jquery', 'org.webjars', 'jquery').version('3.6.4') library('webjars-jquery', 'org.webjars', 'jquery').version('3.6.4')
@ -64,7 +64,6 @@ include 'net-http-server-nio'
include 'net-http-server-simple' include 'net-http-server-simple'
include 'net-http-server-simple-secure' include 'net-http-server-simple-secure'
include 'net-http-template-groovy' include 'net-http-template-groovy'
include 'net-http-htmlflow'
include 'net-http-j2html' include 'net-http-j2html'
include 'net-http-server-application-web' include 'net-http-server-application-web'
include 'net-http-server-application-config' include 'net-http-server-application-config'