2014-05-20 12:46:19 +02:00
|
|
|
#!/bin/bash -e
|
2014-05-21 06:35:28 +02:00
|
|
|
EXAMPLE_MAP=(
|
2020-07-22 14:01:48 +02:00
|
|
|
'io_uring:io.netty.example.uring.EchoIOUringServer'
|
2014-05-23 09:46:31 +02:00
|
|
|
'discard-client:io.netty.example.discard.DiscardClient'
|
|
|
|
'discard-server:io.netty.example.discard.DiscardServer'
|
|
|
|
'echo-client:io.netty.example.echo.EchoClient'
|
|
|
|
'echo-server:io.netty.example.echo.EchoServer'
|
|
|
|
'factorial-client:io.netty.example.factorial.FactorialClient'
|
|
|
|
'factorial-server:io.netty.example.factorial.FactorialServer'
|
|
|
|
'file-server:io.netty.example.file.FileServer'
|
|
|
|
'http-cors-server:io.netty.example.http.cors.HttpCorsServer'
|
|
|
|
'http-file-server:io.netty.example.http.file.HttpStaticFileServer'
|
|
|
|
'http-helloworld-server:io.netty.example.http.helloworld.HttpHelloWorldServer'
|
|
|
|
'http-snoop-client:io.netty.example.http.snoop.HttpSnoopClient'
|
|
|
|
'http-snoop-server:io.netty.example.http.snoop.HttpSnoopServer'
|
|
|
|
'http-upload-client:io.netty.example.http.upload.HttpUploadClient'
|
|
|
|
'http-upload-server:io.netty.example.http.upload.HttpUploadServer'
|
|
|
|
'websocket-client:io.netty.example.http.websocketx.client.WebSocketClient'
|
|
|
|
'websocket-server:io.netty.example.http.websocketx.server.WebSocketServer'
|
2015-04-11 02:57:20 +02:00
|
|
|
'http2-client:io.netty.example.http2.helloworld.client.Http2Client'
|
|
|
|
'http2-server:io.netty.example.http2.helloworld.server.Http2Server'
|
|
|
|
'http2-tiles:io.netty.example.http2.tiles.Launcher'
|
2015-04-13 07:19:20 +02:00
|
|
|
'http2-multiplex-server:io.netty.example.http2.helloworld.multiplex.server.Http2Server'
|
2014-05-21 06:35:28 +02:00
|
|
|
'spdy-client:io.netty.example.spdy.client.SpdyClient'
|
2014-05-22 10:54:31 +02:00
|
|
|
'spdy-server:io.netty.example.spdy.server.SpdyServer'
|
2014-05-23 09:46:31 +02:00
|
|
|
'worldclock-client:io.netty.example.worldclock.WorldClockClient'
|
|
|
|
'worldclock-server:io.netty.example.worldclock.WorldClockServer'
|
|
|
|
'objectecho-client:io.netty.example.objectecho.ObjectEchoClient'
|
|
|
|
'objectecho-server:io.netty.example.objectecho.ObjectEchoServer'
|
|
|
|
'quote-client:org.jboss.netty.example.qotm.QuoteOfTheMomentClient'
|
|
|
|
'quote-server:org.jboss.netty.example.qotm.QuoteOfTheMomentServer'
|
2016-04-14 17:23:04 +02:00
|
|
|
'redis-client:io.netty.example.redis.RedisClient'
|
2014-05-23 09:46:31 +02:00
|
|
|
'securechat-client:io.netty.example.securechat.SecureChatClient'
|
|
|
|
'securechat-server:io.netty.example.securechat.SecureChatServer'
|
|
|
|
'telnet-client:io.netty.example.telnet.TelnetClient'
|
|
|
|
'telnet-server:io.netty.example.telnet.TelnetServer'
|
|
|
|
'proxy-server:io.netty.example.proxy.HexDumpProxy'
|
|
|
|
'socksproxy-server:io.netty.example.socksproxy.SocksServer'
|
|
|
|
'memcache-binary-client:io.netty.example.memcache.binary.MemcacheClient'
|
2014-06-04 09:39:50 +02:00
|
|
|
'stomp-client:io.netty.example.stomp.StompClient'
|
2014-05-23 09:46:31 +02:00
|
|
|
'uptime-client:io.netty.example.uptime.UptimeClient'
|
2017-04-07 07:33:49 +02:00
|
|
|
'uptime-server:io.netty.example.uptime.UptimeServer'
|
2014-05-23 09:46:31 +02:00
|
|
|
'sctpecho-client:io.netty.example.sctp.SctpEchoClient'
|
|
|
|
'sctpecho-server:io.netty.example.sctp.SctpEchoServer'
|
|
|
|
'localecho:io.netty.example.localecho.LocalEcho'
|
2020-05-14 12:10:32 +02:00
|
|
|
'udp-dns-client:io.netty.example.dns.udp.DnsClient'
|
|
|
|
'tcp-dns-client:io.netty.example.dns.tcp.TcpDnsClient'
|
|
|
|
'dot-dns-client:io.netty.example.dns.dot.DoTClient'
|
2014-05-20 16:24:34 +02:00
|
|
|
)
|
|
|
|
|
2015-03-20 01:11:24 +01:00
|
|
|
NEEDS_NPN_MAP=(
|
|
|
|
'spdy-client'
|
|
|
|
'spdy-server'
|
|
|
|
)
|
|
|
|
|
2014-05-20 16:24:34 +02:00
|
|
|
EXAMPLE=''
|
|
|
|
EXAMPLE_CLASS=''
|
2014-05-21 06:35:28 +02:00
|
|
|
EXAMPLE_ARGS='-D_'
|
2015-03-20 01:11:24 +01:00
|
|
|
FORCE_NPN=''
|
2014-05-20 16:24:34 +02:00
|
|
|
I=0
|
|
|
|
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
ARG="$1"
|
|
|
|
shift
|
|
|
|
if [[ "$ARG" =~ (^-.+) ]]; then
|
2014-05-21 06:35:28 +02:00
|
|
|
EXAMPLE_ARGS="$EXAMPLE_ARGS $ARG"
|
2014-05-20 16:24:34 +02:00
|
|
|
else
|
|
|
|
EXAMPLE="$ARG"
|
2014-05-21 06:35:28 +02:00
|
|
|
for E in "${EXAMPLE_MAP[@]}"; do
|
|
|
|
KEY="${E%%:*}"
|
|
|
|
VAL="${E##*:}"
|
|
|
|
if [[ "$EXAMPLE" == "$KEY" ]]; then
|
|
|
|
EXAMPLE_CLASS="$VAL"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2014-05-20 16:24:34 +02:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ -z "$EXAMPLE" ]] || [[ -z "$EXAMPLE_CLASS" ]] || [[ $# -ne 0 ]]; then
|
|
|
|
echo " Usage: $0 [-D<name>[=<value>] ...] <example-name>" >&2
|
|
|
|
echo "Example: $0 -Dport=8443 -Dssl http-server" >&2
|
2014-05-20 16:38:53 +02:00
|
|
|
echo " $0 -Dhost=127.0.0.1 -Dport=8009 echo-client" >&2
|
2014-11-09 15:41:15 +01:00
|
|
|
echo " $0 -DlogLevel=debug -Dhost=127.0.0.1 -Dport=8009 echo-client" >&2
|
2014-05-20 12:46:19 +02:00
|
|
|
echo >&2
|
|
|
|
echo "Available examples:" >&2
|
2014-05-20 16:38:53 +02:00
|
|
|
echo >&2
|
2014-05-22 10:54:31 +02:00
|
|
|
I=0
|
2014-05-21 06:35:28 +02:00
|
|
|
for E in "${EXAMPLE_MAP[@]}"; do
|
2014-05-22 10:54:31 +02:00
|
|
|
if [[ $I -eq 0 ]]; then
|
|
|
|
echo -n ' '
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf '%-24s' "${E%%:*}"
|
|
|
|
((I++)) || true
|
|
|
|
|
|
|
|
if [[ $I -eq 2 ]]; then
|
|
|
|
I=0
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
done >&2
|
|
|
|
if [[ $I -ne 0 ]]; then
|
|
|
|
echo >&2
|
|
|
|
fi
|
2014-05-20 16:38:53 +02:00
|
|
|
echo >&2
|
2014-05-20 12:46:19 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-03-20 01:11:24 +01:00
|
|
|
for E in "${NEEDS_NPN_MAP[@]}"; do
|
|
|
|
if [[ "$EXAMPLE" = "$E" ]]; then
|
|
|
|
FORCE_NPN='true'
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2014-05-22 10:57:12 +02:00
|
|
|
cd "`dirname "$0"`"/example
|
2014-05-20 16:24:34 +02:00
|
|
|
echo "[INFO] Running: $EXAMPLE ($EXAMPLE_CLASS $EXAMPLE_ARGS)"
|
2017-04-24 09:52:06 +02:00
|
|
|
exec mvn -q -nsu compile exec:exec -Dcheckstyle.skip=true -Dforbiddenapis.skip=true -Dforcenpn="$FORCE_NPN" -DargLine.example="$EXAMPLE_ARGS" -DexampleClass="$EXAMPLE_CLASS"
|