From 13fe7a8653f7f2155574f8d8a0d484aa16dbd805 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Thu, 19 Apr 2018 19:45:16 -0700 Subject: [PATCH 01/29] Prepare release 3.0.0-alpha-93 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..65fc35659 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index 3a1f0e90a..2063ee2f3 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..775dbfcbe 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..2e5aeed07 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..1522f3949 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..8e5c2505c 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..53dfdce58 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..c758256cf 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 k3po.launcher diff --git a/pom.xml b/pom.xml index 184068cc5..10c37f7e7 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..c9c7d3a46 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..9e17b3180 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..fc1add310 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..38953f488 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..87cea7374 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..17ee2e0db 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..494596516 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..8a9cd0635 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..b6f71dba0 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..e2b147c67 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..8c0a6fcb4 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..66604e436 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..543d114ee 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..d19032b88 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..0de946b3e 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..e50c5369e 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..674880d15 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..d74a4af90 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..ce3549688 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..6fe7371e3 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-93 ../../pom.xml From cb17c37afc30cd32fec6145e32899cf70eaab770 Mon Sep 17 00:00:00 2001 From: kaazing-build Date: Wed, 5 Dec 2018 21:55:58 +0000 Subject: [PATCH 02/29] Resolve version ranges for release 3.0.0-alpha-98 --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 184068cc5..ebcbddaa6 100644 --- a/pom.xml +++ b/pom.xml @@ -82,7 +82,7 @@ junit junit - [4.11,) + 4.13-beta-1 org.mockito @@ -127,22 +127,22 @@ org.kaazing net.api - [1.1.0.0, 1.2.0.0) + 1.1.0.9 org.kaazing net.data - [1.1.0.0, 1.2.0.0) + 1.1.0.9 org.kaazing net.tcp - [1.1.0.0, 1.2.0.0) + 1.1.0.9 org.kaazing net.bbosh - [1.1.0.0, 1.2.0.0) + 1.1.0.9 com.fasterxml.jackson.core From 18ef639a4cbebcfbbc01e88566f22afcd3a20af2 Mon Sep 17 00:00:00 2001 From: kaazing-build Date: Wed, 5 Dec 2018 21:56:04 +0000 Subject: [PATCH 03/29] Prepare release 3.0.0-alpha-98 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..112215e0f 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index 3a1f0e90a..957575053 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..7bdfeb415 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..724e6a9e8 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..40d27b101 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..c926baca1 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..6259ff0c0 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..eacd68393 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 k3po.launcher diff --git a/pom.xml b/pom.xml index ebcbddaa6..d10a46923 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..f5b382313 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..80f58e933 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..f0d437690 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..40ac17f88 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..0799c454b 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..3cabbade5 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..510755d4e 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..f6ec599cb 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..b3b226a0f 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..a860a7e10 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..50f601683 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..eb06db612 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..4a4d68ffd 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..7d343d443 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..40475e55f 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..a5764ddf3 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..a9b25b99a 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..57556cd84 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..f68b9611f 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..3379e6870 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-98 ../../pom.xml From 12eddd8e733defcbe0e2fe39be1c2045a5a2b49a Mon Sep 17 00:00:00 2001 From: kaazing-build Date: Wed, 5 Dec 2018 22:13:20 +0000 Subject: [PATCH 04/29] Generate CHANGELOG.md for version 3.0.0-alpha-98 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48b486036..c6d646827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [3.0.0-alpha-97](https://github.com/k3po/k3po/tree/3.0.0-alpha-97) (2018-12-05) +[Full Changelog](https://github.com/k3po/k3po/compare/3.0.0-alpha-96...3.0.0-alpha-97) + ## [3.0.0-alpha-96](https://github.com/k3po/k3po/tree/3.0.0-alpha-96) (2018-05-18) [Full Changelog](https://github.com/k3po/k3po/compare/3.0.0-alpha-95...3.0.0-alpha-96) From 3ca4fd31ab4a397893aa640c62ada0e485c8bbd4 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Tue, 30 Apr 2019 10:48:00 -0700 Subject: [PATCH 05/29] Upgrade jackson dependency version --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 184068cc5..ad914ae35 100644 --- a/pom.xml +++ b/pom.xml @@ -147,12 +147,12 @@ com.fasterxml.jackson.core jackson-core - 2.8.9 + 2.9.8 com.fasterxml.jackson.core jackson-databind - 2.8.9 + 2.9.8 org.apache.maven From b1b6ac69c2792b46bc604dee2515a920cb18d8d1 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Tue, 7 May 2019 14:49:55 -0700 Subject: [PATCH 06/29] Upgrade agrona dependency version --- driver/pom.xml | 2 +- .../internal/functions/agrona/Functions.java | 16 +++++++++++++++- .../k3po/driver/internal/agrona/Functions.java | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/driver/pom.xml b/driver/pom.xml index 3a1f0e90a..0b74cede7 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -100,7 +100,7 @@ org.agrona Agrona - 0.5.5 + 0.9.35 diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/functions/agrona/Functions.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/functions/agrona/Functions.java index 6acd5a139..c2939c23d 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/functions/agrona/Functions.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/functions/agrona/Functions.java @@ -54,7 +54,7 @@ public static ChannelWriter manyToOneWriter(AtomicBuffer buffer) { @Function public static ChannelReader broadcastReceiver(AtomicBuffer buffer) { - return new CopyBroadcastReceiverChannelReader(new CopyBroadcastReceiver(new BroadcastReceiver(buffer))); + return new CopyBroadcastReceiverChannelReader(new FlushingCopyBroadcastReceiver(new BroadcastReceiver(buffer))); } @Function @@ -75,6 +75,20 @@ public String getPrefixName() { } + private static final class FlushingCopyBroadcastReceiver extends CopyBroadcastReceiver + { + public FlushingCopyBroadcastReceiver( + BroadcastReceiver receiver) + { + super(receiver); + + while (receiver.receiveNext()) + { + // flush to latest + } + } + } + private Functions() { // utility } diff --git a/driver/src/test/java/org/kaazing/k3po/driver/internal/agrona/Functions.java b/driver/src/test/java/org/kaazing/k3po/driver/internal/agrona/Functions.java index 6151d341e..fcdb79336 100644 --- a/driver/src/test/java/org/kaazing/k3po/driver/internal/agrona/Functions.java +++ b/driver/src/test/java/org/kaazing/k3po/driver/internal/agrona/Functions.java @@ -80,6 +80,7 @@ private static Layout layout(String filename, int ringCapacity, int broadcastCap File location = new File(filename); int totalRingLength = ringCapacity + RingBufferDescriptor.TRAILER_LENGTH; int totalBroadcastLength = broadcastCapacity + BroadcastBufferDescriptor.TRAILER_LENGTH; + create &= !location.exists(); MappedByteBuffer buffer = create ? mapNewFile(location, totalRingLength + totalBroadcastLength) : mapExistingFile(location, filename); AtomicBuffer ring = new UnsafeBuffer(buffer, 0, totalRingLength); From fd5f9a33f86b450303d3a7c9a082567bd13f3088 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Tue, 7 May 2019 14:51:03 -0700 Subject: [PATCH 07/29] Prepare release 3.0.0-alpha-99 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..a1d9b5ddc 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index 0b74cede7..f817eee82 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..ce65d5d03 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..2fa9058f5 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..3b2e9e531 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..7d6182c80 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..463f8b842 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..995c506f7 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 k3po.launcher diff --git a/pom.xml b/pom.xml index ad914ae35..16b3f63d7 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..91b439c96 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..615ba55e8 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..f862611c8 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..fc7acb162 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..746b8c616 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..56a798b26 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..79c630b11 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..f201dede0 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..23732eedc 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..f5da0d729 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..89991589f 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..40ea5b115 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..35ef0a6b5 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..a4a76ddca 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..146f9f036 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..17948739a 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..ff8816b74 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..ddf1badf9 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..12f57ed4f 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..8cd979005 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-99 ../../pom.xml From 0bac19f567de4b851bb328adaad6698398365fb6 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Tue, 7 May 2019 19:47:58 -0700 Subject: [PATCH 08/29] Update agrona dependency --- driver/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/pom.xml b/driver/pom.xml index 0b74cede7..db7c6036e 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -99,7 +99,7 @@ org.agrona - Agrona + agrona 0.9.35 From 46250cea6442e77f658d816a50cf8510a0d579b4 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Tue, 7 May 2019 19:49:02 -0700 Subject: [PATCH 09/29] Prepare release 3.0.0-alpha-100 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..4042818fb 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index db7c6036e..745fad13a 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..3a1866711 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..710a54667 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..4e2c52ef7 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..d84e5f9d5 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..4ba31612e 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..e3e673502 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 k3po.launcher diff --git a/pom.xml b/pom.xml index ad914ae35..5131f1023 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..3b00222b0 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..0da593320 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..68d300cbd 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..20acec859 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..639a856ff 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..8a681f0b9 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..b2bcda941 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..fbe292923 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..779528062 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..80ba80472 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..2103a8cce 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..64791e287 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..150589267 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..95cfecf68 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..0bdf3d24a 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..91d94d8bb 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..71ca20dad 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..a22820503 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..19c33c455 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..cad0fea76 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-100 ../../pom.xml From 6ff267762e3e1b94e2a8ffc6c347eb35767976b2 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Mon, 24 Jun 2019 18:27:41 -0700 Subject: [PATCH 10/29] Add support for dynamic bytes matcher via EL expression --- .../handler/codec/ReadExpressionDecoder.java | 30 ++++++++++++++++++- .../kaazing/k3po/lang/el/BytesMatcher.java | 24 +++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/el/BytesMatcher.java diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ReadExpressionDecoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ReadExpressionDecoder.java index 1cd6ab073..f0045bdd0 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ReadExpressionDecoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ReadExpressionDecoder.java @@ -19,6 +19,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static org.kaazing.k3po.lang.internal.RegionInfo.newSequential; +import java.nio.ByteBuffer; import java.util.Arrays; import javax.el.ValueExpression; @@ -26,6 +27,7 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.kaazing.k3po.driver.internal.behavior.ScriptProgressException; import org.kaazing.k3po.driver.internal.util.Utils; +import org.kaazing.k3po.lang.el.BytesMatcher; import org.kaazing.k3po.lang.internal.RegionInfo; import org.kaazing.k3po.lang.internal.el.ExpressionContext; @@ -33,6 +35,7 @@ public class ReadExpressionDecoder extends MessageDecoder { private final ValueExpression expression; private final ExpressionContext environment; + private BytesMatcher matcher; public ReadExpressionDecoder(RegionInfo regionInfo, ValueExpression expression, ExpressionContext environment) { super(regionInfo); @@ -54,7 +57,32 @@ protected Object decodeBuffer(ChannelBuffer buffer) throws Exception { expected = expression.getValue(environment); } - Object read = readValue(buffer, expected); + Object read; + + if (matcher == null && expected instanceof BytesMatcher) + { + matcher = (BytesMatcher) expected; + } + + if (matcher != null) + { + final ByteBuffer byteBuf = buffer.toByteBuffer(); + final int initialPos = byteBuf.position(); + try + { + read = matcher.match(byteBuf); + } + catch (Exception ex) + { + throw new ScriptProgressException(getRegionInfo(), ex.getMessage()); + } + final int bytesAdvanced = byteBuf.position() - initialPos; + buffer.skipBytes(bytesAdvanced); + } + else + { + read = readValue(buffer, expected); + } if (read == null) { return null; diff --git a/lang/src/main/java/org/kaazing/k3po/lang/el/BytesMatcher.java b/lang/src/main/java/org/kaazing/k3po/lang/el/BytesMatcher.java new file mode 100644 index 000000000..7aacdaea6 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/el/BytesMatcher.java @@ -0,0 +1,24 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.el; + +import java.nio.ByteBuffer; + +public interface BytesMatcher { + + Object match(ByteBuffer buffer) throws Exception; + +} From 3dbc93a90df77d1ff4ffd9899c1df69d6f541011 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Mon, 24 Jun 2019 18:31:53 -0700 Subject: [PATCH 11/29] Prepare release 3.0.0-alpha-101 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..6073d33ba 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index db7c6036e..45afdee93 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..9c0fed412 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..cf523c704 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..1e9b2eee9 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..324d776c4 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..9600f411e 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..dbb25f1b4 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 k3po.launcher diff --git a/pom.xml b/pom.xml index ad914ae35..ba90ae581 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..f55682da7 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..c33402132 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..0ec00514e 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..e393b88e8 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..a931be51c 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..eaa983b6a 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..0415a5d9a 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..c3eabb703 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..4413ed436 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..385324f44 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..0296624ad 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..64f95071e 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..c16374618 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..5947b1123 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..a13475718 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..cd69941cc 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..5ba1b7c8b 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..1c660d128 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..4280e56b0 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..a98183016 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-101 ../../pom.xml From 40b009a8de97a8fbee3e5a5b60a75b9c3690ecca Mon Sep 17 00:00:00 2001 From: John Fallows Date: Fri, 30 Aug 2019 21:00:42 -0700 Subject: [PATCH 12/29] connect abort and connect aborted --- .../kaazing/k3po/driver/internal/Robot.java | 30 ++------ .../handler/command/ConnectAbortHandler.java | 59 ++++++++++++++ .../handler/command/ConnectHandler.java | 20 ++++- .../handler/event/ConnectAbortedHandler.java | 60 +++++++++++++++ .../visitor/AssociateStreamsVisitor.java | 14 ++++ .../visitor/GenerateConfigurationVisitor.java | 39 +++++++++- .../visitor/InjectBarriersVisitor.java | 14 ++++ .../behavior/visitor/InjectEventsVisitor.java | 60 +++++++++++++++ .../behavior/visitor/InjectFlushVisitor.java | 14 ++++ .../visitor/ValidateStreamsVisitor.java | 28 +++++++ .../resolver/ClientBootstrapResolver.java | 9 +-- .../handler/command/ConnectHandlerTest.java | 3 + .../org/kaazing/k3po/lang/parser/v2/Robot.g4 | 14 +++- ...ceptableNode.java => AstAcceptedNode.java} | 0 .../internal/ast/AstConnectAbortNode.java | 40 ++++++++++ .../internal/ast/AstConnectAbortedNode.java | 40 ++++++++++ .../k3po/lang/internal/ast/AstNode.java | 3 + .../builder/AstConnectAbortNodeBuilder.java | 51 +++++++++++++ .../builder/AstConnectAbortedNodeBuilder.java | 51 +++++++++++++ .../internal/parser/ScriptParseStrategy.java | 76 ++++++++++++++++++- .../internal/parser/ScriptParserImplTest.java | 32 ++++++++ 21 files changed, 618 insertions(+), 39 deletions(-) create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectAbortHandler.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ConnectAbortedHandler.java rename lang/src/main/java/org/kaazing/k3po/lang/internal/ast/{AstAcceptableNode.java => AstAcceptedNode.java} (100%) create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstConnectAbortNode.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstConnectAbortedNode.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstConnectAbortNodeBuilder.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstConnectAbortedNodeBuilder.java diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java index 0a37e5a7f..4a57f2b94 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java @@ -324,7 +324,6 @@ public void operationComplete(ChannelFuture future) throws Exception { } private void connectClient(ClientBootstrapResolver clientResolver) throws Exception { - final RegionInfo regionInfo = clientResolver.getRegionInfo(); ClientBootstrap client = clientResolver.resolve(); if (LOGGER.isDebugEnabled()) { @@ -333,8 +332,14 @@ private void connectClient(ClientBootstrapResolver clientResolver) throws Except ChannelFuture connectFuture = client.connect(); connectFutures.add(connectFuture); - closeableChannels.add(connectFuture.getChannel()); - connectFuture.addListener(createConnectCompleteListener(regionInfo)); + connectFuture.addListener(new ChannelFutureListener() { + @Override + public void operationComplete(ChannelFuture future) throws Exception { + if (future.isSuccess()) { + closeableChannels.add(connectFuture.getChannel()); + } + } + }); } private void stopConfiguration() throws Exception { @@ -461,25 +466,6 @@ public void operationComplete(final ChannelFuture bindFuture) throws Exception { }; } - private ChannelFutureListener createConnectCompleteListener(final RegionInfo regionInfo) { - return new ChannelFutureListener() { - @Override - public void operationComplete(ChannelFuture connectFuture) throws Exception { - if (connectFuture.isCancelled()) { - // This is more that the connect never really fired, as in the case of a barrier, or the the connect - // is still in process here, so an empty line annotates that it did not do a connect, an actual - // connect - // failure should fail the future - progress.addScriptFailure(regionInfo, ""); - } else if (!connectFuture.isSuccess()) { - Throwable cause = connectFuture.getCause(); - String message = format("connect failed: %s", cause.getMessage()); - progress.addScriptFailure(regionInfo, message); - } - } - }; - } - private ChannelFutureListener createStreamCompletionListener() { return new ChannelFutureListener() { @Override diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectAbortHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectAbortHandler.java new file mode 100644 index 000000000..1e2fdd13f --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectAbortHandler.java @@ -0,0 +1,59 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior.handler.command; + +import org.jboss.netty.channel.ChannelEvent; +import org.jboss.netty.channel.ChannelException; +import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ChannelState; +import org.jboss.netty.channel.ChannelStateEvent; + +public class ConnectAbortHandler extends AbstractCommandHandler { + + private ChannelFuture connectFuture; + + @Override + public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { + if (e instanceof ChannelStateEvent) { + ChannelStateEvent cse = (ChannelStateEvent) e; + if (cse.getState() == ChannelState.CONNECTED) { + this.connectFuture = cse.getFuture(); + } + } + + ctx.sendDownstream(e); + } + + @Override + protected void invokeCommand(ChannelHandlerContext ctx) throws Exception { + + ChannelFuture handlerFuture = getHandlerFuture(); + if (connectFuture == null || !connectFuture.cancel()) { + handlerFuture.setFailure(new ChannelException("connect not aborted")); + } + else { + handlerFuture.setSuccess(); + } + } + + @Override + protected StringBuilder describe(StringBuilder sb) { + return sb.append("connect abort"); + } + +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectHandler.java index b892a978d..c6965ee78 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectHandler.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectHandler.java @@ -15,11 +15,15 @@ */ package org.kaazing.k3po.driver.internal.behavior.handler.command; +import static org.jboss.netty.channel.Channels.future; + import java.net.SocketAddress; import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelFutureListener; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.Channels; +import org.kaazing.k3po.driver.internal.behavior.ScriptProgressException; public class ConnectHandler extends AbstractCommandHandler { @@ -33,7 +37,21 @@ public ConnectHandler(SocketAddress remoteAddress) { protected void invokeCommand(ChannelHandlerContext ctx) throws Exception { ChannelFuture handlerFuture = getHandlerFuture(); - Channels.connect(ctx, handlerFuture, remoteAddress); + ChannelFuture connectFuture = future(ctx.getChannel(), true); + Channels.connect(ctx, connectFuture, remoteAddress); + connectFuture.addListener(new ChannelFutureListener() { + + @Override + public void operationComplete(ChannelFuture future) throws Exception { + + if (future.isSuccess()) { + handlerFuture.setSuccess(); + } + else { + handlerFuture.setFailure(new ScriptProgressException(getRegionInfo(), "connect aborted")); + } + } + }); } @Override diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ConnectAbortedHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ConnectAbortedHandler.java new file mode 100644 index 000000000..dd54508aa --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ConnectAbortedHandler.java @@ -0,0 +1,60 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior.handler.event; + +import org.jboss.netty.channel.ChannelDownstreamHandler; +import org.jboss.netty.channel.ChannelEvent; +import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelFutureListener; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ChannelState; +import org.jboss.netty.channel.ChannelStateEvent; +import org.kaazing.k3po.driver.internal.behavior.ScriptProgressException; +import org.kaazing.k3po.driver.internal.behavior.handler.ExecutionHandler; + +public class ConnectAbortedHandler extends ExecutionHandler implements ChannelDownstreamHandler { + + @Override + public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { + if (e instanceof ChannelStateEvent) { + ChannelStateEvent cse = (ChannelStateEvent) e; + if (cse.getState() == ChannelState.CONNECTED) { + final ChannelFuture connectFuture = cse.getFuture(); + final ChannelFuture handlerFuture = getHandlerFuture(); + connectFuture.addListener(new ChannelFutureListener() { + + @Override + public void operationComplete(ChannelFuture future) throws Exception { + + if (future.isSuccess()) { + handlerFuture.setFailure(new ScriptProgressException(getRegionInfo(), "connected")); + } + else { + handlerFuture.setSuccess(); + } + } + }); + } + } + + ctx.sendDownstream(e); + } + + @Override + protected StringBuilder describe(StringBuilder sb) { + return sb.append("connect aborted"); + } +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java index b98b8303d..ccb7c9044 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java @@ -30,6 +30,8 @@ import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; import org.kaazing.k3po.lang.internal.ast.AstCloseNode; import org.kaazing.k3po.lang.internal.ast.AstClosedNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortedNode; import org.kaazing.k3po.lang.internal.ast.AstConnectNode; import org.kaazing.k3po.lang.internal.ast.AstConnectedNode; import org.kaazing.k3po.lang.internal.ast.AstDisconnectNode; @@ -173,6 +175,18 @@ public AstScriptNode visit(AstConnectNode connectNode, State state) { return null; } + @Override + public AstScriptNode visit(AstConnectAbortNode node, State state) { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstConnectAbortedNode node, State state) { + state.streamables.add(node); + return null; + } + @Override public AstScriptNode visit(AstReadAwaitNode node, State state) { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java index 362dc77b5..07b3b6c38 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java @@ -46,7 +46,6 @@ import org.kaazing.k3po.driver.internal.behavior.BehaviorSystem; import org.kaazing.k3po.driver.internal.behavior.Configuration; import org.kaazing.k3po.driver.internal.behavior.handler.CompletionHandler; -import org.kaazing.k3po.driver.internal.behavior.handler.FailureHandler; import org.kaazing.k3po.driver.internal.behavior.handler.barrier.AwaitBarrierDownstreamHandler; import org.kaazing.k3po.driver.internal.behavior.handler.barrier.AwaitBarrierUpstreamHandler; import org.kaazing.k3po.driver.internal.behavior.handler.barrier.NotifyBarrierHandler; @@ -73,6 +72,7 @@ import org.kaazing.k3po.driver.internal.behavior.handler.codec.WriteShortEncoder; import org.kaazing.k3po.driver.internal.behavior.handler.codec.WriteTextEncoder; import org.kaazing.k3po.driver.internal.behavior.handler.command.CloseHandler; +import org.kaazing.k3po.driver.internal.behavior.handler.command.ConnectAbortHandler; import org.kaazing.k3po.driver.internal.behavior.handler.command.DisconnectHandler; import org.kaazing.k3po.driver.internal.behavior.handler.command.FlushHandler; import org.kaazing.k3po.driver.internal.behavior.handler.command.ReadAbortHandler; @@ -84,6 +84,7 @@ import org.kaazing.k3po.driver.internal.behavior.handler.event.ChildClosedHandler; import org.kaazing.k3po.driver.internal.behavior.handler.event.ChildOpenedHandler; import org.kaazing.k3po.driver.internal.behavior.handler.event.ClosedHandler; +import org.kaazing.k3po.driver.internal.behavior.handler.event.ConnectAbortedHandler; import org.kaazing.k3po.driver.internal.behavior.handler.event.ConnectedHandler; import org.kaazing.k3po.driver.internal.behavior.handler.event.DisconnectedHandler; import org.kaazing.k3po.driver.internal.behavior.handler.event.InputShutdownHandler; @@ -106,6 +107,8 @@ import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; import org.kaazing.k3po.lang.internal.ast.AstCloseNode; import org.kaazing.k3po.lang.internal.ast.AstClosedNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortedNode; import org.kaazing.k3po.lang.internal.ast.AstConnectNode; import org.kaazing.k3po.lang.internal.ast.AstConnectedNode; import org.kaazing.k3po.lang.internal.ast.AstDisconnectNode; @@ -314,7 +317,7 @@ public Configuration visit(AstAcceptNode acceptNode, State state) { @Override public ChannelPipeline getPipeline() { - return i.hasNext() ? i.next() : pipeline(new FailureHandler(), new CompletionHandler()); + return i.hasNext() ? i.next() : pipeline(); } }; @@ -399,7 +402,7 @@ public ChannelPipeline getPipeline() { OptionsResolver optionsResolver = new OptionsResolver(connectNode.getOptions()); ClientBootstrapResolver clientResolver = new ClientBootstrapResolver(bootstrapFactory, addressFactory, - pipelineFactory, locationResolver, optionsResolver, awaitBarrier, connectNode.getRegionInfo()); + pipelineFactory, locationResolver, optionsResolver, awaitBarrier); // retain pipelines for tear down state.configuration.getClientAndServerPipelines().add(pipeline); @@ -691,6 +694,36 @@ public Configuration visit(AstConnectedNode node, State state) { return state.configuration; } + @Override + public Configuration visit(AstConnectAbortNode node, State state) { + + RegionInfo regionInfo = node.getRegionInfo(); + + ConnectAbortHandler handler = new ConnectAbortHandler(); + handler.setRegionInfo(regionInfo); + + Map pipelineAsMap = state.pipelineAsMap; + String handlerName = String.format("connect abort#%d", pipelineAsMap.size() + 1); + pipelineAsMap.put(handlerName, handler); + + return state.configuration; + } + + @Override + public Configuration visit(AstConnectAbortedNode node, State state) { + + RegionInfo regionInfo = node.getRegionInfo(); + + ConnectAbortedHandler handler = new ConnectAbortedHandler(); + handler.setRegionInfo(regionInfo); + + Map pipelineAsMap = state.pipelineAsMap; + String handlerName = String.format("connect aborted#%d", pipelineAsMap.size() + 1); + pipelineAsMap.put(handlerName, handler); + + return state.configuration; + } + @Override public Configuration visit(AstReadValueNode node, State state) { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java index a72a17863..13ed224fa 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java @@ -26,6 +26,8 @@ import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; import org.kaazing.k3po.lang.internal.ast.AstCloseNode; import org.kaazing.k3po.lang.internal.ast.AstClosedNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortedNode; import org.kaazing.k3po.lang.internal.ast.AstConnectNode; import org.kaazing.k3po.lang.internal.ast.AstConnectedNode; import org.kaazing.k3po.lang.internal.ast.AstDisconnectNode; @@ -147,6 +149,18 @@ public AstScriptNode visit(AstConnectNode connectNode, State state) { return null; } + @Override + public AstScriptNode visit(AstConnectAbortNode node, State state) { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstConnectAbortedNode node, State state) { + state.streamables.add(node); + return null; + } + @Override public AstScriptNode visit(AstReadAwaitNode node, State state) { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java index b7a360f1c..21106ac38 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java @@ -25,6 +25,8 @@ import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; import org.kaazing.k3po.lang.internal.ast.AstCloseNode; import org.kaazing.k3po.lang.internal.ast.AstClosedNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortedNode; import org.kaazing.k3po.lang.internal.ast.AstConnectNode; import org.kaazing.k3po.lang.internal.ast.AstConnectedNode; import org.kaazing.k3po.lang.internal.ast.AstDisconnectNode; @@ -342,6 +344,64 @@ public AstScriptNode visit(AstConnectedNode connectedNode, State state) { return null; } + @Override + public AstScriptNode visit(AstConnectAbortNode connectAbortNode, State state) { + + switch (state.connectivityState) { + case NONE: + case OPENED: + AstBoundNode boundNode = new AstBoundNode(); + boundNode.setRegionInfo(connectAbortNode.getRegionInfo()); + boundNode.accept(this, state); + break; + default: + break; + } + + // The above switch might have changed the connectivity state, so + // we switch on it again + switch (state.connectivityState) { + case BOUND: + state.streamables.add(connectAbortNode); + state.connectivityState = ConnectivityState.CLOSED; + break; + + default: + throw new IllegalStateException("Unexpected connect abort"); + } + + return null; + } + + @Override + public AstScriptNode visit(AstConnectAbortedNode connectAbortedNode, State state) { + + switch (state.connectivityState) { + case NONE: + case OPENED: + AstBoundNode boundNode = new AstBoundNode(); + boundNode.setRegionInfo(connectAbortedNode.getRegionInfo()); + boundNode.accept(this, state); + break; + default: + break; + } + + // The above switch might have changed the connectivity state, so + // we switch on it again + switch (state.connectivityState) { + case BOUND: + state.streamables.add(connectAbortedNode); + state.connectivityState = ConnectivityState.CLOSED; + break; + + default: + throw new IllegalStateException("Unexpected event: connect aborted"); + } + + return null; + } + @Override public AstScriptNode visit(AstReadValueNode node, State state) { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java index fe48a39ef..2c4015be2 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java @@ -25,6 +25,8 @@ import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; import org.kaazing.k3po.lang.internal.ast.AstCloseNode; import org.kaazing.k3po.lang.internal.ast.AstClosedNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortedNode; import org.kaazing.k3po.lang.internal.ast.AstConnectNode; import org.kaazing.k3po.lang.internal.ast.AstConnectedNode; import org.kaazing.k3po.lang.internal.ast.AstDisconnectNode; @@ -149,6 +151,18 @@ public AstScriptNode visit(AstConnectNode connectNode, State state) { return null; } + @Override + public AstScriptNode visit(AstConnectAbortNode node, State state) { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstConnectAbortedNode node, State state) { + state.streamables.add(node); + return null; + } + @Override public AstScriptNode visit(AstReadAwaitNode node, State state) { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java index 5684836f1..d7df8cd40 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java @@ -23,6 +23,8 @@ import org.kaazing.k3po.lang.internal.ast.AstCloseNode; import org.kaazing.k3po.lang.internal.ast.AstClosedNode; import org.kaazing.k3po.lang.internal.ast.AstCommandNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortedNode; import org.kaazing.k3po.lang.internal.ast.AstConnectNode; import org.kaazing.k3po.lang.internal.ast.AstConnectedNode; import org.kaazing.k3po.lang.internal.ast.AstDisconnectNode; @@ -118,6 +120,32 @@ public AstScriptNode visit(AstConnectNode connectNode, State state) { return null; } + @Override + public AstScriptNode visit(AstConnectAbortNode node, State state) { + + switch (state.writeState) { + case OPEN: + state.readState = StreamState.CLOSED; + break; + default: + throw new IllegalStateException(unexpectedInWriteState(node, state)); + } + return null; + } + + @Override + public AstScriptNode visit(AstConnectAbortedNode node, State state) { + + switch (state.writeState) { + case OPEN: + state.readState = StreamState.CLOSED; + break; + default: + throw new IllegalStateException(unexpectedInWriteState(node, state)); + } + return null; + } + @Override public AstScriptNode visit(AstReadConfigNode node, State state) { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/resolver/ClientBootstrapResolver.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/resolver/ClientBootstrapResolver.java index 240595915..a491d480e 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/resolver/ClientBootstrapResolver.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/resolver/ClientBootstrapResolver.java @@ -42,22 +42,19 @@ public class ClientBootstrapResolver { private final ChannelPipelineFactory pipelineFactory; private final Supplier locationResolver; private final Barrier awaitBarrier; - private final RegionInfo regionInfo; private final OptionsResolver optionsResolver; private ClientBootstrap bootstrap; public ClientBootstrapResolver(BootstrapFactory bootstrapFactory, ChannelAddressFactory addressFactory, ChannelPipelineFactory pipelineFactory, Supplier locationResolver, - OptionsResolver optionsResolver, Barrier awaitBarrier, - RegionInfo regionInfo) { + OptionsResolver optionsResolver, Barrier awaitBarrier) { this.bootstrapFactory = bootstrapFactory; this.addressFactory = addressFactory; this.pipelineFactory = pipelineFactory; this.locationResolver = locationResolver; this.optionsResolver = optionsResolver; this.awaitBarrier = awaitBarrier; - this.regionInfo = regionInfo; } public ClientBootstrap resolve() throws Exception { @@ -78,8 +75,4 @@ public ClientBootstrap resolve() throws Exception { public Barrier getAwaitBarrier() { return this.awaitBarrier; } - - public RegionInfo getRegionInfo() { - return this.regionInfo; - } } diff --git a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectHandlerTest.java b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectHandlerTest.java index 599e5edef..2a30d5b8b 100644 --- a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectHandlerTest.java +++ b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ConnectHandlerTest.java @@ -20,6 +20,7 @@ import static org.jboss.netty.channel.ChannelState.OPEN; import static org.jboss.netty.channel.Channels.pipeline; import static org.junit.Assert.assertFalse; +import static org.kaazing.k3po.lang.internal.RegionInfo.newSequential; import org.jboss.netty.channel.ChannelDownstreamHandler; import org.jboss.netty.channel.ChannelEvent; @@ -39,6 +40,7 @@ import org.kaazing.k3po.driver.internal.behavior.handler.prepare.PreparationEvent; import org.kaazing.k3po.driver.internal.jmock.Expectations; import org.kaazing.k3po.driver.internal.jmock.Mockery; +import org.kaazing.k3po.lang.internal.RegionInfo; public class ConnectHandlerTest { @@ -64,6 +66,7 @@ public void setUp() throws Exception { execution = new ExecutionHandler(); handler = new ConnectHandler(new LocalAddress("test")); + handler.setRegionInfo(newSequential(0, 0)); pipeline = pipeline(new SimpleChannelHandler() { @Override diff --git a/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 b/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 index 1e313986e..4c13e88f4 100644 --- a/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 +++ b/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 @@ -107,7 +107,8 @@ streamableNode ; commandNode - : writeConfigNode + : connectAbortNode + | writeConfigNode | writeNode | writeFlushNode | writeCloseNode @@ -117,7 +118,8 @@ commandNode ; eventNode - : openedNode + : connectAbortedNode + | openedNode | boundNode | readConfigNode | readNode @@ -137,6 +139,14 @@ barrierNode | writeNotifyNode ; +connectAbortNode + : ConnectKeyword AbortKeyword + ; + +connectAbortedNode + : ConnectKeyword AbortedKeyword + ; + closeNode : CloseKeyword ; diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptableNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptedNode.java similarity index 100% rename from lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptableNode.java rename to lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptedNode.java diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstConnectAbortNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstConnectAbortNode.java new file mode 100644 index 000000000..074717b81 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstConnectAbortNode.java @@ -0,0 +1,40 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast; + +public final class AstConnectAbortNode extends AstCommandNode { + + @Override + public R accept(Visitor visitor, P parameter) { + return visitor.visit(this, parameter); + } + + @Override + protected int hashTo() { + return getClass().hashCode(); + } + + @Override + protected boolean equalTo(AstRegion that) { + return that instanceof AstConnectAbortNode; + } + + @Override + protected void describe(StringBuilder buf) { + super.describe(buf); + buf.append("connect abort\n"); + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstConnectAbortedNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstConnectAbortedNode.java new file mode 100644 index 000000000..a9923a0f1 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstConnectAbortedNode.java @@ -0,0 +1,40 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast; + +public final class AstConnectAbortedNode extends AstEventNode { + + @Override + public R accept(Visitor visitor, P parameter) { + return visitor.visit(this, parameter); + } + + @Override + protected int hashTo() { + return getClass().hashCode(); + } + + @Override + protected boolean equalTo(AstRegion that) { + return that instanceof AstConnectAbortedNode; + } + + @Override + protected void describe(StringBuilder buf) { + super.describe(buf); + buf.append("connect aborted\n"); + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java index 7f5147ae8..7c490f9d2 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java @@ -27,6 +27,9 @@ public interface Visitor { R visit(AstAcceptableNode node, P parameter); R visit(AstConnectNode node, P parameter); + R visit(AstConnectAbortNode node, P parameter); + R visit(AstConnectAbortedNode node, P parameter); + R visit(AstWriteFlushNode node, P parameter); R visit(AstWriteValueNode node, P parameter); R visit(AstWriteCloseNode node, P parameter); diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstConnectAbortNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstConnectAbortNodeBuilder.java new file mode 100644 index 000000000..20e9c8e44 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstConnectAbortNodeBuilder.java @@ -0,0 +1,51 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast.builder; + +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortNode; +import org.kaazing.k3po.lang.internal.ast.AstStreamNode; + +public class AstConnectAbortNodeBuilder extends AbstractAstStreamableNodeBuilder { + + public AstConnectAbortNodeBuilder() { + this(new AstConnectAbortNode()); + } + + @Override + public AstConnectAbortNode done() { + return result; + } + + private AstConnectAbortNodeBuilder(AstConnectAbortNode node) { + super(node, node); + } + + public static class StreamNested> extends + AbstractAstStreamableNodeBuilder { + + public StreamNested(R builder) { + super(new AstConnectAbortNode(), builder); + } + + @Override + public R done() { + AstStreamNode streamNode = result.node; + streamNode.getStreamables().add(node); + return result; + } + + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstConnectAbortedNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstConnectAbortedNodeBuilder.java new file mode 100644 index 000000000..caa699038 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstConnectAbortedNodeBuilder.java @@ -0,0 +1,51 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast.builder; + +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstStreamNode; + +public class AstConnectAbortedNodeBuilder extends AbstractAstStreamableNodeBuilder { + + public AstConnectAbortedNodeBuilder() { + this(new AstConnectAbortedNode()); + } + + @Override + public AstConnectAbortedNode done() { + return result; + } + + private AstConnectAbortedNodeBuilder(AstConnectAbortedNode node) { + super(node, node); + } + + public static class StreamNested> extends + AbstractAstStreamableNodeBuilder { + + public StreamNested(R builder) { + super(new AstConnectAbortedNode(), builder); + } + + @Override + public R done() { + AstStreamNode streamNode = result.node; + streamNode.getStreamables().add(node); + return result; + } + + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java index 9f169c13c..16350edc5 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java @@ -43,6 +43,8 @@ import org.kaazing.k3po.lang.internal.ast.AstCloseNode; import org.kaazing.k3po.lang.internal.ast.AstClosedNode; import org.kaazing.k3po.lang.internal.ast.AstCommandNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortedNode; import org.kaazing.k3po.lang.internal.ast.AstConnectNode; import org.kaazing.k3po.lang.internal.ast.AstConnectedNode; import org.kaazing.k3po.lang.internal.ast.AstDisconnectNode; @@ -110,6 +112,8 @@ import org.kaazing.k3po.lang.parser.v2.RobotParser.CloseNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ClosedNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.CommandNodeContext; +import org.kaazing.k3po.lang.parser.v2.RobotParser.ConnectAbortNodeContext; +import org.kaazing.k3po.lang.parser.v2.RobotParser.ConnectAbortedNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ConnectNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ConnectOptionContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ConnectedNodeContext; @@ -266,6 +270,22 @@ public AstConnectNode parse(RobotParser parser, ExpressionFactory factory, Expre } }; + public static final ScriptParseStrategy CONNECT_ABORT = new ScriptParseStrategy() { + @Override + public AstConnectAbortNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) + throws RecognitionException { + return new AstConnectAbortNodeVisitor(factory, environment).visit(parser.connectAbortNode()); + } + }; + + public static final ScriptParseStrategy CONNECT_ABORTED = new ScriptParseStrategy() { + @Override + public AstConnectAbortedNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) + throws RecognitionException { + return new AstConnectAbortedNodeVisitor(factory, environment).visit(parser.connectAbortedNode()); + } + }; + public static final ScriptParseStrategy CLOSE = new ScriptParseStrategy() { @Override public AstCloseNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) @@ -829,9 +849,7 @@ public AstConnectNode visitConnectNode(ConnectNodeContext ctx) { } @Override - public AstConnectNode visitConnectOption( - ConnectOptionContext ctx) - { + public AstConnectNode visitConnectOption(ConnectOptionContext ctx) { String optionQName = ctx.optionName().getText(); TypeInfo optionType = TYPE_SYSTEM.connectOption(optionQName); String optionName = optionType.getName(); @@ -858,6 +876,38 @@ public AstConnectNode visitStreamableNode(StreamableNodeContext ctx) { } + private static class AstConnectAbortNodeVisitor extends AstNodeVisitor { + + public AstConnectAbortNodeVisitor(ExpressionFactory factory, ExpressionContext environment) { + super(factory, environment); + } + + @Override + public AstConnectAbortNode visitConnectAbortNode(ConnectAbortNodeContext ctx) { + node = new AstConnectAbortNode(); + super.visitConnectAbortNode(ctx); + node.setRegionInfo(asParallelRegion(childInfos, ctx)); + return node; + } + + } + + private static class AstConnectAbortedNodeVisitor extends AstNodeVisitor { + + public AstConnectAbortedNodeVisitor(ExpressionFactory factory, ExpressionContext environment) { + super(factory, environment); + } + + @Override + public AstConnectAbortedNode visitConnectAbortedNode(ConnectAbortedNodeContext ctx) { + node = new AstConnectAbortedNode(); + super.visitConnectAbortedNode(ctx); + node.setRegionInfo(asParallelRegion(childInfos, ctx)); + return node; + } + + } + private static class AstStreamableNodeVisitor extends AstNodeVisitor { public AstStreamableNodeVisitor(ExpressionFactory factory, ExpressionContext environment) { @@ -1051,6 +1101,16 @@ public AstClosedNode visitClosedNode(ClosedNodeContext ctx) { return closedNode; } + @Override + public AstConnectAbortedNode visitConnectAbortedNode(ConnectAbortedNodeContext ctx) { + AstConnectAbortedNodeVisitor visitor = new AstConnectAbortedNodeVisitor(factory, environment); + AstConnectAbortedNode connectAbortedNode = visitor.visitConnectAbortedNode(ctx); + if (connectAbortedNode != null) { + childInfos().add(connectAbortedNode.getRegionInfo()); + } + return connectAbortedNode; + } + @Override public AstConnectedNode visitConnectedNode(ConnectedNodeContext ctx) { @@ -1166,6 +1226,16 @@ public AstCommandNodeVisitor(ExpressionFactory factory, ExpressionContext enviro super(factory, environment); } + @Override + public AstConnectAbortNode visitConnectAbortNode(ConnectAbortNodeContext ctx) { + AstConnectAbortNodeVisitor visitor = new AstConnectAbortNodeVisitor(factory, environment); + AstConnectAbortNode connectAbortNode = visitor.visitConnectAbortNode(ctx); + if (connectAbortNode != null) { + childInfos().add(connectAbortNode.getRegionInfo()); + } + return connectAbortNode; + } + @Override public AstUnbindNode visitUnbindNode(UnbindNodeContext ctx) { diff --git a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java index e19ccbeae..5c41575b7 100644 --- a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java +++ b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java @@ -20,6 +20,8 @@ import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.CLOSE; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.CLOSED; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.CONNECTED; +import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.CONNECT_ABORT; +import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.CONNECT_ABORTED; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.EXPRESSION_MATCHER; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.FIXED_LENGTH_BYTES_MATCHER; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.LITERAL_BYTES_VALUE; @@ -63,6 +65,8 @@ import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; import org.kaazing.k3po.lang.internal.ast.AstCloseNode; import org.kaazing.k3po.lang.internal.ast.AstClosedNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortNode; +import org.kaazing.k3po.lang.internal.ast.AstConnectAbortedNode; import org.kaazing.k3po.lang.internal.ast.AstConnectedNode; import org.kaazing.k3po.lang.internal.ast.AstPropertyNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortNode; @@ -83,6 +87,8 @@ import org.kaazing.k3po.lang.internal.ast.builder.AstAcceptNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstCloseNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstClosedNodeBuilder; +import org.kaazing.k3po.lang.internal.ast.builder.AstConnectAbortNodeBuilder; +import org.kaazing.k3po.lang.internal.ast.builder.AstConnectAbortedNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstConnectedNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstPropertyNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstReadAbortNodeBuilder; @@ -872,6 +878,32 @@ public void shouldNotParseAcceptedWithoutBehavior() throws Exception { parser.parseWithStrategy(script, SCRIPT); } + @Test + public void shouldParseConnectAbort() throws Exception { + + String scriptFragment = "connect abort"; + + ScriptParserImpl parser = new ScriptParserImpl(); + AstConnectAbortNode actual = parser.parseWithStrategy(scriptFragment, CONNECT_ABORT); + + AstConnectAbortNode expected = new AstConnectAbortNodeBuilder().done(); + + assertEquals(expected, actual); + } + + @Test + public void shouldParseConnectAborted() throws Exception { + + String scriptFragment = "connect aborted"; + + ScriptParserImpl parser = new ScriptParserImpl(); + AstConnectAbortedNode actual = parser.parseWithStrategy(scriptFragment, CONNECT_ABORTED); + + AstConnectAbortedNode expected = new AstConnectAbortedNodeBuilder().done(); + + assertEquals(expected, actual); + } + @Test public void shouldParseClose() throws Exception { From 3120fe631034bec18485d5901a290e7f9b185daa Mon Sep 17 00:00:00 2001 From: John Fallows Date: Fri, 30 Aug 2019 21:01:35 -0700 Subject: [PATCH 13/29] Refactor AstAcceptableNode to AstAcceptNode for accept --- .../visitor/AssociateStreamsVisitor.java | 8 ++--- .../visitor/GenerateConfigurationVisitor.java | 6 ++-- .../visitor/InjectBarriersVisitor.java | 8 ++--- .../behavior/visitor/InjectEventsVisitor.java | 8 ++--- .../behavior/visitor/InjectFlushVisitor.java | 8 ++--- .../visitor/ValidateStreamsVisitor.java | 6 ++-- .../org/kaazing/k3po/lang/parser/v2/Robot.g4 | 4 +-- .../k3po/lang/internal/ast/AstAcceptNode.java | 6 ++-- .../lang/internal/ast/AstAcceptedNode.java | 6 ++-- .../k3po/lang/internal/ast/AstNode.java | 2 +- .../AbstractAstAcceptableNodeBuilder.java | 8 ++--- .../ast/builder/AstAcceptableNodeBuilder.java | 10 +++---- .../internal/parser/ScriptParseStrategy.java | 30 +++++++++---------- .../ScriptParserImplParseSCRIPTTest.java | 10 +++---- 14 files changed, 60 insertions(+), 60 deletions(-) diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java index ccb7c9044..21c89e5b5 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java @@ -24,7 +24,7 @@ import org.kaazing.k3po.driver.internal.behavior.visitor.AssociateStreamsVisitor.State; import org.kaazing.k3po.lang.internal.RegionInfo; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; -import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; @@ -121,7 +121,7 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { streamable.accept(this, state); } - for (AstAcceptableNode acceptable : acceptNode.getAcceptables()) { + for (AstAcceptedNode acceptable : acceptNode.getAcceptables()) { assert equivalent(acceptName, acceptable.getAcceptName()); acceptable.accept(this, state); } @@ -132,9 +132,9 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { } @Override - public AstScriptNode visit(AstAcceptableNode acceptableNode, State state) { + public AstScriptNode visit(AstAcceptedNode acceptableNode, State state) { - AstAcceptableNode newAcceptableNode = new AstAcceptableNode(); + AstAcceptedNode newAcceptableNode = new AstAcceptedNode(); newAcceptableNode.setRegionInfo(acceptableNode.getRegionInfo()); String acceptName = acceptableNode.getAcceptName(); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java index 07b3b6c38..1383e183e 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java @@ -101,7 +101,7 @@ import org.kaazing.k3po.driver.internal.resolver.ServerBootstrapResolver; import org.kaazing.k3po.lang.internal.RegionInfo; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; -import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; @@ -260,7 +260,7 @@ public Configuration visit(AstPropertyNode propertyNode, State state) { } @Override - public Configuration visit(AstAcceptableNode acceptedNode, State state) { + public Configuration visit(AstAcceptedNode acceptedNode, State state) { // masking is a no-op by default for each stream state.readUnmasker = Masker.IDENTITY_MASKER; @@ -294,7 +294,7 @@ public Configuration visit(AstAcceptNode acceptNode, State state) { final List pipelines = new ArrayList<>(); state.pipelineAsMap = new LinkedHashMap<>(); - for (AstAcceptableNode acceptableNode : acceptNode.getAcceptables()) { + for (AstAcceptedNode acceptableNode : acceptNode.getAcceptables()) { acceptableNode.accept(this, state); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java index 13ed224fa..d9b276d18 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java @@ -20,7 +20,7 @@ import org.kaazing.k3po.driver.internal.behavior.visitor.InjectBarriersVisitor.State; import org.kaazing.k3po.lang.internal.RegionInfo; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; -import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; @@ -104,7 +104,7 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { streamable.accept(this, state); } - for (AstAcceptableNode acceptableNode : acceptNode.getAcceptables()) { + for (AstAcceptedNode acceptableNode : acceptNode.getAcceptables()) { acceptableNode.accept(this, state); } @@ -114,11 +114,11 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { } @Override - public AstScriptNode visit(AstAcceptableNode acceptableNode, State state) { + public AstScriptNode visit(AstAcceptedNode acceptableNode, State state) { state.readWriteState = ReadWriteState.NONE; - AstAcceptableNode newAcceptableNode = new AstAcceptableNode(); + AstAcceptedNode newAcceptableNode = new AstAcceptedNode(); newAcceptableNode.setRegionInfo(acceptableNode.getRegionInfo()); newAcceptableNode.setAcceptName(acceptableNode.getAcceptName()); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java index 21106ac38..cc9e46af7 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java @@ -19,7 +19,7 @@ import org.kaazing.k3po.driver.internal.behavior.visitor.InjectEventsVisitor.State; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; -import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; @@ -102,7 +102,7 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { streamable.accept(this, state); } - for (AstAcceptableNode acceptable : acceptNode.getAcceptables()) { + for (AstAcceptedNode acceptable : acceptNode.getAcceptables()) { acceptable.accept(this, state); } @@ -112,11 +112,11 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { } @Override - public AstScriptNode visit(AstAcceptableNode acceptableNode, State state) { + public AstScriptNode visit(AstAcceptedNode acceptableNode, State state) { state.connectivityState = ConnectivityState.NONE; - AstAcceptableNode newAcceptableNode = new AstAcceptableNode(); + AstAcceptedNode newAcceptableNode = new AstAcceptedNode(); newAcceptableNode.setRegionInfo(acceptableNode.getRegionInfo()); newAcceptableNode.setAcceptName(acceptableNode.getAcceptName()); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java index 2c4015be2..a4bd4e5cf 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java @@ -19,7 +19,7 @@ import org.kaazing.k3po.driver.internal.behavior.visitor.InjectFlushVisitor.State; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; -import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; @@ -104,7 +104,7 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { streamable.accept(this, state); } - for (AstAcceptableNode acceptableNode : acceptNode.getAcceptables()) { + for (AstAcceptedNode acceptableNode : acceptNode.getAcceptables()) { acceptableNode.accept(this, state); } @@ -114,12 +114,12 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { } @Override - public AstScriptNode visit(AstAcceptableNode acceptableNode, State state) { + public AstScriptNode visit(AstAcceptedNode acceptableNode, State state) { state.readState = ReadWriteState.NONE; state.writeState = ReadWriteState.NONE; - AstAcceptableNode newAcceptableNode = new AstAcceptableNode(); + AstAcceptedNode newAcceptableNode = new AstAcceptedNode(); newAcceptableNode.setRegionInfo(acceptableNode.getRegionInfo()); newAcceptableNode.setAcceptName(acceptableNode.getAcceptName()); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java index d7df8cd40..ddf48e3ea 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java @@ -16,7 +16,7 @@ package org.kaazing.k3po.driver.internal.behavior.visitor; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; -import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; import org.kaazing.k3po.lang.internal.ast.AstChildOpenedNode; @@ -97,7 +97,7 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { streamable.accept(this, state); } - for (AstAcceptableNode acceptable : acceptNode.getAcceptables()) { + for (AstAcceptedNode acceptable : acceptNode.getAcceptables()) { state.readState = StreamState.OPEN; state.writeState = StreamState.OPEN; acceptable.accept(this, state); @@ -289,7 +289,7 @@ public AstScriptNode visit(AstWriteFlushNode node, State state) { } @Override - public AstScriptNode visit(AstAcceptableNode acceptableNode, State state) { + public AstScriptNode visit(AstAcceptedNode acceptableNode, State state) { for (AstStreamableNode streamable : acceptableNode.getStreamables()) { streamable.accept(this, state); diff --git a/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 b/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 index 4c13e88f4..3ba49a684 100644 --- a/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 +++ b/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 @@ -32,7 +32,7 @@ optionName streamNode : acceptNode - | acceptableNode + | acceptedNode | connectNode ; @@ -49,7 +49,7 @@ acceptOption : OptionKeyword optionName writeValue ; -acceptableNode +acceptedNode : AcceptedKeyword ( text=Name )? streamableNode+ ; diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptNode.java index 617c1ac21..6d793d244 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptNode.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptNode.java @@ -30,7 +30,7 @@ public class AstAcceptNode extends AstStreamNode { private String acceptName; private String notifyName; private Map options; - private List acceptables; + private List acceptables; private AstValue location; @@ -77,7 +77,7 @@ public Map getOptions() { return options; } - public List getAcceptables() { + public List getAcceptables() { if (acceptables == null) { acceptables = new LinkedList<>(); } @@ -139,7 +139,7 @@ protected void describe(StringBuilder buf) { super.describe(buf); if (acceptables != null) { - for (AstAcceptableNode acceptable : acceptables) { + for (AstAcceptedNode acceptable : acceptables) { acceptable.describe(buf); } } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptedNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptedNode.java index 014604441..84527006d 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptedNode.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptedNode.java @@ -17,7 +17,7 @@ import static org.kaazing.k3po.lang.internal.ast.util.AstUtil.equivalent; -public class AstAcceptableNode extends AstStreamNode { +public class AstAcceptedNode extends AstStreamNode { private String acceptName; @@ -43,7 +43,7 @@ protected int hashTo() { @Override protected boolean equalTo(AstRegion that) { - return that instanceof AstAcceptableNode && equalTo((AstAcceptableNode) that); + return that instanceof AstAcceptedNode && equalTo((AstAcceptedNode) that); } @Override @@ -65,7 +65,7 @@ protected void describeLine(StringBuilder sb) { sb.append('\n'); } - protected boolean equalTo(AstAcceptableNode that) { + protected boolean equalTo(AstAcceptedNode that) { return super.equalTo(that) && equivalent(this.acceptName, that.acceptName); } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java index 7c490f9d2..9c438db75 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java @@ -24,7 +24,7 @@ public interface Visitor { R visit(AstScriptNode node, P parameter); R visit(AstPropertyNode node, P parameter); R visit(AstAcceptNode node, P parameter); - R visit(AstAcceptableNode node, P parameter); + R visit(AstAcceptedNode node, P parameter); R visit(AstConnectNode node, P parameter); R visit(AstConnectAbortNode node, P parameter); diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstAcceptableNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstAcceptableNodeBuilder.java index fc3a89375..2f93f7292 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstAcceptableNodeBuilder.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstAcceptableNodeBuilder.java @@ -15,16 +15,16 @@ */ package org.kaazing.k3po.lang.internal.ast.builder; -import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; public abstract class AbstractAstAcceptableNodeBuilder - extends AbstractAstStreamNodeBuilder { + extends AbstractAstStreamNodeBuilder { public AbstractAstAcceptableNodeBuilder(R result) { - super(new AstAcceptableNode(), result); + super(new AstAcceptedNode(), result); } - protected AbstractAstAcceptableNodeBuilder(AstAcceptableNode node, R result) { + protected AbstractAstAcceptableNodeBuilder(AstAcceptedNode node, R result) { super(node, result); } } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptableNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptableNodeBuilder.java index 81cc3dd5f..5185c4f7b 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptableNodeBuilder.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptableNodeBuilder.java @@ -16,13 +16,13 @@ package org.kaazing.k3po.lang.internal.ast.builder; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; -import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; -public final class AstAcceptableNodeBuilder extends AbstractAstAcceptableNodeBuilder { +public final class AstAcceptableNodeBuilder extends AbstractAstAcceptableNodeBuilder { public AstAcceptableNodeBuilder() { - this(new AstAcceptableNode()); + this(new AstAcceptedNode()); } public AstAcceptableNodeBuilder setAcceptName(String acceptName) { @@ -136,11 +136,11 @@ public AstWriteOptionNodeBuilder.StreamNested addWrite } @Override - public AstAcceptableNode done() { + public AstAcceptedNode done() { return result; } - private AstAcceptableNodeBuilder(AstAcceptableNode node) { + private AstAcceptableNodeBuilder(AstAcceptedNode node) { super(node, node); } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java index 16350edc5..82aacb006 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java @@ -35,7 +35,7 @@ import org.antlr.v4.runtime.Token; import org.kaazing.k3po.lang.internal.RegionInfo; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; -import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBarrierNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; @@ -104,7 +104,7 @@ import org.kaazing.k3po.lang.parser.v2.RobotParser; import org.kaazing.k3po.lang.parser.v2.RobotParser.AcceptNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.AcceptOptionContext; -import org.kaazing.k3po.lang.parser.v2.RobotParser.AcceptableNodeContext; +import org.kaazing.k3po.lang.parser.v2.RobotParser.AcceptedNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.BarrierNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.BoundNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ChildClosedNodeContext; @@ -254,11 +254,11 @@ public AstAcceptNode parse(RobotParser parser, ExpressionFactory factory, Expres } }; - public static final ScriptParseStrategy ACCEPTABLE = new ScriptParseStrategy() { + public static final ScriptParseStrategy ACCEPTED = new ScriptParseStrategy() { @Override - public AstAcceptableNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) + public AstAcceptedNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) throws RecognitionException { - return new AstAcceptedNodeVisitor(factory, environment).visit(parser.acceptableNode()); + return new AstAcceptedNodeVisitor(factory, environment).visit(parser.acceptedNode()); } }; @@ -725,13 +725,13 @@ public AstAcceptNode visitAcceptNode(AcceptNodeContext ctx) { } @Override - public AstAcceptableNode visitAcceptableNode(AcceptableNodeContext ctx) { + public AstAcceptedNode visitAcceptedNode(AcceptedNodeContext ctx) { AstAcceptedNodeVisitor visitor = new AstAcceptedNodeVisitor(factory, environment); - AstAcceptableNode acceptableNode = visitor.visitAcceptableNode(ctx); - if (acceptableNode != null) { - childInfos().add(acceptableNode.getRegionInfo()); + AstAcceptedNode acceptedNode = visitor.visitAcceptedNode(ctx); + if (acceptedNode != null) { + childInfos().add(acceptedNode.getRegionInfo()); } - return acceptableNode; + return acceptedNode; } @Override @@ -798,25 +798,25 @@ public AstAcceptNode visitServerStreamableNode(ServerStreamableNodeContext ctx) } - private static class AstAcceptedNodeVisitor extends AstNodeVisitor { + private static class AstAcceptedNodeVisitor extends AstNodeVisitor { public AstAcceptedNodeVisitor(ExpressionFactory factory, ExpressionContext environment) { super(factory, environment); } @Override - public AstAcceptableNode visitAcceptableNode(AcceptableNodeContext ctx) { - node = new AstAcceptableNode(); + public AstAcceptedNode visitAcceptedNode(AcceptedNodeContext ctx) { + node = new AstAcceptedNode(); if (ctx.text != null) { node.setAcceptName(ctx.text.getText()); } - super.visitAcceptableNode(ctx); + super.visitAcceptedNode(ctx); node.setRegionInfo(asParallelRegion(childInfos, ctx)); return node; } @Override - public AstAcceptableNode visitStreamableNode(StreamableNodeContext ctx) { + public AstAcceptedNode visitStreamableNode(StreamableNodeContext ctx) { AstStreamableNodeVisitor visitor = new AstStreamableNodeVisitor(factory, environment); AstStreamableNode streamableNode = visitor.visitStreamableNode(ctx); if (streamableNode != null) { diff --git a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplParseSCRIPTTest.java b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplParseSCRIPTTest.java index 9c8c95fc4..27078758e 100644 --- a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplParseSCRIPTTest.java +++ b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplParseSCRIPTTest.java @@ -1046,13 +1046,13 @@ public class ScriptParserImplParseSCRIPTTest { // * there exists a AcceptNode. Note this will be a reference to the // * acceptable list inside an AcceptNode // */ -// List scriptAcceptableList = null; +// List scriptAcceptableList = null; // // /* // * Collect any Acceptable nodes and save them for adding to // * scriptAcceptableList // */ -// List collectAcceptableList = new LinkedList(); +// List collectAcceptableList = new LinkedList(); // // while (iter.hasNext()) { // AstStreamNode node = iter.next(); @@ -1071,12 +1071,12 @@ public class ScriptParserImplParseSCRIPTTest { // scriptAcceptableList.addAll(collectAcceptableList); // scriptAcceptableList = ((AstAcceptNode) node) // .getAcceptables(); -// collectAcceptableList = new LinkedList(); +// collectAcceptableList = new LinkedList(); // } -// } else if (node.getClass().equals(AstAcceptableNode.class)) { +// } else if (node.getClass().equals(AstAcceptedNode.class)) { // /* Remove the Acceptable */ // iter.remove(); -// collectAcceptableList.add((AstAcceptableNode) node); +// collectAcceptableList.add((AstAcceptedNode) node); // } // } // /* Add all the acceptables to the last AcceptNode found */ From 3fd146cedcb8410f19af01982476c3003a508e62 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Mon, 2 Sep 2019 15:37:51 -0700 Subject: [PATCH 14/29] Support rejected keyword and auto unbind after last accepted or rejected stream for accept (unless udp) --- .../kaazing/k3po/driver/internal/Robot.java | 20 ++ .../behavior/handler/RejectedHandler.java | 36 +++ .../handler/event/ConnectAbortedHandler.java | 2 +- .../visitor/AssociateStreamsVisitor.java | 48 +++- .../visitor/GenerateConfigurationVisitor.java | 47 ++-- .../visitor/InjectBarriersVisitor.java | 37 ++- .../behavior/visitor/InjectEventsVisitor.java | 37 ++- .../behavior/visitor/InjectFlushVisitor.java | 38 ++- .../visitor/ValidateStreamsVisitor.java | 18 +- .../netty/bootstrap/udp/UdpServerChannel.java | 2 +- .../resolver/ServerBootstrapResolver.java | 21 +- .../org/kaazing/k3po/lang/parser/v2/Robot.g4 | 14 + .../k3po/lang/internal/ast/AstAcceptNode.java | 6 +- .../lang/internal/ast/AstAcceptableNode.java | 53 ++++ .../lang/internal/ast/AstAcceptedNode.java | 36 +-- .../k3po/lang/internal/ast/AstNode.java | 1 + .../lang/internal/ast/AstRejectedNode.java | 44 ++++ ...va => AbstractAstAcceptedNodeBuilder.java} | 6 +- .../AbstractAstRejectableNodeBuilder.java | 25 ++ .../AbstractAstRejectedNodeBuilder.java | 41 +++ .../ast/builder/AstAcceptNodeBuilder.java | 4 +- ...ilder.java => AstAcceptedNodeBuilder.java} | 64 ++--- .../ast/builder/AstReadAwaitNodeBuilder.java | 23 +- .../ast/builder/AstReadConfigNodeBuilder.java | 135 +++++++++- .../ast/builder/AstReadNotifyNodeBuilder.java | 23 +- .../ast/builder/AstRejectedNodeBuilder.java | 241 ++++++++++++++++++ .../ast/builder/AstScriptNodeBuilder.java | 8 +- .../internal/parser/ScriptParseStrategy.java | 51 ++++ .../internal/parser/ScriptParserImplTest.java | 32 ++- .../response.rpt | 2 + 30 files changed, 977 insertions(+), 138 deletions(-) create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/RejectedHandler.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptableNode.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstRejectedNode.java rename lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/{AbstractAstAcceptableNodeBuilder.java => AbstractAstAcceptedNodeBuilder.java} (82%) create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstRejectableNodeBuilder.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstRejectedNodeBuilder.java rename lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/{AstAcceptableNodeBuilder.java => AstAcceptedNodeBuilder.java} (83%) create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstRejectedNodeBuilder.java diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java index 4a57f2b94..fa6802b3e 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java @@ -41,6 +41,7 @@ import org.jboss.netty.channel.ChannelHandler.Sharable; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.channel.ChannelStateEvent; import org.jboss.netty.channel.Channels; import org.jboss.netty.channel.ChildChannelStateEvent; import org.jboss.netty.channel.ExceptionEvent; @@ -60,6 +61,7 @@ import org.kaazing.k3po.driver.internal.netty.bootstrap.BootstrapFactory; import org.kaazing.k3po.driver.internal.netty.bootstrap.ClientBootstrap; import org.kaazing.k3po.driver.internal.netty.bootstrap.ServerBootstrap; +import org.kaazing.k3po.driver.internal.netty.bootstrap.udp.UdpServerChannel; import org.kaazing.k3po.driver.internal.netty.channel.ChannelAddressFactory; import org.kaazing.k3po.driver.internal.netty.channel.CompositeChannelFuture; import org.kaazing.k3po.driver.internal.resolver.ClientBootstrapResolver; @@ -276,9 +278,20 @@ private ChannelFuture prepareServers() throws Exception { /* Keep track of the client channels */ server.setParentHandler(new SimpleChannelHandler() { + + @Override + public void channelBound(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception + { + super.channelBound(ctx, e); + + unbindLastStreamIfNotUdp(serverResolver, e.getChannel()); + } + @Override public void childChannelOpen(ChannelHandlerContext ctx, ChildChannelStateEvent e) throws Exception { closeableChannels.add(e.getChildChannel()); + + unbindLastStreamIfNotUdp(serverResolver, e.getChannel()); } @Override @@ -286,6 +299,13 @@ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Channel channel = ctx.getChannel(); channel.close(); } + + private void unbindLastStreamIfNotUdp(ServerBootstrapResolver serverResolver, Channel server) + { + if (!serverResolver.canAccept() && !(server instanceof UdpServerChannel)) { + server.unbind(); + } + } }); // Bind Asynchronously diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/RejectedHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/RejectedHandler.java new file mode 100644 index 000000000..32b5e2b9b --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/RejectedHandler.java @@ -0,0 +1,36 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior.handler; + +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ChannelStateEvent; + +public class RejectedHandler extends ExecutionHandler { + + @Override + public void channelBound(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception + { + super.channelBound(ctx, e); + + getHandlerFuture().setSuccess(); + } + + @Override + protected StringBuilder describe(StringBuilder sb) { + return sb.append("rejected"); + } + +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ConnectAbortedHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ConnectAbortedHandler.java index dd54508aa..683232ef7 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ConnectAbortedHandler.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ConnectAbortedHandler.java @@ -40,7 +40,7 @@ public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws E public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { - handlerFuture.setFailure(new ScriptProgressException(getRegionInfo(), "connected")); + handlerFuture.setFailure(new ScriptProgressException(getRegionInfo(), "connect not aborted")); } else { handlerFuture.setSuccess(); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java index 21c89e5b5..d5abd4cbd 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java @@ -24,6 +24,7 @@ import org.kaazing.k3po.driver.internal.behavior.visitor.AssociateStreamsVisitor.State; import org.kaazing.k3po.lang.internal.RegionInfo; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; @@ -48,6 +49,7 @@ import org.kaazing.k3po.lang.internal.ast.AstReadOptionNode; import org.kaazing.k3po.lang.internal.ast.AstReadValueNode; import org.kaazing.k3po.lang.internal.ast.AstRegionException; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; import org.kaazing.k3po.lang.internal.ast.AstStreamNode; import org.kaazing.k3po.lang.internal.ast.AstStreamableNode; @@ -121,7 +123,7 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { streamable.accept(this, state); } - for (AstAcceptedNode acceptable : acceptNode.getAcceptables()) { + for (AstAcceptableNode acceptable : acceptNode.getAcceptables()) { assert equivalent(acceptName, acceptable.getAcceptName()); acceptable.accept(this, state); } @@ -132,29 +134,57 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { } @Override - public AstScriptNode visit(AstAcceptedNode acceptableNode, State state) { + public AstScriptNode visit(AstAcceptedNode acceptedNode, State state) { - AstAcceptedNode newAcceptableNode = new AstAcceptedNode(); - newAcceptableNode.setRegionInfo(acceptableNode.getRegionInfo()); + AstAcceptedNode newAcceptedNode = new AstAcceptedNode(); + newAcceptedNode.setRegionInfo(acceptedNode.getRegionInfo()); - String acceptName = acceptableNode.getAcceptName(); + String acceptName = acceptedNode.getAcceptName(); if (acceptName == null) { acceptName = state.implicitAcceptName; } AstAcceptNode acceptNode = state.accepts.get(acceptName); if (acceptNode == null) { - RegionInfo regionInfo = acceptableNode.getRegionInfo(); + RegionInfo regionInfo = acceptedNode.getRegionInfo(); throw new AstRegionException("Accept not found for accepted").initRegionInfo(regionInfo); } - state.streamables = newAcceptableNode.getStreamables(); - for (AstStreamableNode streamable : acceptableNode.getStreamables()) { + state.streamables = newAcceptedNode.getStreamables(); + for (AstStreamableNode streamable : acceptedNode.getStreamables()) { streamable.accept(this, state); } // associate accepted stream to corresponding accept - acceptNode.getAcceptables().add(newAcceptableNode); + acceptNode.getAcceptables().add(newAcceptedNode); + + return null; + } + + @Override + public AstScriptNode visit(AstRejectedNode rejectedNode, State state) { + + AstRejectedNode newRejectedNode = new AstRejectedNode(); + newRejectedNode.setRegionInfo(rejectedNode.getRegionInfo()); + + String acceptName = rejectedNode.getAcceptName(); + if (acceptName == null) { + acceptName = state.implicitAcceptName; + } + + AstAcceptNode acceptNode = state.accepts.get(acceptName); + if (acceptNode == null) { + RegionInfo regionInfo = rejectedNode.getRegionInfo(); + throw new AstRegionException("Accept not found for accepted").initRegionInfo(regionInfo); + } + + state.streamables = newRejectedNode.getStreamables(); + for (AstStreamableNode streamable : rejectedNode.getStreamables()) { + streamable.accept(this, state); + } + + // associate accepted stream to corresponding accept + acceptNode.getAcceptables().add(newRejectedNode); return null; } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java index 1383e183e..9dda05215 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java @@ -25,7 +25,6 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -46,6 +45,7 @@ import org.kaazing.k3po.driver.internal.behavior.BehaviorSystem; import org.kaazing.k3po.driver.internal.behavior.Configuration; import org.kaazing.k3po.driver.internal.behavior.handler.CompletionHandler; +import org.kaazing.k3po.driver.internal.behavior.handler.RejectedHandler; import org.kaazing.k3po.driver.internal.behavior.handler.barrier.AwaitBarrierDownstreamHandler; import org.kaazing.k3po.driver.internal.behavior.handler.barrier.AwaitBarrierUpstreamHandler; import org.kaazing.k3po.driver.internal.behavior.handler.barrier.NotifyBarrierHandler; @@ -101,6 +101,7 @@ import org.kaazing.k3po.driver.internal.resolver.ServerBootstrapResolver; import org.kaazing.k3po.lang.internal.RegionInfo; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; @@ -124,6 +125,7 @@ import org.kaazing.k3po.lang.internal.ast.AstReadNotifyNode; import org.kaazing.k3po.lang.internal.ast.AstReadOptionNode; import org.kaazing.k3po.lang.internal.ast.AstReadValueNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; import org.kaazing.k3po.lang.internal.ast.AstStreamNode; import org.kaazing.k3po.lang.internal.ast.AstStreamableNode; @@ -281,6 +283,32 @@ public Configuration visit(AstAcceptedNode acceptedNode, State state) { return state.configuration; } + @Override + public Configuration visit(AstRejectedNode rejectedNode, State state) { + + // masking is a no-op by default for each stream + state.readUnmasker = Masker.IDENTITY_MASKER; + state.writeMasker = Masker.IDENTITY_MASKER; + + state.pipelineAsMap = new LinkedHashMap<>(); + + Map pipelineAsMap = state.pipelineAsMap; + RejectedHandler rejected = new RejectedHandler(); + String rejectedName = String.format("rejected#%d", pipelineAsMap.size() + 1); + pipelineAsMap.put(rejectedName, rejected); + + for (AstStreamableNode streamable : rejectedNode.getStreamables()) { + streamable.accept(this, state); + } + + String completionName = String.format("completion#%d", pipelineAsMap.size() + 1); + CompletionHandler completion = new CompletionHandler(); + completion.setRegionInfo(rejectedNode.getRegionInfo()); + pipelineAsMap.put(completionName, completion); + + return state.configuration; + } + @Override public Configuration visit(AstAcceptNode acceptNode, State state) { @@ -294,7 +322,7 @@ public Configuration visit(AstAcceptNode acceptNode, State state) { final List pipelines = new ArrayList<>(); state.pipelineAsMap = new LinkedHashMap<>(); - for (AstAcceptedNode acceptableNode : acceptNode.getAcceptables()) { + for (AstAcceptableNode acceptableNode : acceptNode.getAcceptables()) { acceptableNode.accept(this, state); @@ -308,19 +336,6 @@ public Configuration visit(AstAcceptNode acceptNode, State state) { state.configuration.getServerPipelines(acceptInfo).addAll(pipelines); state.configuration.getClientAndServerPipelines().addAll(pipelines); - /* - * As new connections are accepted we grab a pipeline line off the list. Note the pipelines map is ordered. Note - * that the final pipeline is just a Fail and Complete so that additional connect attempts will fail. - */ - ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() { - private final Iterator i = pipelines.iterator(); - - @Override - public ChannelPipeline getPipeline() { - return i.hasNext() ? i.next() : pipeline(); - } - }; - Map acceptOptions = new HashMap<>(); acceptOptions.put("regionInfo", acceptInfo); acceptOptions.putAll(acceptNode.getOptions()); @@ -338,7 +353,7 @@ public ChannelPipeline getPipeline() { // accept uri is available. Supplier locationResolver = acceptNode.getLocation()::getValue; ServerBootstrapResolver serverResolver = new ServerBootstrapResolver(bootstrapFactory, addressFactory, - pipelineFactory, locationResolver, optionsResolver, notifyBarrier); + pipelines, locationResolver, optionsResolver, notifyBarrier); state.configuration.getServerResolvers().add(serverResolver); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java index d9b276d18..953c8364a 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java @@ -20,6 +20,7 @@ import org.kaazing.k3po.driver.internal.behavior.visitor.InjectBarriersVisitor.State; import org.kaazing.k3po.lang.internal.RegionInfo; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; @@ -43,6 +44,7 @@ import org.kaazing.k3po.lang.internal.ast.AstReadNotifyNode; import org.kaazing.k3po.lang.internal.ast.AstReadOptionNode; import org.kaazing.k3po.lang.internal.ast.AstReadValueNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; import org.kaazing.k3po.lang.internal.ast.AstStreamNode; import org.kaazing.k3po.lang.internal.ast.AstStreamableNode; @@ -104,7 +106,7 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { streamable.accept(this, state); } - for (AstAcceptedNode acceptableNode : acceptNode.getAcceptables()) { + for (AstAcceptableNode acceptableNode : acceptNode.getAcceptables()) { acceptableNode.accept(this, state); } @@ -114,20 +116,39 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { } @Override - public AstScriptNode visit(AstAcceptedNode acceptableNode, State state) { + public AstScriptNode visit(AstAcceptedNode acceptedNode, State state) { state.readWriteState = ReadWriteState.NONE; - AstAcceptedNode newAcceptableNode = new AstAcceptedNode(); - newAcceptableNode.setRegionInfo(acceptableNode.getRegionInfo()); - newAcceptableNode.setAcceptName(acceptableNode.getAcceptName()); + AstAcceptedNode newAcceptedNode = new AstAcceptedNode(); + newAcceptedNode.setRegionInfo(acceptedNode.getRegionInfo()); + newAcceptedNode.setAcceptName(acceptedNode.getAcceptName()); - state.streamables = newAcceptableNode.getStreamables(); - for (AstStreamableNode streamable : acceptableNode.getStreamables()) { + state.streamables = newAcceptedNode.getStreamables(); + for (AstStreamableNode streamable : acceptedNode.getStreamables()) { streamable.accept(this, state); } - state.streams.add(newAcceptableNode); + state.streams.add(newAcceptedNode); + + return null; + } + + @Override + public AstScriptNode visit(AstRejectedNode rejectedNode, State state) { + + state.readWriteState = ReadWriteState.NONE; + + AstRejectedNode newRejectedNode = new AstRejectedNode(); + newRejectedNode.setRegionInfo(rejectedNode.getRegionInfo()); + newRejectedNode.setAcceptName(rejectedNode.getAcceptName()); + + state.streamables = newRejectedNode.getStreamables(); + for (AstStreamableNode streamable : rejectedNode.getStreamables()) { + streamable.accept(this, state); + } + + state.streams.add(newRejectedNode); return null; } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java index cc9e46af7..2c1ed0bf6 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java @@ -19,6 +19,7 @@ import org.kaazing.k3po.driver.internal.behavior.visitor.InjectEventsVisitor.State; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; @@ -42,6 +43,7 @@ import org.kaazing.k3po.lang.internal.ast.AstReadNotifyNode; import org.kaazing.k3po.lang.internal.ast.AstReadOptionNode; import org.kaazing.k3po.lang.internal.ast.AstReadValueNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; import org.kaazing.k3po.lang.internal.ast.AstStreamNode; import org.kaazing.k3po.lang.internal.ast.AstStreamableNode; @@ -102,7 +104,7 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { streamable.accept(this, state); } - for (AstAcceptedNode acceptable : acceptNode.getAcceptables()) { + for (AstAcceptableNode acceptable : acceptNode.getAcceptables()) { acceptable.accept(this, state); } @@ -112,20 +114,39 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { } @Override - public AstScriptNode visit(AstAcceptedNode acceptableNode, State state) { + public AstScriptNode visit(AstAcceptedNode acceptedNode, State state) { state.connectivityState = ConnectivityState.NONE; - AstAcceptedNode newAcceptableNode = new AstAcceptedNode(); - newAcceptableNode.setRegionInfo(acceptableNode.getRegionInfo()); - newAcceptableNode.setAcceptName(acceptableNode.getAcceptName()); + AstAcceptedNode newAcceptedNode = new AstAcceptedNode(); + newAcceptedNode.setRegionInfo(acceptedNode.getRegionInfo()); + newAcceptedNode.setAcceptName(acceptedNode.getAcceptName()); - state.streamables = newAcceptableNode.getStreamables(); - for (AstStreamableNode streamable : acceptableNode.getStreamables()) { + state.streamables = newAcceptedNode.getStreamables(); + for (AstStreamableNode streamable : acceptedNode.getStreamables()) { streamable.accept(this, state); } - state.streams.add(newAcceptableNode); + state.streams.add(newAcceptedNode); + + return null; + } + + @Override + public AstScriptNode visit(AstRejectedNode rejectedNode, State state) { + + state.connectivityState = ConnectivityState.NONE; + + AstRejectedNode newRejectedNode = new AstRejectedNode(); + newRejectedNode.setRegionInfo(rejectedNode.getRegionInfo()); + newRejectedNode.setAcceptName(rejectedNode.getAcceptName()); + + state.streamables = newRejectedNode.getStreamables(); + for (AstStreamableNode streamable : rejectedNode.getStreamables()) { + streamable.accept(this, state); + } + + state.streams.add(newRejectedNode); return null; } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java index a4bd4e5cf..33a1555e9 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java @@ -19,6 +19,7 @@ import org.kaazing.k3po.driver.internal.behavior.visitor.InjectFlushVisitor.State; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; @@ -42,6 +43,7 @@ import org.kaazing.k3po.lang.internal.ast.AstReadNotifyNode; import org.kaazing.k3po.lang.internal.ast.AstReadOptionNode; import org.kaazing.k3po.lang.internal.ast.AstReadValueNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; import org.kaazing.k3po.lang.internal.ast.AstStreamNode; import org.kaazing.k3po.lang.internal.ast.AstStreamableNode; @@ -104,7 +106,7 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { streamable.accept(this, state); } - for (AstAcceptedNode acceptableNode : acceptNode.getAcceptables()) { + for (AstAcceptableNode acceptableNode : acceptNode.getAcceptables()) { acceptableNode.accept(this, state); } @@ -114,21 +116,41 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { } @Override - public AstScriptNode visit(AstAcceptedNode acceptableNode, State state) { + public AstScriptNode visit(AstAcceptedNode acceptedNode, State state) { state.readState = ReadWriteState.NONE; state.writeState = ReadWriteState.NONE; - AstAcceptedNode newAcceptableNode = new AstAcceptedNode(); - newAcceptableNode.setRegionInfo(acceptableNode.getRegionInfo()); - newAcceptableNode.setAcceptName(acceptableNode.getAcceptName()); + AstAcceptedNode newAcceptedNode = new AstAcceptedNode(); + newAcceptedNode.setRegionInfo(acceptedNode.getRegionInfo()); + newAcceptedNode.setAcceptName(acceptedNode.getAcceptName()); - state.streamables = newAcceptableNode.getStreamables(); - for (AstStreamableNode streamable : acceptableNode.getStreamables()) { + state.streamables = newAcceptedNode.getStreamables(); + for (AstStreamableNode streamable : acceptedNode.getStreamables()) { streamable.accept(this, state); } - state.streams.add(newAcceptableNode); + state.streams.add(newAcceptedNode); + + return null; + } + + @Override + public AstScriptNode visit(AstRejectedNode rejectedNode, State state) { + + state.readState = ReadWriteState.NONE; + state.writeState = ReadWriteState.NONE; + + AstRejectedNode newRejectedNode = new AstRejectedNode(); + newRejectedNode.setRegionInfo(rejectedNode.getRegionInfo()); + newRejectedNode.setAcceptName(rejectedNode.getAcceptName()); + + state.streamables = newRejectedNode.getStreamables(); + for (AstStreamableNode streamable : rejectedNode.getStreamables()) { + streamable.accept(this, state); + } + + state.streams.add(newRejectedNode); return null; } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java index ddf48e3ea..ddcaf0673 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java @@ -16,6 +16,7 @@ package org.kaazing.k3po.driver.internal.behavior.visitor; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptableNode; import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstBoundNode; import org.kaazing.k3po.lang.internal.ast.AstChildClosedNode; @@ -41,6 +42,7 @@ import org.kaazing.k3po.lang.internal.ast.AstReadNotifyNode; import org.kaazing.k3po.lang.internal.ast.AstReadOptionNode; import org.kaazing.k3po.lang.internal.ast.AstReadValueNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; import org.kaazing.k3po.lang.internal.ast.AstStreamNode; import org.kaazing.k3po.lang.internal.ast.AstStreamableNode; @@ -97,7 +99,7 @@ public AstScriptNode visit(AstAcceptNode acceptNode, State state) { streamable.accept(this, state); } - for (AstAcceptedNode acceptable : acceptNode.getAcceptables()) { + for (AstAcceptableNode acceptable : acceptNode.getAcceptables()) { state.readState = StreamState.OPEN; state.writeState = StreamState.OPEN; acceptable.accept(this, state); @@ -289,9 +291,19 @@ public AstScriptNode visit(AstWriteFlushNode node, State state) { } @Override - public AstScriptNode visit(AstAcceptedNode acceptableNode, State state) { + public AstScriptNode visit(AstAcceptedNode node, State state) { - for (AstStreamableNode streamable : acceptableNode.getStreamables()) { + for (AstStreamableNode streamable : node.getStreamables()) { + streamable.accept(this, state); + } + + return null; + } + + @Override + public AstScriptNode visit(AstRejectedNode node, State state) { + + for (AstStreamableNode streamable : node.getStreamables()) { streamable.accept(this, state); } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/udp/UdpServerChannel.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/udp/UdpServerChannel.java index 3f83c93d4..dc18295a0 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/udp/UdpServerChannel.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/udp/UdpServerChannel.java @@ -34,7 +34,7 @@ * ServerBootStrap.Binder * */ -class UdpServerChannel extends AbstractServerChannel { +public class UdpServerChannel extends AbstractServerChannel { UdpServerChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { super(factory, pipeline, sink, new DefaultServerChannelConfig()); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/resolver/ServerBootstrapResolver.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/resolver/ServerBootstrapResolver.java index 637e42368..4bf481f4c 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/resolver/ServerBootstrapResolver.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/resolver/ServerBootstrapResolver.java @@ -15,10 +15,15 @@ */ package org.kaazing.k3po.driver.internal.resolver; +import static org.jboss.netty.channel.Channels.pipeline; + import java.net.URI; +import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.function.Supplier; +import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelPipelineFactory; import org.jboss.netty.logging.InternalLogger; import org.jboss.netty.logging.InternalLoggerFactory; @@ -37,6 +42,7 @@ public class ServerBootstrapResolver { private final BootstrapFactory bootstrapFactory; private final ChannelAddressFactory addressFactory; + private final Iterator pipelinesIterator; private final ChannelPipelineFactory pipelineFactory; private final Supplier locationResolver; private final OptionsResolver optionsResolver; @@ -45,20 +51,30 @@ public class ServerBootstrapResolver { private ServerBootstrap bootstrap; public ServerBootstrapResolver(BootstrapFactory bootstrapFactory, ChannelAddressFactory addressFactory, - ChannelPipelineFactory pipelineFactory, Supplier locationResolver, + List pipelines, Supplier locationResolver, OptionsResolver optionsResolver, Barrier notifyBarrier) { this.bootstrapFactory = bootstrapFactory; this.addressFactory = addressFactory; - this.pipelineFactory = pipelineFactory; + this.pipelinesIterator = pipelines.iterator(); this.locationResolver = locationResolver; this.optionsResolver = optionsResolver; this.notifyBarrier = notifyBarrier; + this.pipelineFactory = new ChannelPipelineFactory() { + @Override + public ChannelPipeline getPipeline() { + return pipelinesIterator.hasNext() ? pipelinesIterator.next() : pipeline(); + } + }; } public Barrier getNotifyBarrier() { return notifyBarrier; } + public boolean canAccept() { + return pipelinesIterator.hasNext(); + } + // TODO: asynchronous, triggered by awaitBarrier public ServerBootstrap resolve() throws Exception { if (bootstrap == null) { @@ -74,5 +90,4 @@ public ServerBootstrap resolve() throws Exception { } return bootstrap; } - } diff --git a/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 b/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 index 3ba49a684..6fc5b01bc 100644 --- a/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 +++ b/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 @@ -33,6 +33,7 @@ optionName streamNode : acceptNode | acceptedNode + | rejectedNode | connectNode ; @@ -53,6 +54,10 @@ acceptedNode : AcceptedKeyword ( text=Name )? streamableNode+ ; +rejectedNode + : RejectedKeyword ( text=Name )? rejectableNode* + ; + connectNode : ConnectKeyword (AwaitKeyword await=Name)? @@ -106,6 +111,11 @@ streamableNode | optionNode ; +rejectableNode + : barrierNode + | readConfigNode + ; + commandNode : connectAbortNode | writeConfigNode @@ -456,6 +466,10 @@ ReadKeyword : 'read' ; +RejectedKeyword + : 'rejected' + ; + ShortKeyword : 'short' ; diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptNode.java index 6d793d244..617c1ac21 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptNode.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptNode.java @@ -30,7 +30,7 @@ public class AstAcceptNode extends AstStreamNode { private String acceptName; private String notifyName; private Map options; - private List acceptables; + private List acceptables; private AstValue location; @@ -77,7 +77,7 @@ public Map getOptions() { return options; } - public List getAcceptables() { + public List getAcceptables() { if (acceptables == null) { acceptables = new LinkedList<>(); } @@ -139,7 +139,7 @@ protected void describe(StringBuilder buf) { super.describe(buf); if (acceptables != null) { - for (AstAcceptedNode acceptable : acceptables) { + for (AstAcceptableNode acceptable : acceptables) { acceptable.describe(buf); } } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptableNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptableNode.java new file mode 100644 index 000000000..9b65535d2 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptableNode.java @@ -0,0 +1,53 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast; + +import static org.kaazing.k3po.lang.internal.ast.util.AstUtil.equivalent; + +public abstract class AstAcceptableNode extends AstStreamNode { + + private String acceptName; + + public String getAcceptName() { + return acceptName; + } + + public void setAcceptName(String acceptName) { + this.acceptName = acceptName; + } + + @Override + protected int hashTo() { + int hashCode = super.hashTo(); + + if (acceptName != null) { + hashCode <<= 4; + hashCode ^= acceptName.hashCode(); + } + + return hashCode; + } + + @Override + protected boolean equalTo(AstRegion that) { + return that instanceof AstAcceptableNode && equalTo((AstAcceptableNode) that); + } + + protected boolean equalTo(AstAcceptableNode that) { + return super.equalTo(that) && equivalent(this.acceptName, that.acceptName); + } + +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptedNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptedNode.java index 84527006d..4de687e48 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptedNode.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstAcceptedNode.java @@ -15,35 +15,11 @@ */ package org.kaazing.k3po.lang.internal.ast; -import static org.kaazing.k3po.lang.internal.ast.util.AstUtil.equivalent; - -public class AstAcceptedNode extends AstStreamNode { - - private String acceptName; - - public String getAcceptName() { - return acceptName; - } - - public void setAcceptName(String acceptName) { - this.acceptName = acceptName; - } - - @Override - protected int hashTo() { - int hashCode = super.hashTo(); - - if (acceptName != null) { - hashCode <<= 4; - hashCode ^= acceptName.hashCode(); - } - - return hashCode; - } +public class AstAcceptedNode extends AstAcceptableNode { @Override - protected boolean equalTo(AstRegion that) { - return that instanceof AstAcceptedNode && equalTo((AstAcceptedNode) that); + protected boolean equalTo(AstAcceptableNode that) { + return that instanceof AstAcceptedNode && super.equalTo((AstAcceptedNode) that); } @Override @@ -57,6 +33,7 @@ protected void describeLine(StringBuilder sb) { sb.append("accepted"); + String acceptName = getAcceptName(); if (acceptName != null) { sb.append(" as "); sb.append(acceptName); @@ -64,9 +41,4 @@ protected void describeLine(StringBuilder sb) { sb.append('\n'); } - - protected boolean equalTo(AstAcceptedNode that) { - return super.equalTo(that) && equivalent(this.acceptName, that.acceptName); - } - } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java index 9c438db75..820ee438b 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java @@ -25,6 +25,7 @@ public interface Visitor { R visit(AstPropertyNode node, P parameter); R visit(AstAcceptNode node, P parameter); R visit(AstAcceptedNode node, P parameter); + R visit(AstRejectedNode node, P parameter); R visit(AstConnectNode node, P parameter); R visit(AstConnectAbortNode node, P parameter); diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstRejectedNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstRejectedNode.java new file mode 100644 index 000000000..f6a5737c7 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstRejectedNode.java @@ -0,0 +1,44 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast; + +public class AstRejectedNode extends AstAcceptableNode { + + @Override + protected boolean equalTo(AstAcceptableNode that) { + return that instanceof AstRejectedNode && super.equalTo((AstRejectedNode) that); + } + + @Override + public R accept(Visitor visitor, P parameter) { + return visitor.visit(this, parameter); + } + + @Override + protected void describeLine(StringBuilder sb) { + super.describeLine(sb); + + sb.append("rejected"); + + String acceptName = getAcceptName(); + if (acceptName != null) { + sb.append(" as "); + sb.append(acceptName); + } + + sb.append('\n'); + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstAcceptableNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstAcceptedNodeBuilder.java similarity index 82% rename from lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstAcceptableNodeBuilder.java rename to lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstAcceptedNodeBuilder.java index 2f93f7292..26fb3b7b7 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstAcceptableNodeBuilder.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstAcceptedNodeBuilder.java @@ -17,14 +17,14 @@ import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; -public abstract class AbstractAstAcceptableNodeBuilder +public abstract class AbstractAstAcceptedNodeBuilder extends AbstractAstStreamNodeBuilder { - public AbstractAstAcceptableNodeBuilder(R result) { + public AbstractAstAcceptedNodeBuilder(R result) { super(new AstAcceptedNode(), result); } - protected AbstractAstAcceptableNodeBuilder(AstAcceptedNode node, R result) { + protected AbstractAstAcceptedNodeBuilder(AstAcceptedNode node, R result) { super(node, result); } } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstRejectableNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstRejectableNodeBuilder.java new file mode 100644 index 000000000..6d8e8d536 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstRejectableNodeBuilder.java @@ -0,0 +1,25 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast.builder; + +import org.kaazing.k3po.lang.internal.ast.AstNode; + +public abstract class AbstractAstRejectableNodeBuilder extends AbstractAstStreamableNodeBuilder { + + public AbstractAstRejectableNodeBuilder(N node, R result) { + super(node, result); + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstRejectedNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstRejectedNodeBuilder.java new file mode 100644 index 000000000..4d1fdef43 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AbstractAstRejectedNodeBuilder.java @@ -0,0 +1,41 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast.builder; + +import org.kaazing.k3po.lang.internal.ast.AstReadAwaitNode; +import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; +import org.kaazing.k3po.lang.internal.ast.AstReadNotifyNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; + +public abstract class AbstractAstRejectedNodeBuilder extends AbstractAstNodeBuilder { + + public AbstractAstRejectedNodeBuilder(R result) { + super(new AstRejectedNode(), result); + } + + public abstract AbstractAstRejectableNodeBuilder> + addReadAwaitBarrier(); + + public abstract AbstractAstRejectableNodeBuilder> + addReadNotifyBarrier(); + + public abstract AbstractAstRejectableNodeBuilder> + addReadConfigEvent(); + + protected AbstractAstRejectedNodeBuilder(AstRejectedNode node, R result) { + super(node, result); + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptNodeBuilder.java index 7f1e75bd7..8bec3e11c 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptNodeBuilder.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptNodeBuilder.java @@ -134,8 +134,8 @@ public ScriptNested setOption(String optionName, AstValue optionValue) return this; } - public AstAcceptableNodeBuilder.AcceptNested> addAcceptedStream() { - return new AstAcceptableNodeBuilder.AcceptNested<>(this); + public AstAcceptedNodeBuilder.AcceptNested> addAcceptedStream() { + return new AstAcceptedNodeBuilder.AcceptNested<>(this); } @Override diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptableNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptedNodeBuilder.java similarity index 83% rename from lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptableNodeBuilder.java rename to lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptedNodeBuilder.java index 5185c4f7b..0b41a5849 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptableNodeBuilder.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstAcceptedNodeBuilder.java @@ -19,119 +19,119 @@ import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; -public final class AstAcceptableNodeBuilder extends AbstractAstAcceptableNodeBuilder { +public final class AstAcceptedNodeBuilder extends AbstractAstAcceptedNodeBuilder { - public AstAcceptableNodeBuilder() { + public AstAcceptedNodeBuilder() { this(new AstAcceptedNode()); } - public AstAcceptableNodeBuilder setAcceptName(String acceptName) { + public AstAcceptedNodeBuilder setAcceptName(String acceptName) { node.setAcceptName(acceptName); return this; } @Override - public AstOpenedNodeBuilder.StreamNested addOpenedEvent() { + public AstOpenedNodeBuilder.StreamNested addOpenedEvent() { return new AstOpenedNodeBuilder.StreamNested<>(this); } @Override - public AstBoundNodeBuilder.StreamNested addBoundEvent() { + public AstBoundNodeBuilder.StreamNested addBoundEvent() { return new AstBoundNodeBuilder.StreamNested<>(this); } @Override - public AstConnectedNodeBuilder.StreamNested addConnectedEvent() { + public AstConnectedNodeBuilder.StreamNested addConnectedEvent() { return new AstConnectedNodeBuilder.StreamNested<>(this); } @Override - public AstReadNodeBuilder.StreamNested addReadEvent() { + public AstReadNodeBuilder.StreamNested addReadEvent() { return new AstReadNodeBuilder.StreamNested<>(this); } @Override - public AstDisconnectedNodeBuilder.StreamNested addDisconnectedEvent() { + public AstDisconnectedNodeBuilder.StreamNested addDisconnectedEvent() { return new AstDisconnectedNodeBuilder.StreamNested<>(this); } @Override - public AstUnboundNodeBuilder.StreamNested addUnboundEvent() { + public AstUnboundNodeBuilder.StreamNested addUnboundEvent() { return new AstUnboundNodeBuilder.StreamNested<>(this); } @Override - public AstClosedNodeBuilder.StreamNested addClosedEvent() { + public AstClosedNodeBuilder.StreamNested addClosedEvent() { return new AstClosedNodeBuilder.StreamNested<>(this); } @Override - public AstWriteNodeBuilder.StreamNested addWriteCommand() { + public AstWriteNodeBuilder.StreamNested addWriteCommand() { return new AstWriteNodeBuilder.StreamNested<>(this); } @Override - public AstDisconnectNodeBuilder.StreamNested addDisconnectCommand() { + public AstDisconnectNodeBuilder.StreamNested addDisconnectCommand() { return new AstDisconnectNodeBuilder.StreamNested<>(this); } @Override - public AstUnbindNodeBuilder.StreamNested addUnbindCommand() { + public AstUnbindNodeBuilder.StreamNested addUnbindCommand() { return new AstUnbindNodeBuilder.StreamNested<>(this); } @Override - public AstCloseNodeBuilder.StreamNested addCloseCommand() { + public AstCloseNodeBuilder.StreamNested addCloseCommand() { return new AstCloseNodeBuilder.StreamNested<>(this); } @Override - public AstWriteAbortNodeBuilder.StreamNested addWriteAbortCommand() { + public AstWriteAbortNodeBuilder.StreamNested addWriteAbortCommand() { return new AstWriteAbortNodeBuilder.StreamNested<>(this); } @Override - public AstReadAbortedNodeBuilder.StreamNested addReadAbortedEvent() { + public AstReadAbortedNodeBuilder.StreamNested addReadAbortedEvent() { return new AstReadAbortedNodeBuilder.StreamNested<>(this); } @Override - public AstReadAbortNodeBuilder.StreamNested addReadAbortCommand() { + public AstReadAbortNodeBuilder.StreamNested addReadAbortCommand() { return new AstReadAbortNodeBuilder.StreamNested<>(this); } @Override - public AstWriteAbortedNodeBuilder.StreamNested addWriteAbortedEvent() { + public AstWriteAbortedNodeBuilder.StreamNested addWriteAbortedEvent() { return new AstWriteAbortedNodeBuilder.StreamNested<>(this); } @Override - public AstReadAwaitNodeBuilder.StreamNested addReadAwaitBarrier() { + public AstReadAwaitNodeBuilder.StreamNested addReadAwaitBarrier() { return new AstReadAwaitNodeBuilder.StreamNested<>(this); } @Override - public AstReadNotifyNodeBuilder.StreamNested addReadNotifyBarrier() { + public AstReadNotifyNodeBuilder.StreamNested addReadNotifyBarrier() { return new AstReadNotifyNodeBuilder.StreamNested<>(this); } @Override - public AstWriteAwaitNodeBuilder.StreamNested addWriteAwaitBarrier() { + public AstWriteAwaitNodeBuilder.StreamNested addWriteAwaitBarrier() { return new AstWriteAwaitNodeBuilder.StreamNested<>(this); } @Override - public AstWriteNotifyNodeBuilder.StreamNested addWriteNotifyBarrier() { + public AstWriteNotifyNodeBuilder.StreamNested addWriteNotifyBarrier() { return new AstWriteNotifyNodeBuilder.StreamNested<>(this); } @Override - public AstReadOptionNodeBuilder.StreamNested addReadOption() { + public AstReadOptionNodeBuilder.StreamNested addReadOption() { return new AstReadOptionNodeBuilder.StreamNested<>(this); } @Override - public AstWriteOptionNodeBuilder.StreamNested addWriteOption() { + public AstWriteOptionNodeBuilder.StreamNested addWriteOption() { return new AstWriteOptionNodeBuilder.StreamNested<>(this); } @@ -140,37 +140,37 @@ public AstAcceptedNode done() { return result; } - private AstAcceptableNodeBuilder(AstAcceptedNode node) { + private AstAcceptedNodeBuilder(AstAcceptedNode node) { super(node, node); } @Override - public AstReadConfigNodeBuilder.StreamNested addReadConfigEvent() { + public AstReadConfigNodeBuilder.StreamNested addReadConfigEvent() { return new AstReadConfigNodeBuilder.StreamNested<>(this); } @Override - public AstWriteConfigNodeBuilder.StreamNested addWriteConfigCommand() { + public AstWriteConfigNodeBuilder.StreamNested addWriteConfigCommand() { return new AstWriteConfigNodeBuilder.StreamNested<>(this); } @Override - public AstFlushNodeBuilder.StreamNested addFlushCommand() { + public AstFlushNodeBuilder.StreamNested addFlushCommand() { return new AstFlushNodeBuilder.StreamNested<>(this); } @Override - public AstReadClosedNodeBuilder.StreamNested addReadCloseCommand() { + public AstReadClosedNodeBuilder.StreamNested addReadCloseCommand() { return new AstReadClosedNodeBuilder.StreamNested<>(this); } @Override - public AstWriteCloseNodeBuilder.StreamNested addWriteCloseCommand() { + public AstWriteCloseNodeBuilder.StreamNested addWriteCloseCommand() { return new AstWriteCloseNodeBuilder.StreamNested<>(this); } public static final class ScriptNested> extends - AbstractAstAcceptableNodeBuilder { + AbstractAstAcceptedNodeBuilder { public ScriptNested(R builder) { super(builder); @@ -320,7 +320,7 @@ public AstWriteOptionNodeBuilder.StreamNested> addWriteOption() } public static final class AcceptNested> extends - AbstractAstAcceptableNodeBuilder { + AbstractAstAcceptedNodeBuilder { public AcceptNested(R builder) { super(builder); diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAwaitNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAwaitNodeBuilder.java index 82c923b64..d9e50a11c 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAwaitNodeBuilder.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAwaitNodeBuilder.java @@ -16,9 +16,10 @@ package org.kaazing.k3po.lang.internal.ast.builder; import org.kaazing.k3po.lang.internal.ast.AstReadAwaitNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstStreamNode; -public class AstReadAwaitNodeBuilder extends AbstractAstStreamableNodeBuilder { +public class AstReadAwaitNodeBuilder extends AbstractAstRejectableNodeBuilder { public AstReadAwaitNodeBuilder() { this(new AstReadAwaitNode()); @@ -57,4 +58,24 @@ public R done() { return result; } } + + public static class RejectedNested> extends + AbstractAstRejectableNodeBuilder { + + public RejectedNested(R builder) { + super(new AstReadAwaitNode(), builder); + } + + public RejectedNested setBarrierName(String barrierName) { + node.setBarrierName(barrierName); + return this; + } + + @Override + public R done() { + AstRejectedNode streamNode = result.node; + streamNode.getStreamables().add(node); + return result; + } + } } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadConfigNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadConfigNodeBuilder.java index 109513ce8..1da1e84e9 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadConfigNodeBuilder.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadConfigNodeBuilder.java @@ -18,6 +18,7 @@ import javax.el.ValueExpression; import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstStreamNode; import org.kaazing.k3po.lang.internal.ast.matcher.AstExactBytesMatcher; import org.kaazing.k3po.lang.internal.ast.matcher.AstExactTextMatcher; @@ -29,7 +30,7 @@ import org.kaazing.k3po.lang.internal.regex.NamedGroupPattern; import org.kaazing.k3po.lang.types.StructuredTypeInfo; -public class AstReadConfigNodeBuilder extends AbstractAstStreamableNodeBuilder { +public class AstReadConfigNodeBuilder extends AbstractAstRejectableNodeBuilder { public AstReadConfigNodeBuilder() { this(new AstReadConfigNode()); @@ -250,4 +251,136 @@ public R done() { return result; } } + + public static class RejectedNested> + extends AbstractAstRejectableNodeBuilder + { + + public RejectedNested(R builder) + { + super(new AstReadConfigNode(), builder); + } + + public RejectedNested setType(StructuredTypeInfo type) + { + node.setType(type); + return this; + } + + public RejectedNested setMissing(boolean missing) + { + node.setMissing(missing); + return this; + } + + public RejectedNested setMatcherFixedLengthBytes(String name, int valueLength) + { + node.setMatcher(name, new AstFixedLengthBytesMatcher(valueLength)); + return this; + } + + public RejectedNested setMatcherExactText(String name, String valueExactText) + { + node.setMatcher(name, new AstExactTextMatcher(valueExactText)); + return this; + } + + public RejectedNested setMatcherExactBytes(String name, byte[] valueBytes, ExpressionContext environment) + { + node.setMatcher(name, new AstExactBytesMatcher(valueBytes)); + return this; + } + + public RejectedNested setMatcherExpression(String name, ValueExpression valueValueExpression, + ExpressionContext environment) + { + node.setMatcher(name, new AstExpressionMatcher(valueValueExpression, environment)); + return this; + } + + public RejectedNested setMatcherFixedLengthBytes(String name, int valueLength, String valueCaptureName, + ExpressionContext environment) + { + node.setMatcher(name, new AstFixedLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public RejectedNested setMatcherRegex(String name, NamedGroupPattern valuePattern, ExpressionContext environment) + { + node.setMatcher(name, new AstRegexMatcher(valuePattern, environment)); + return this; + } + + public RejectedNested setMatcherVariableLengthBytes(String name, ValueExpression valueLength, + ExpressionContext environment) + { + node.setMatcher(name, new AstVariableLengthBytesMatcher(valueLength, environment)); + return this; + } + + public RejectedNested setMatcherVariableLengthBytes(String name, ValueExpression valueLength, String valueCaptureName, + ExpressionContext environment) + { + node.setMatcher(name, new AstVariableLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public RejectedNested addMatcherFixedLengthBytes(int valueLength) + { + node.addMatcher(new AstFixedLengthBytesMatcher(valueLength)); + return this; + } + + public RejectedNested addMatcherExactText(String valueExactText) + { + node.addMatcher(new AstExactTextMatcher(valueExactText)); + return this; + } + + public RejectedNested addMatcherExactBytes(byte[] valueBytes, ExpressionContext environment) + { + node.addMatcher(new AstExactBytesMatcher(valueBytes)); + return this; + } + + public RejectedNested addMatcherExpression(ValueExpression valueValueExpression, ExpressionContext environment) + { + node.addMatcher(new AstExpressionMatcher(valueValueExpression, environment)); + return this; + } + + public RejectedNested addMatcherFixedLengthBytes(int valueLength, String valueCaptureName, ExpressionContext environment) + { + node.addMatcher(new AstFixedLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public RejectedNested addMatcherRegex(NamedGroupPattern valuePattern, ExpressionContext environment) + { + node.addMatcher(new AstRegexMatcher(valuePattern, environment)); + return this; + } + + public RejectedNested addMatcherVariableLengthBytes(ValueExpression valueLength, ExpressionContext environment) + { + node.addMatcher(new AstVariableLengthBytesMatcher(valueLength, environment)); + return this; + } + + public RejectedNested addMatcherVariableLengthBytes(ValueExpression valueLength, String valueCaptureName, + ExpressionContext environment) + { + node.addMatcher(new AstVariableLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + @Override + public R done() + { + AstRejectedNode streamNode = node(result); + streamNode.getStreamables().add(node); + return result; + } + } + } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadNotifyNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadNotifyNodeBuilder.java index 6e441539e..f60566b71 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadNotifyNodeBuilder.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadNotifyNodeBuilder.java @@ -16,9 +16,10 @@ package org.kaazing.k3po.lang.internal.ast.builder; import org.kaazing.k3po.lang.internal.ast.AstReadNotifyNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstStreamNode; -public class AstReadNotifyNodeBuilder extends AbstractAstStreamableNodeBuilder { +public class AstReadNotifyNodeBuilder extends AbstractAstRejectableNodeBuilder { public AstReadNotifyNodeBuilder() { this(new AstReadNotifyNode()); @@ -58,4 +59,24 @@ public R done() { } } + + public static class RejectedNested> extends + AbstractAstRejectableNodeBuilder { + + public RejectedNested(R builder) { + super(new AstReadNotifyNode(), builder); + } + + public RejectedNested setBarrierName(String barrierName) { + node.setBarrierName(barrierName); + return this; + } + + @Override + public R done() { + AstRejectedNode streamNode = result.node; + streamNode.getStreamables().add(node); + return result; + } + } } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstRejectedNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstRejectedNodeBuilder.java new file mode 100644 index 000000000..83fddea1b --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstRejectedNodeBuilder.java @@ -0,0 +1,241 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast.builder; + +import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; +import org.kaazing.k3po.lang.internal.ast.AstScriptNode; + +public final class AstRejectedNodeBuilder extends AbstractAstRejectedNodeBuilder { + + public AstRejectedNodeBuilder() { + this(new AstRejectedNode()); + } + + public AstRejectedNodeBuilder setAcceptName(String acceptName) { + node.setAcceptName(acceptName); + return this; + } + + @Override + public AstReadAwaitNodeBuilder.RejectedNested addReadAwaitBarrier() { + return new AstReadAwaitNodeBuilder.RejectedNested<>(this); + } + + @Override + public AstReadNotifyNodeBuilder.RejectedNested addReadNotifyBarrier() { + return new AstReadNotifyNodeBuilder.RejectedNested<>(this); + } + + @Override + public AstReadConfigNodeBuilder.RejectedNested addReadConfigEvent() { + return new AstReadConfigNodeBuilder.RejectedNested<>(this); + } + + @Override + public AstRejectedNode done() { + return result; + } + + private AstRejectedNodeBuilder(AstRejectedNode node) { + super(node, node); + } + + public static final class ScriptNested> extends + AbstractAstRejectedNodeBuilder { + + public ScriptNested(R builder) { + super(builder); + } + + public ScriptNested setAcceptName(String acceptName) { + node.setAcceptName(acceptName); + return this; + } + + @Override + public AstReadAwaitNodeBuilder.RejectedNested> addReadAwaitBarrier() { + return new AstReadAwaitNodeBuilder.RejectedNested<>(this); + } + + @Override + public AstReadNotifyNodeBuilder.RejectedNested> addReadNotifyBarrier() { + return new AstReadNotifyNodeBuilder.RejectedNested<>(this); + } + + @Override + public AstReadConfigNodeBuilder.RejectedNested> addReadConfigEvent() { + return new AstReadConfigNodeBuilder.RejectedNested<>(this); + } + + @Override + public R done() { + AstScriptNode scriptNode = result.node; + scriptNode.getStreams().add(node); + return result; + } + } + + public static final class AcceptNested> extends + AbstractAstAcceptedNodeBuilder { + + public AcceptNested(R builder) { + super(builder); + } + + public AcceptNested setAcceptName(String acceptName) { + node.setAcceptName(acceptName); + return this; + } + + @Override + public AstOpenedNodeBuilder.StreamNested> addOpenedEvent() { + return new AstOpenedNodeBuilder.StreamNested<>(this); + } + + @Override + public AstBoundNodeBuilder.StreamNested> addBoundEvent() { + return new AstBoundNodeBuilder.StreamNested<>(this); + } + + @Override + public AstConnectedNodeBuilder.StreamNested> addConnectedEvent() { + return new AstConnectedNodeBuilder.StreamNested<>(this); + } + + @Override + public AstReadNodeBuilder.StreamNested> addReadEvent() { + return new AstReadNodeBuilder.StreamNested<>(this); + } + + @Override + public AstDisconnectedNodeBuilder.StreamNested> addDisconnectedEvent() { + return new AstDisconnectedNodeBuilder.StreamNested<>(this); + } + + @Override + public AstUnboundNodeBuilder.StreamNested> addUnboundEvent() { + return new AstUnboundNodeBuilder.StreamNested<>(this); + } + + @Override + public AstClosedNodeBuilder.StreamNested> addClosedEvent() { + return new AstClosedNodeBuilder.StreamNested<>(this); + } + + @Override + public AstWriteNodeBuilder.StreamNested> addWriteCommand() { + return new AstWriteNodeBuilder.StreamNested<>(this); + } + + @Override + public AstDisconnectNodeBuilder.StreamNested> addDisconnectCommand() { + return new AstDisconnectNodeBuilder.StreamNested<>(this); + } + + @Override + public AstUnbindNodeBuilder.StreamNested> addUnbindCommand() { + return new AstUnbindNodeBuilder.StreamNested<>(this); + } + + @Override + public AstCloseNodeBuilder.StreamNested> addCloseCommand() { + return new AstCloseNodeBuilder.StreamNested<>(this); + } + + @Override + public AstWriteAbortNodeBuilder.StreamNested> addWriteAbortCommand() { + return new AstWriteAbortNodeBuilder.StreamNested<>(this); + } + + @Override + public AstReadAbortedNodeBuilder.StreamNested> addReadAbortedEvent() { + return new AstReadAbortedNodeBuilder.StreamNested<>(this); + } + + @Override + public AstReadAbortNodeBuilder.StreamNested> addReadAbortCommand() { + return new AstReadAbortNodeBuilder.StreamNested<>(this); + } + + @Override + public AstWriteAbortedNodeBuilder.StreamNested> addWriteAbortedEvent() { + return new AstWriteAbortedNodeBuilder.StreamNested<>(this); + } + + @Override + public AstReadAwaitNodeBuilder.StreamNested> addReadAwaitBarrier() { + return new AstReadAwaitNodeBuilder.StreamNested<>(this); + } + + @Override + public AstReadNotifyNodeBuilder.StreamNested> addReadNotifyBarrier() { + return new AstReadNotifyNodeBuilder.StreamNested<>(this); + } + + @Override + public AstWriteAwaitNodeBuilder.StreamNested> addWriteAwaitBarrier() { + return new AstWriteAwaitNodeBuilder.StreamNested<>(this); + } + + @Override + public AstWriteNotifyNodeBuilder.StreamNested> addWriteNotifyBarrier() { + return new AstWriteNotifyNodeBuilder.StreamNested<>(this); + } + + @Override + public R done() { + AstAcceptNode acceptNode = result.node; + acceptNode.getAcceptables().add(node); + return result; + } + + @Override + public AstReadOptionNodeBuilder.StreamNested> addReadOption() { + return new AstReadOptionNodeBuilder.StreamNested<>(this); + } + + @Override + public AstWriteOptionNodeBuilder.StreamNested> addWriteOption() { + return new AstWriteOptionNodeBuilder.StreamNested<>(this); + } + + @Override + public AstReadConfigNodeBuilder.StreamNested> addReadConfigEvent() { + return new AstReadConfigNodeBuilder.StreamNested<>(this); + } + + @Override + public AstWriteConfigNodeBuilder.StreamNested> addWriteConfigCommand() { + return new AstWriteConfigNodeBuilder.StreamNested<>(this); + } + + @Override + public AstFlushNodeBuilder.StreamNested> addFlushCommand() { + return new AstFlushNodeBuilder.StreamNested<>(this); + } + + @Override + public AstReadClosedNodeBuilder.StreamNested> addReadCloseCommand() { + return new AstReadClosedNodeBuilder.StreamNested<>(this); + } + + @Override + public AstWriteCloseNodeBuilder.StreamNested> addWriteCloseCommand() { + return new AstWriteCloseNodeBuilder.StreamNested<>(this); + } + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstScriptNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstScriptNodeBuilder.java index ed883c12c..fb2ddaa42 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstScriptNodeBuilder.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstScriptNodeBuilder.java @@ -35,8 +35,12 @@ public AstAcceptNodeBuilder.ScriptNested addAcceptStream() return new AstAcceptNodeBuilder.ScriptNested<>(this); } - public AstAcceptableNodeBuilder.ScriptNested addAcceptedStream() { - return new AstAcceptableNodeBuilder.ScriptNested<>(this); + public AstAcceptedNodeBuilder.ScriptNested addAcceptedStream() { + return new AstAcceptedNodeBuilder.ScriptNested<>(this); + } + + public AstRejectedNodeBuilder.ScriptNested addRejectedStream() { + return new AstRejectedNodeBuilder.ScriptNested<>(this); } public AstConnectNodeBuilder.ScriptNested addConnectStream() { diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java index 82aacb006..9a78c32e0 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java @@ -62,6 +62,7 @@ import org.kaazing.k3po.lang.internal.ast.AstReadOptionNode; import org.kaazing.k3po.lang.internal.ast.AstReadValueNode; import org.kaazing.k3po.lang.internal.ast.AstRegion; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; import org.kaazing.k3po.lang.internal.ast.AstStreamNode; import org.kaazing.k3po.lang.internal.ast.AstStreamableNode; @@ -144,6 +145,8 @@ import org.kaazing.k3po.lang.parser.v2.RobotParser.ReadNotifyNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ReadOptionNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.RegexMatcherContext; +import org.kaazing.k3po.lang.parser.v2.RobotParser.RejectableNodeContext; +import org.kaazing.k3po.lang.parser.v2.RobotParser.RejectedNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ScriptNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ServerStreamableNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.StreamNodeContext; @@ -262,6 +265,14 @@ public AstAcceptedNode parse(RobotParser parser, ExpressionFactory factory, Expr } }; + public static final ScriptParseStrategy REJECTED = new ScriptParseStrategy() { + @Override + public AstRejectedNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) + throws RecognitionException { + return new AstRejectedNodeVisitor(factory, environment).visit(parser.rejectedNode()); + } + }; + public static final ScriptParseStrategy CONNECT = new ScriptParseStrategy() { @Override public AstConnectNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) @@ -734,6 +745,16 @@ public AstAcceptedNode visitAcceptedNode(AcceptedNodeContext ctx) { return acceptedNode; } + @Override + public AstRejectedNode visitRejectedNode(RejectedNodeContext ctx) { + AstRejectedNodeVisitor visitor = new AstRejectedNodeVisitor(factory, environment); + AstRejectedNode rejectedNode = visitor.visitRejectedNode(ctx); + if (rejectedNode != null) { + childInfos().add(rejectedNode.getRegionInfo()); + } + return rejectedNode; + } + @Override public AstConnectNode visitConnectNode(ConnectNodeContext ctx) { AstConnectNodeVisitor visitor = new AstConnectNodeVisitor(factory, environment); @@ -828,6 +849,36 @@ public AstAcceptedNode visitStreamableNode(StreamableNodeContext ctx) { } + private static class AstRejectedNodeVisitor extends AstNodeVisitor { + + public AstRejectedNodeVisitor(ExpressionFactory factory, ExpressionContext environment) { + super(factory, environment); + } + + @Override + public AstRejectedNode visitRejectedNode(RejectedNodeContext ctx) { + node = new AstRejectedNode(); + if (ctx.text != null) { + node.setAcceptName(ctx.text.getText()); + } + super.visitRejectedNode(ctx); + node.setRegionInfo(asParallelRegion(childInfos, ctx)); + return node; + } + + @Override + public AstRejectedNode visitRejectableNode(RejectableNodeContext ctx) { + AstStreamableNodeVisitor visitor = new AstStreamableNodeVisitor(factory, environment); + AstStreamableNode rejectableNode = visitor.visitRejectableNode(ctx); + if (rejectableNode != null) { + node.getStreamables().add(rejectableNode); + childInfos().add(rejectableNode.getRegionInfo()); + } + return node; + } + + } + private static class AstConnectNodeVisitor extends AstNodeVisitor { public AstConnectNodeVisitor(ExpressionFactory factory, ExpressionContext environment) { diff --git a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java index 5c41575b7..03e4b39b9 100644 --- a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java +++ b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java @@ -17,6 +17,7 @@ import static org.junit.Assert.assertEquals; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.ACCEPT; +import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.ACCEPTED; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.CLOSE; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.CLOSED; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.CONNECTED; @@ -35,6 +36,7 @@ import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ_CONFIG; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ_NOTIFY; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ_OPTION; +import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.REJECTED; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.SCRIPT; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.VARIABLE_LENGTH_BYTES_MATCHER; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.WRITE; @@ -63,6 +65,7 @@ import org.junit.Ignore; import org.junit.Test; import org.kaazing.k3po.lang.internal.ast.AstAcceptNode; +import org.kaazing.k3po.lang.internal.ast.AstAcceptedNode; import org.kaazing.k3po.lang.internal.ast.AstCloseNode; import org.kaazing.k3po.lang.internal.ast.AstClosedNode; import org.kaazing.k3po.lang.internal.ast.AstConnectAbortNode; @@ -76,6 +79,7 @@ import org.kaazing.k3po.lang.internal.ast.AstReadNotifyNode; import org.kaazing.k3po.lang.internal.ast.AstReadOptionNode; import org.kaazing.k3po.lang.internal.ast.AstReadValueNode; +import org.kaazing.k3po.lang.internal.ast.AstRejectedNode; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortedNode; @@ -85,6 +89,7 @@ import org.kaazing.k3po.lang.internal.ast.AstWriteOptionNode; import org.kaazing.k3po.lang.internal.ast.AstWriteValueNode; import org.kaazing.k3po.lang.internal.ast.builder.AstAcceptNodeBuilder; +import org.kaazing.k3po.lang.internal.ast.builder.AstAcceptedNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstCloseNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstClosedNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstConnectAbortNodeBuilder; @@ -98,6 +103,7 @@ import org.kaazing.k3po.lang.internal.ast.builder.AstReadNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstReadNotifyNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstReadOptionNodeBuilder; +import org.kaazing.k3po.lang.internal.ast.builder.AstRejectedNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstScriptNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstWriteAbortNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstWriteAbortedNodeBuilder; @@ -868,14 +874,32 @@ public void shouldParseAcceptWithQueryStringAndPathSegmentParameter() throws Exc assertEquals(expected, actual); } - @Test( - expected = ScriptParseException.class) + @Test(expected = ScriptParseException.class) public void shouldNotParseAcceptedWithoutBehavior() throws Exception { - String script = "accepted"; + String scriptFragment = "accepted"; ScriptParserImpl parser = new ScriptParserImpl(); - parser.parseWithStrategy(script, SCRIPT); + AstAcceptedNode actual = parser.parseWithStrategy(scriptFragment, ACCEPTED); + + AstAcceptedNode expected = new AstAcceptedNodeBuilder() + .done(); + + assertEquals(expected, actual); + } + + @Test + public void shouldParseRejected() throws Exception { + + String scriptFragment = "rejected"; + + ScriptParserImpl parser = new ScriptParserImpl(); + AstRejectedNode actual = parser.parseWithStrategy(scriptFragment, REJECTED); + + AstRejectedNode expected = new AstRejectedNodeBuilder() + .done(); + + assertEquals(expected, actual); } @Test diff --git a/specification/turn/src/main/scripts/org/kaazing/specification/turn/allocations/incorrect.allocation.method.wrong.magic.cookie.udp/response.rpt b/specification/turn/src/main/scripts/org/kaazing/specification/turn/allocations/incorrect.allocation.method.wrong.magic.cookie.udp/response.rpt index cf06197e8..0e0648b1c 100644 --- a/specification/turn/src/main/scripts/org/kaazing/specification/turn/allocations/incorrect.allocation.method.wrong.magic.cookie.udp/response.rpt +++ b/specification/turn/src/main/scripts/org/kaazing/specification/turn/allocations/incorrect.allocation.method.wrong.magic.cookie.udp/response.rpt @@ -19,3 +19,5 @@ property nonce "adl7W7PeDU4hKE72jdaQvbAMcr6h39sm" property acceptURI "tcp://localhost:3478" accept ${acceptURI} +accepted +connected From 0e33b751add57cfda3718affbb2a8fba27a4a652 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Mon, 2 Sep 2019 15:59:26 -0700 Subject: [PATCH 15/29] Prepare release 3.0.0-alpha-102 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..568f14fb0 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index db7c6036e..b1be7743e 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..02616c966 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..f5e744d5d 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..837189c99 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..b08af73ed 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..e70e8a10e 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..59494287c 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 k3po.launcher diff --git a/pom.xml b/pom.xml index ad914ae35..777117695 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..5dcaf5125 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..42f67cda3 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..7195e0996 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..4daac86a6 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..8876c3568 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..ae6e70d6e 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..0513c92b6 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..eb76b2e02 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..f806fee21 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..498aac4da 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..73ce5f7c2 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..1a5c2b54b 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..695549050 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..913d8e036 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..af766ea9d 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..6edf8f95a 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..67ff56983 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..a7f4c6de5 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..0516cd55c 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..53701c402 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-102 ../../pom.xml From fe75b0914b8e532136d9358cacc84af9711d44b7 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Fri, 13 Sep 2019 14:37:18 -0700 Subject: [PATCH 16/29] Relax checks, allow config after close --- .../internal/behavior/visitor/ValidateStreamsVisitor.java | 2 ++ .../behavior/visitor/ValidateStreamsVisitorTest.java | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java index ddcaf0673..c2ca49a76 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java @@ -153,6 +153,7 @@ public AstScriptNode visit(AstReadConfigNode node, State state) { switch (state.readState) { case OPEN: + case CLOSED: break; default: throw new IllegalStateException(String.format("Unexpected read config event (%s) while reading in state %s", node @@ -166,6 +167,7 @@ public AstScriptNode visit(AstWriteConfigNode node, State state) { switch (state.writeState) { case OPEN: + case CLOSED: break; default: throw new IllegalStateException(String.format("Unexpected write config command (%s) while writing in state %s", node diff --git a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitorTest.java b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitorTest.java index 0555a2306..f8e8da4a6 100644 --- a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitorTest.java +++ b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitorTest.java @@ -159,8 +159,8 @@ public void shouldNotAllowWriteAfterRequestResponseWithoutSwitchingProtocols() t inputScript.accept(injectEvents, new ValidateStreamsVisitor.State()); } - @Test(expected = IllegalStateException.class) - public void shouldNotAllowWriteConfigAfterWriteClose() throws Exception { + @Test + public void shouldAllowWriteConfigAfterWriteClose() throws Exception { // @formatter:off AstScriptNode inputScript = new AstScriptNodeBuilder() .addConnectStream() @@ -183,8 +183,8 @@ public void shouldNotAllowWriteConfigAfterWriteClose() throws Exception { inputScript.accept(injectEvents, new ValidateStreamsVisitor.State()); } - @Test(expected = IllegalStateException.class) - public void shouldNotAllowReadConfigAfterReadClose() throws Exception { + @Test + public void shouldAllowReadConfigAfterReadClose() throws Exception { // @formatter:off AstScriptNode inputScript = new AstScriptNodeBuilder() .addAcceptStream() From 784529d5544e09b7f403a36de821e4f8aa4a6a4f Mon Sep 17 00:00:00 2001 From: John Fallows Date: Fri, 13 Sep 2019 14:37:52 -0700 Subject: [PATCH 17/29] Prepare release 3.0.0-alpha-103 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..561a3096c 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index db7c6036e..93cb1af22 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..d1c99c758 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..752b260fe 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..7c88649ee 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..070dc9160 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..da32344e7 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..7109078a8 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 k3po.launcher diff --git a/pom.xml b/pom.xml index ad914ae35..cae54faa4 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..8ed77f7c3 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..d1bf78a98 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..be10e6a2c 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..adeabfcca 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..0f676c268 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..17ba80593 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..6bd868144 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..3ab907da2 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..57a7a7b32 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..64f879d4b 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..d41170118 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..d5870cafa 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..60a8d7266 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..1a0b2c841 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..f1c528b34 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..6e19bdfad 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..2b138f1a7 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..bb2b90a4c 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..fd51a9987 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..a0a079a79 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-103 ../../pom.xml From 9628a7df7093970ff631633e8cc4355870ffbe06 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Wed, 11 Dec 2019 13:01:23 -0800 Subject: [PATCH 18/29] Update agrona dependency version --- driver/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/pom.xml b/driver/pom.xml index db7c6036e..5195d4c54 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -100,7 +100,7 @@ org.agrona agrona - 0.9.35 + 1.1.0 From 179206719add59a36da151bf7d47c63b6437eaaf Mon Sep 17 00:00:00 2001 From: John Fallows Date: Wed, 11 Dec 2019 13:01:52 -0800 Subject: [PATCH 19/29] Prepare release 3.0.0-alpha-104 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..7d48daa22 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index 5195d4c54..3672e2a04 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..cbd5eeb3a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..391c9ae99 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..f2c5431f6 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..e466a134d 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..65a46cf1f 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..c6dd3ae73 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 k3po.launcher diff --git a/pom.xml b/pom.xml index ad914ae35..0e72754e4 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..d881bf1b1 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..571b594b5 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..c6f48e94c 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..57e053335 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..1b7acf5eb 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..591f54c4b 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..ffc6946f8 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..60de7cce3 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..7990ac756 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..cf088f6a4 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..6ae2cc619 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..60e16618f 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..37ae4f0e2 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..198a5a2ca 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..c15ae493d 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..adebd7c21 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..3a686df85 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..49fa42f59 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..5832875cb 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..9e1d63ed2 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-104 ../../pom.xml From d08cc194f45019afe8e37bf4e181c112eae02d0d Mon Sep 17 00:00:00 2001 From: John Fallows Date: Fri, 3 Jan 2020 15:10:32 -0800 Subject: [PATCH 20/29] Set region info for rejected handler --- .../behavior/visitor/GenerateConfigurationVisitor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java index 9dda05215..408e86f7a 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java @@ -293,8 +293,9 @@ public Configuration visit(AstRejectedNode rejectedNode, State state) { state.pipelineAsMap = new LinkedHashMap<>(); Map pipelineAsMap = state.pipelineAsMap; - RejectedHandler rejected = new RejectedHandler(); String rejectedName = String.format("rejected#%d", pipelineAsMap.size() + 1); + RejectedHandler rejected = new RejectedHandler(); + rejected.setRegionInfo(rejectedNode.getRegionInfo()); pipelineAsMap.put(rejectedName, rejected); for (AstStreamableNode streamable : rejectedNode.getStreamables()) { From c598caf1b7ae8b4d1a649896305ba0c362458c61 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Fri, 3 Jan 2020 15:11:16 -0800 Subject: [PATCH 21/29] Prepare release 3.0.0-alpha-105 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..7617d7292 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index 5195d4c54..beca364be 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..dfc0c9edd 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..702254b0e 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..07b7830db 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..b869d386c 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..3bcac41f9 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..c7e183157 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 k3po.launcher diff --git a/pom.xml b/pom.xml index ad914ae35..f8818f575 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..629b134cc 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..cd33f4bb8 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..d5c789507 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..31edb9ee1 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..24ec1f258 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..19a5eb61c 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..b6d68f6b7 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..6760651c4 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..c6242f461 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..68d30b91c 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..8c792ac56 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..a797eadce 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..d6390e7f7 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..190ba9ccf 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..808325ccd 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..afa9e4992 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..1d7842eac 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..88724f234 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..f02c28ba8 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..80ec25f60 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-105 ../../pom.xml From 11afb1681b2ab75411086358f5b717aaba3a6cd4 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Fri, 17 Jan 2020 12:31:43 -0800 Subject: [PATCH 22/29] Prepare release 3.0.0-alpha-106 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..e414cffe6 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index 5195d4c54..544d5b33d 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..b8967fa8b 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..6b3de4331 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..de8dda4d2 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..5a864ba5b 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..1b33d70e0 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..a4919a329 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 k3po.launcher diff --git a/pom.xml b/pom.xml index ad914ae35..635c9edd1 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..a912777a5 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..5f65667bd 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..fcb9ee2d7 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..d5d2340cc 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..5b5424d38 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..454596b90 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..f86c030dc 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..315810354 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..3a1326a85 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..8d960fd19 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..003ba4a21 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..d9d39d7bb 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..050470d7c 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..a0f26ed5f 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..a2f30976f 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..b74a41711 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..bdb98e331 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..77576eff4 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..743121728 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..9b9a9245a 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-106 ../../pom.xml From bc3f91cc3383d10c52de8cb955e5781df0f066a8 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Sat, 1 Aug 2020 15:25:37 -0700 Subject: [PATCH 23/29] Support multi-byte unicode chars in scripts --- .../k3po/control/internal/Control.java | 59 ++++++++------ .../k3po/control/internal/ControlTest.java | 69 ++++++++-------- .../kaazing/k3po/driver/internal/Robot.java | 4 +- .../internal/behavior/ScriptProgress.java | 1 + .../internal/behavior/parser/Parser.java | 4 +- .../internal/behavior/ScriptProgressTest.java | 79 +++++++++---------- .../visitor/InjectEventsVisitorTest.java | 7 +- .../lang/internal/parser/ScriptParser.java | 5 +- .../internal/parser/ScriptParserImpl.java | 77 ++++++++---------- .../internal/parser/ScriptParserImplTest.java | 4 +- 10 files changed, 150 insertions(+), 159 deletions(-) diff --git a/control/src/main/java/org/kaazing/k3po/control/internal/Control.java b/control/src/main/java/org/kaazing/k3po/control/internal/Control.java index c5e21c4fc..c034a74b8 100644 --- a/control/src/main/java/org/kaazing/k3po/control/internal/Control.java +++ b/control/src/main/java/org/kaazing/k3po/control/internal/Control.java @@ -19,12 +19,11 @@ import static java.lang.String.format; import static java.util.concurrent.TimeUnit.MILLISECONDS; -import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; @@ -32,7 +31,6 @@ import java.net.URLConnection; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; import java.util.List; import java.util.concurrent.TimeUnit; @@ -59,6 +57,8 @@ */ public final class Control { + private static final int END_OF_STREAM = -1; + private static final char END_OF_LINE = '\n'; private static final String FINISHED_EVENT = "FINISHED"; private static final String ERROR_EVENT = "ERROR"; private static final String STARTED_EVENT = "STARTED"; @@ -70,7 +70,8 @@ public final class Control { private final URL location; private URLConnection connection; - BufferedReader textIn; + private InputStream bytesIn; + private ByteArrayOutputStream lineBuf; /** * @param location of k3po server to connect to. @@ -88,14 +89,13 @@ public void connect() throws Exception { URLConnection newConnection = location.openConnection(); newConnection.connect(); connection = newConnection; - - InputStream bytesIn = connection.getInputStream(); - CharsetDecoder decoder = UTF_8.newDecoder(); - textIn = new BufferedReader(new InputStreamReader(bytesIn, decoder)); + + bytesIn = connection.getInputStream(); + lineBuf = new ByteArrayOutputStream(); } /** - * Discoonects from the k3po server. + * Disconnects from the k3po server. * @throws Exception if error in closing the connection. */ public void disconnect() throws Exception { @@ -180,7 +180,7 @@ public CommandEvent readEvent(int timeout, TimeUnit unit) throws Exception { connection.setReadTimeout((int) unit.toMillis(timeout)); CommandEvent event = null; - String eventType = textIn.readLine(); + String eventType = readLine(); if (Thread.interrupted()) { @@ -306,9 +306,9 @@ private void writeCommand(CloseCommand close) throws IOException, CharacterCodin private PreparedEvent readPreparedEvent() throws IOException { PreparedEvent prepared = new PreparedEvent(); String line; - int length = -1; + int length = END_OF_STREAM; do { - line = textIn.readLine(); + line = readLine(); Matcher matcher = HEADER_PATTERN.matcher(line); if (matcher.matches()) { String headerName = matcher.group(1); @@ -329,7 +329,6 @@ private PreparedEvent readPreparedEvent() throws IOException { } } while (!line.isEmpty()); - // note: this assumes bytes-length == string-length (ASCII) // note: zero-length script should be non-null if (length >= 0) { prepared.setScript(readContent(length)); @@ -342,7 +341,7 @@ private StartedEvent readStartedEvent() throws IOException { StartedEvent started = new StartedEvent(); String line; do { - line = textIn.readLine(); + line = readLine(); Matcher matcher = HEADER_PATTERN.matcher(line); if (matcher.matches()) { String headerName = matcher.group(1); @@ -362,9 +361,9 @@ private StartedEvent readStartedEvent() throws IOException { private FinishedEvent readFinishedEvent() throws IOException { FinishedEvent finished = new FinishedEvent(); String line; - int length = -1; + int length = END_OF_STREAM; do { - line = textIn.readLine(); + line = readLine(); Matcher matcher = HEADER_PATTERN.matcher(line); if (matcher.matches()) { String headerName = matcher.group(1); @@ -388,7 +387,6 @@ private FinishedEvent readFinishedEvent() throws IOException { } } while (!line.isEmpty()); - // note: this assumes bytes-length == string-length (ASCII) // note: zero-length script should be non-null if (length >= 0) { finished.setScript(readContent(length)); @@ -401,7 +399,7 @@ private NotifiedEvent readNotifiedEvent() throws IOException { NotifiedEvent notified = new NotifiedEvent(); String line; do { - line = textIn.readLine(); + line = readLine(); Matcher matcher = HEADER_PATTERN.matcher(line); if (matcher.matches()) { String headerName = matcher.group(1); @@ -423,7 +421,7 @@ private ErrorEvent readErrorEvent() throws IOException { String line; int length = 0; do { - line = textIn.readLine(); + line = readLine(); Matcher matcher = HEADER_PATTERN.matcher(line); if (matcher.matches()) { String headerName = matcher.group(1); @@ -444,7 +442,6 @@ private ErrorEvent readErrorEvent() throws IOException { } } while (!line.isEmpty()); - // note: this assumes bytes-length == string-length (ASCII) if (length > 0) { error.setDescription(readContent(length)); } @@ -453,16 +450,30 @@ private ErrorEvent readErrorEvent() throws IOException { } private String readContent(final int length) throws IOException { - final char[] content = new char[length]; + final byte[] content = new byte[length]; int bytesRead = 0; do { - int result = textIn.read(content, bytesRead, length - bytesRead); - if (result == -1) { + int result = bytesIn.read(content, bytesRead, length - bytesRead); + if (result == END_OF_STREAM) { throw new EOFException("EOF detected before all content read"); } bytesRead += result; } while (bytesRead != length); - return new String(content); + return new String(content, "UTF-8"); + } + + private String readLine() throws IOException { + lineBuf.reset(); + int b; + for (b = bytesIn.read(); b != END_OF_STREAM && b != END_OF_LINE; b = bytesIn.read()) { + lineBuf.write(b); + } + + String line = null; + if (lineBuf.size() != 0 || b != END_OF_STREAM) { + line = lineBuf.toString("UTF-8"); + } + return line; } public void notifyBarrier(String barrierName) throws Exception { diff --git a/control/src/test/java/org/kaazing/k3po/control/internal/ControlTest.java b/control/src/test/java/org/kaazing/k3po/control/internal/ControlTest.java index 832070c26..32f98f7c3 100644 --- a/control/src/test/java/org/kaazing/k3po/control/internal/ControlTest.java +++ b/control/src/test/java/org/kaazing/k3po/control/internal/ControlTest.java @@ -214,14 +214,13 @@ public void shouldReadPreparedEvent() throws Exception { mockery.checking(new Expectations() { { + atLeast(1).of(input).read(); + will(readBytes(("PREPARED\n" + + "content-length:9\n" + + "future-header:future-value\n" + // test forward compatibility + "\n").getBytes(UTF_8))); oneOf(input).read(with(any(byte[].class)), with(equal(0)), with(any(int.class))); - will(readInitialBytes(0, ("PREPARED\n" + - "content-length:9\n" + - "future-header:future-value\n" + // test forward compatibility - "\n" + - "# comment").getBytes(UTF_8))); - allowing(input).available(); - will(returnValue(0)); + will(readBytes(0, "# comment".getBytes(UTF_8))); } }); @@ -237,11 +236,10 @@ public void shouldReadStartedEvent() throws Exception { mockery.checking(new Expectations() { { - oneOf(input).read(with(any(byte[].class)), with(equal(0)), with(any(int.class))); - will(readInitialBytes(0, ("STARTED\n" + "future-header:future-value\n" + // test forward compatibility - "\n").getBytes(UTF_8))); - allowing(input).available(); - will(returnValue(0)); + atLeast(1).of(input).read(); + will(readBytes(("STARTED\n" + + "future-header:future-value\n" + // test forward compatibility + "\n").getBytes(UTF_8))); } }); @@ -258,14 +256,13 @@ public void shouldReadFinishedEvent() throws Exception { mockery.checking(new Expectations() { { + atLeast(1).of(input).read(); + will(readBytes(("FINISHED\n" + + "content-length:9\n" + + "future-header:future-value\n" + // test forward compatibility + "\n").getBytes(UTF_8))); oneOf(input).read(with(any(byte[].class)), with(equal(0)), with(any(int.class))); - will(readInitialBytes(0, ("FINISHED\n" + - "content-length:9\n" + - "future-header:future-value\n" + // test forward compatibility - "\n" + - "# comment").getBytes(UTF_8))); - allowing(input).available(); - will(returnValue(0)); + will(readBytes(0, "# comment".getBytes(UTF_8))); } }); @@ -283,15 +280,14 @@ public void shouldReadErrorEvent() throws Exception { mockery.checking(new Expectations() { { + atLeast(1).of(input).read(); + will(readBytes(("ERROR\n" + + "summary:summary text\n" + + "content-length:16\n" + + "future-header:future-value\n" + // test forward compatibility + "\n").getBytes(UTF_8))); oneOf(input).read(with(any(byte[].class)), with(equal(0)), with(any(int.class))); - will(readInitialBytes(0, ("ERROR\n" + - "summary:summary text\n" + - "content-length:16\n" + - "future-header:future-value\n" + // test forward compatibility - "\n" + - "description text").getBytes(UTF_8))); - allowing(input).available(); - will(returnValue(0)); + will(readBytes(0, "description text".getBytes(UTF_8))); } }); @@ -331,22 +327,31 @@ public void describeTo(Description description) { }; } - private static Action readInitialBytes(final int parameter, final byte[] initialBytes) { + private static Action readBytes(final byte[] bytes) { + Action[] actions = new Action[bytes.length]; + for (int i=0; i < bytes.length; i++) + { + actions[i] = Expectations.returnValue((int) bytes[i]); + } + return Expectations.onConsecutiveCalls(actions); + } + + private static Action readBytes(final int parameter, final byte[] bytes) { return new Action() { @Override public Object invoke(Invocation invocation) throws Throwable { byte[] array = (byte[]) invocation.getParameter(parameter); - if (array.length < initialBytes.length) { + if (array.length < bytes.length) { throw new IndexOutOfBoundsException(); } - for (int i = 0; i < initialBytes.length; i++) { - array[i] = initialBytes[i]; + for (int i = 0; i < bytes.length; i++) { + array[i] = bytes[i]; } - return initialBytes.length; + return bytes.length; } @Override diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java index fa6802b3e..5169bc95c 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/Robot.java @@ -20,12 +20,10 @@ import static java.util.concurrent.TimeUnit.SECONDS; import static org.jboss.netty.channel.Channels.pipeline; import static org.jboss.netty.channel.Channels.pipelineFactory; -import static org.jboss.netty.util.CharsetUtil.UTF_8; import static org.kaazing.k3po.driver.internal.netty.bootstrap.BootstrapFactory.newBootstrapFactory; import static org.kaazing.k3po.driver.internal.netty.channel.ChannelAddressFactory.newChannelAddressFactory; import static org.kaazing.k3po.lang.internal.RegionInfo.newSequential; -import java.io.ByteArrayInputStream; import java.net.SocketAddress; import java.util.ArrayList; import java.util.Collections; @@ -130,7 +128,7 @@ public ChannelFuture prepare(String expectedScript) throws Exception { } final ScriptParser parser = new Parser(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(expectedScript.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(expectedScript); final ScriptValidator validator = new ScriptValidator(); validator.validate(scriptAST); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ScriptProgress.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ScriptProgress.java index bb164bc14..e4e250a57 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ScriptProgress.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ScriptProgress.java @@ -15,6 +15,7 @@ */ package org.kaazing.k3po.driver.internal.behavior; +import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Objects.requireNonNull; import java.util.Iterator; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/parser/Parser.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/parser/Parser.java index 8d89c21e4..e0e10eb84 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/parser/Parser.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/parser/Parser.java @@ -15,8 +15,6 @@ */ package org.kaazing.k3po.driver.internal.behavior.parser; -import java.io.InputStream; - import org.kaazing.k3po.driver.internal.behavior.visitor.AssociateStreamsVisitor; import org.kaazing.k3po.driver.internal.behavior.visitor.InjectBarriersVisitor; import org.kaazing.k3po.driver.internal.behavior.visitor.InjectEventsVisitor; @@ -35,7 +33,7 @@ public Parser() { } @Override - public AstScriptNode parse(InputStream input) throws ScriptParseException { + public AstScriptNode parse(String input) throws ScriptParseException { try { AstScriptNode script = parser.parse(input); diff --git a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/ScriptProgressTest.java b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/ScriptProgressTest.java index a52596912..a1c195169 100644 --- a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/ScriptProgressTest.java +++ b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/ScriptProgressTest.java @@ -15,11 +15,8 @@ */ package org.kaazing.k3po.driver.internal.behavior; -import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.Assert.assertEquals; -import java.io.ByteArrayInputStream; - import org.junit.Test; import org.kaazing.k3po.lang.internal.RegionInfo; import org.kaazing.k3po.lang.internal.ast.AstRegion; @@ -41,7 +38,7 @@ public void observedScriptEqualsScriptOnSuccess() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); @@ -64,7 +61,7 @@ public void connectFailWriteWithWhiteSpaceOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(0); AstRegion readAST = connectAST.getStreamables().get(1); @@ -97,7 +94,7 @@ public void testWithTabsSuccess() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -121,7 +118,7 @@ public void testEOFWithNoNewLine() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -145,7 +142,7 @@ public void trailingWhiteSpaceOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -167,7 +164,7 @@ public void testFailOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(0); AstRegion closedAST = connectAST.getStreamables().get(2); @@ -195,7 +192,7 @@ public void testFailWithTabOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(0); AstRegion closedAST = connectAST.getStreamables().get(2); @@ -227,7 +224,7 @@ public void resultScriptEqualsOriginalScriptWithCommentsSuccess() throws Excepti // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -253,7 +250,7 @@ public void failCaseWithComments() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(0); AstRegion closedAST = connectAST.getStreamables().get(2); @@ -287,7 +284,7 @@ public void moreThanOneStream() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -320,7 +317,7 @@ public void moreThanOneStreamComments() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -353,7 +350,7 @@ public void moreThanOneStreamCommentsFirstFail() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(0); AstRegion closeAST = connectAST.getStreamables().get(1); @@ -405,7 +402,7 @@ public void moreThanOneStreamCommentsBothFail() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectOneAST = scriptAST.getStreams().get(0); AstRegion closeOneAST = connectOneAST.getStreamables().get(1); AstStreamNode connectTwoAST = scriptAST.getStreams().get(1); @@ -457,7 +454,7 @@ public void moreThanOneStreamCommentsSecondFail() throws Exception { "\t#comment 5\n"; // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(1); AstRegion closeAST = connectAST.getStreamables().get(1); @@ -498,7 +495,7 @@ public void acceptSuccess() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -527,7 +524,7 @@ public void acceptCommentsSuccess() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -556,7 +553,7 @@ public void acceptFailOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode acceptedAST = scriptAST.getStreams().get(1); AstRegion closeAST = acceptedAST.getStreamables().get(1); @@ -600,7 +597,7 @@ public void acceptTwoSuccess() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -637,7 +634,7 @@ public void acceptFirstFailOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode acceptedAST = scriptAST.getStreams().get(1); AstRegion closeAST = acceptedAST.getStreamables().get(1); @@ -684,7 +681,7 @@ public void acceptSecondFailOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode acceptedAST = scriptAST.getStreams().get(2); AstRegion closeAST = acceptedAST.getStreamables().get(1); @@ -731,7 +728,7 @@ public void acceptAllFailOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode acceptedOneAST = scriptAST.getStreams().get(1); AstRegion closeOneAST = acceptedOneAST.getStreamables().get(1); AstStreamNode acceptedTwoAST = scriptAST.getStreams().get(2); @@ -784,7 +781,7 @@ public void acceptAndConnectSuccess() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -814,7 +811,7 @@ public void middleStreamFailsOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(1); RegionInfo scriptInfo = scriptAST.getRegionInfo(); @@ -857,7 +854,7 @@ public void firstStreamFailsOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(0); RegionInfo scriptInfo = scriptAST.getRegionInfo(); @@ -900,7 +897,7 @@ public void lastStreamFailsOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(2); RegionInfo scriptInfo = scriptAST.getRegionInfo(); @@ -947,7 +944,7 @@ public void middleStreamFailsWithCommentsOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(1); RegionInfo scriptInfo = scriptAST.getRegionInfo(); @@ -995,7 +992,7 @@ public void skipStreamThenAcceptOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(1); RegionInfo scriptInfo = scriptAST.getRegionInfo(); @@ -1051,7 +1048,7 @@ public void skipStreamThenAcceptWithCommentsOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(1); RegionInfo scriptInfo = scriptAST.getRegionInfo(); @@ -1094,7 +1091,7 @@ public void acceptNoStreamsOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode acceptedAST = scriptAST.getStreams().get(1); RegionInfo scriptInfo = scriptAST.getRegionInfo(); @@ -1130,7 +1127,7 @@ public void twoAcceptNoStreamsOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode acceptedOneAST = scriptAST.getStreams().get(1); AstStreamNode acceptedTwoAST = scriptAST.getStreams().get(3); @@ -1163,7 +1160,7 @@ public void connectAndAcceptNoStreamsOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode acceptedAST = scriptAST.getStreams().get(1); RegionInfo scriptInfo = scriptAST.getRegionInfo(); @@ -1195,7 +1192,7 @@ public void connectNoOneHomeOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(0); AstRegion connectedAST = connectAST.getStreamables().get(0); @@ -1224,7 +1221,7 @@ public void emptyScriptOK() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); RegionInfo scriptInfo = scriptAST.getRegionInfo(); ScriptProgress progress = new ScriptProgress(scriptInfo, script); @@ -1246,7 +1243,7 @@ public void scriptWithAllFailedOk() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(0); RegionInfo scriptInfo = scriptAST.getRegionInfo(); @@ -1280,7 +1277,7 @@ public void canEchoWrongOK() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode acceptedAST = scriptAST.getStreams().get(1); AstRegion readAST = acceptedAST.getStreamables().get(1); @@ -1323,7 +1320,7 @@ public void canSkipFirstAcceptStreamAndSecondStream() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectOneAST = scriptAST.getStreams().get(1); AstRegion connectedOneAST = connectOneAST.getStreamables().get(0); AstStreamNode connectTwoAST = scriptAST.getStreams().get(2); @@ -1364,7 +1361,7 @@ public void canSkipFirstConnectStreamAndSecondStream() throws Exception { // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(0); AstRegion connectedOneAST = connectAST.getStreamables().get(0); AstStreamNode acceptedAST = scriptAST.getStreams().get(2); @@ -1400,7 +1397,7 @@ public void testCacheResultOk() throws Exception { "closed\n"; // @formatter:on ScriptParser parser = new ScriptParserImpl(); - AstScriptNode scriptAST = parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + AstScriptNode scriptAST = parser.parse(script); AstStreamNode connectAST = scriptAST.getStreams().get(0); AstRegion closedAST = connectAST.getStreamables().get(2); diff --git a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitorTest.java b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitorTest.java index 02e672e12..eefd9a321 100644 --- a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitorTest.java +++ b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitorTest.java @@ -15,11 +15,8 @@ */ package org.kaazing.k3po.driver.internal.behavior.visitor; -import static org.jboss.netty.util.CharsetUtil.UTF_8; import static org.junit.Assert.assertEquals; -import java.io.ByteArrayInputStream; - import org.junit.Test; import org.kaazing.k3po.driver.internal.behavior.parser.Parser; import org.kaazing.k3po.lang.internal.ast.AstScriptNode; @@ -319,7 +316,7 @@ public void shouldNotParseScriptWithoutConnect() "closed\n"; ScriptParser parser = new Parser(); - parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + parser.parse(script); } @Test(expected = ScriptParseException.class) @@ -336,6 +333,6 @@ public void shouldNotParseScriptWithMultiplyClosedStream() "closed\n"; ScriptParser parser = new Parser(); - parser.parse(new ByteArrayInputStream(script.getBytes(UTF_8))); + parser.parse(script); } } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParser.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParser.java index e1637f166..03a272e62 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParser.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParser.java @@ -15,12 +15,9 @@ */ package org.kaazing.k3po.lang.internal.parser; -import java.io.InputStream; - import org.kaazing.k3po.lang.internal.ast.AstScriptNode; public interface ScriptParser { - AstScriptNode parse(InputStream input) throws ScriptParseException; - + AstScriptNode parse(String input) throws ScriptParseException; } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImpl.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImpl.java index 7063d30ea..e6ae9a923 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImpl.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImpl.java @@ -16,21 +16,18 @@ package org.kaazing.k3po.lang.internal.parser; import static java.lang.String.format; -import static java.nio.charset.StandardCharsets.UTF_8; import static org.kaazing.k3po.lang.internal.RegionInfo.newParallel; import static org.kaazing.k3po.lang.internal.RegionInfo.newSequential; import static org.kaazing.k3po.lang.internal.el.ExpressionFactoryUtils.newExpressionFactory; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.SCRIPT; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; import java.util.List; import javax.el.ExpressionFactory; -import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.BailErrorStrategy; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.CharStreams; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.NoViableAltException; import org.antlr.v4.runtime.RecognitionException; @@ -66,7 +63,7 @@ public ExpressionContext getExpressionContext() { } @Override - public AstScriptNode parse(InputStream input) throws ScriptParseException { + public AstScriptNode parse(String input) throws ScriptParseException { try { return parseWithStrategy(input, SCRIPT); } catch (Exception e) { @@ -76,52 +73,42 @@ public AstScriptNode parse(InputStream input) throws ScriptParseException { public T parseWithStrategy(String input, ScriptParseStrategy strategy) throws ScriptParseException { - return parseWithStrategy( - new ByteArrayInputStream(input.getBytes(UTF_8)), strategy); - } - - T parseWithStrategy(InputStream input, ScriptParseStrategy strategy) throws ScriptParseException { T result = null; - try { - int newStart = 0; - int newEnd = input.available(); - - ANTLRInputStream ais = new ANTLRInputStream(input); - RobotLexer lexer = new RobotLexer(ais); - CommonTokenStream tokens = new CommonTokenStream(lexer); - final RobotParser parser = new RobotParser(tokens); - parser.setErrorHandler(new BailErrorStrategy()); - - try { - result = strategy.parse(parser, factory, context); - RegionInfo regionInfo = result.getRegionInfo(); - List newChildren = regionInfo.children; - switch (regionInfo.kind) { - case SEQUENTIAL: - result.setRegionInfo(newSequential(newChildren, newStart, newEnd)); - break; - case PARALLEL: - result.setRegionInfo(newParallel(newChildren, newStart, newEnd)); - break; - } + int newStart = 0; + int newEnd = input.length(); + + CharStream ais = CharStreams.fromString(input); + RobotLexer lexer = new RobotLexer(ais); + CommonTokenStream tokens = new CommonTokenStream(lexer); + final RobotParser parser = new RobotParser(tokens); + parser.setErrorHandler(new BailErrorStrategy()); + + try { + result = strategy.parse(parser, factory, context); + RegionInfo regionInfo = result.getRegionInfo(); + List newChildren = regionInfo.children; + switch (regionInfo.kind) { + case SEQUENTIAL: + result.setRegionInfo(newSequential(newChildren, newStart, newEnd)); + break; + case PARALLEL: + result.setRegionInfo(newParallel(newChildren, newStart, newEnd)); + break; } - catch (ParseCancellationException pce) { - Throwable cause = pce.getCause(); - if (cause instanceof RecognitionException) { - RecognitionException re = (RecognitionException) cause; - throw createScriptParseException(parser, re); - } - - throw pce; - } - catch (RecognitionException re) { + + } + catch (ParseCancellationException pce) { + Throwable cause = pce.getCause(); + if (cause instanceof RecognitionException) { + RecognitionException re = (RecognitionException) cause; throw createScriptParseException(parser, re); } + throw pce; } - catch (IOException e) { - throw new ScriptParseException(e); + catch (RecognitionException re) { + throw createScriptParseException(parser, re); } return result; diff --git a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java index 03e4b39b9..dbb060465 100644 --- a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java +++ b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java @@ -384,14 +384,14 @@ public void shouldParsePrefixedLengthBytesMatcher() throws Exception { @Test public void shouldParseExpressionMatcher() throws Exception { - String scriptFragment = "${ byteArray }"; + String scriptFragment = "${ \"\u0001f602\" }"; ScriptParserImpl parser = new ScriptParserImpl(); AstExpressionMatcher actual = parser.parseWithStrategy(scriptFragment, EXPRESSION_MATCHER); ExpressionFactory factory = parser.getExpressionFactory(); ExpressionContext context = parser.getExpressionContext(); - ValueExpression value = factory.createValueExpression(context, "${ byteArray }", Object.class); + ValueExpression value = factory.createValueExpression(context, "${ \"\u0001f602\" }", Object.class); AstExpressionMatcher expected = new AstExpressionMatcher(value, parser.getExpressionContext()); assertEquals(expected, actual); From 9b85529e57818d8cd75cfe9c7b69cf658d3f766b Mon Sep 17 00:00:00 2001 From: John Fallows Date: Sat, 1 Aug 2020 15:26:22 -0700 Subject: [PATCH 24/29] Prepare release 3.0.0-alpha-107 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..13a5eb796 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index 5195d4c54..d99400d99 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..327c97116 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..82cb1c2b9 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..80b075df2 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..22eff9f73 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..820894be9 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..440adeeff 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 k3po.launcher diff --git a/pom.xml b/pom.xml index ad914ae35..775ca5e33 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..81b690a07 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..263adb1a5 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..05fc06fb7 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..205385db3 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..eb0a51870 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..661a33350 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..75f5c6579 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..ac11ce4b9 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..4f2cbf302 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..d53878a5e 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..9040f88e4 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..19148290b 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..12877a680 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..256505721 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..16722058d 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..222f09eef 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..a8d7566f7 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..f0123331a 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..b2c2f0c2f 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..40831f2f7 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0-alpha-107 ../../pom.xml From 63fc5b9249b43f969b9a953276538e64e9bb5add Mon Sep 17 00:00:00 2001 From: John Fallows Date: Sat, 8 Aug 2020 17:13:34 -0700 Subject: [PATCH 25/29] Update agrona dependency version --- driver/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/pom.xml b/driver/pom.xml index 5195d4c54..0ede3271d 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -100,7 +100,7 @@ org.agrona agrona - 1.1.0 + 1.6.0 From 5725792cee041e683e190dcd5e774ea5dd537f54 Mon Sep 17 00:00:00 2001 From: John Fallows Date: Sat, 8 Aug 2020 17:14:02 -0700 Subject: [PATCH 26/29] Prepare release 3.0.0 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..15f75d016 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index 0ede3271d..9693fb513 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..1c871b252 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..4c44d6b66 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..af3b86072 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..1dadd6132 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..95c86f679 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..fd6079f7c 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 k3po.launcher diff --git a/pom.xml b/pom.xml index ad914ae35..8127e964f 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.0.0 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..cea4a352a 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..79545351d 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..43fdacae0 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..559a9c2bc 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..09ac147a9 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..fbee21699 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..1d5adda6e 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..05e78c65e 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..3e5e7a90f 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..423260a12 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..715f050b8 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..705f8ce08 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..cb054b7bc 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..9e908d37a 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..92e8498e0 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..c8a361fa1 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..05bb2cfc1 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..51f1c310c 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..9bca0ef9a 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..096a1496c 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.0.0 ../../pom.xml From 27258cc72493f8eaa51d2e8430f5f93d0619990e Mon Sep 17 00:00:00 2001 From: John Fallows Date: Thu, 8 Oct 2020 14:28:08 -0700 Subject: [PATCH 27/29] Update jackson dependency versions --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ad914ae35..388e06439 100644 --- a/pom.xml +++ b/pom.xml @@ -147,12 +147,12 @@ com.fasterxml.jackson.core jackson-core - 2.9.8 + 2.9.10 com.fasterxml.jackson.core jackson-databind - 2.9.8 + 2.9.10.6 org.apache.maven From 4330335a7ae9ed49106b6cb2de6e8b01466adeca Mon Sep 17 00:00:00 2001 From: John Fallows Date: Fri, 16 Oct 2020 19:57:09 -0700 Subject: [PATCH 28/29] Fix #472 support stream advisories --- .../internal/behavior/BehaviorSystem.java | 61 ++++ .../internal/behavior/BehaviorSystemSpi.java | 12 + .../internal/behavior/FileBehaviorSystem.java | 49 +++ .../internal/behavior/HttpBehaviorSystem.java | 51 +++ .../internal/behavior/ReadAdviseFactory.java | 28 ++ .../internal/behavior/ReadAdvisedFactory.java | 28 ++ .../internal/behavior/WriteAdviseFactory.java | 28 ++ .../behavior/WriteAdvisedFactory.java | 28 ++ .../handler/codec/AbstractConfigDecoder.java | 2 +- ...ConfigDecoder.java => ChannelDecoder.java} | 2 +- ...ConfigEncoder.java => ChannelEncoder.java} | 2 +- .../codec/http/HttpContentLengthEncoder.java | 4 +- .../handler/codec/http/HttpHeaderEncoder.java | 4 +- .../handler/codec/http/HttpHostEncoder.java | 4 +- .../handler/codec/http/HttpMethodEncoder.java | 4 +- .../codec/http/HttpParameterEncoder.java | 4 +- .../codec/http/HttpRequestFormEncoder.java | 4 +- .../handler/codec/http/HttpStatusEncoder.java | 4 +- .../codec/http/HttpTrailerEncoder.java | 4 +- .../codec/http/HttpVersionEncoder.java | 4 +- .../handler/command/ReadAdviseHandler.java | 66 ++++ .../handler/command/ReadConfigHandler.java | 10 +- .../handler/command/WriteAdviseHandler.java | 66 ++++ .../handler/command/WriteConfigHandler.java | 10 +- .../handler/event/AbstractEventHandler.java | 19 +- .../handler/event/ReadAdvisedHandler.java | 89 +++++ .../handler/event/WriteAdvisedHandler.java | 89 +++++ .../visitor/AssociateStreamsVisitor.java | 32 ++ .../visitor/GenerateConfigurationVisitor.java | 73 ++++ .../visitor/InjectBarriersVisitor.java | 28 ++ .../behavior/visitor/InjectEventsVisitor.java | 56 +++ .../behavior/visitor/InjectFlushVisitor.java | 28 ++ .../visitor/ValidateStreamsVisitor.java | 60 ++++ .../internal/ext/tls/TlsBehaviorSystem.java | 53 +++ .../internal/ext/tls/TlsTypeSystem.java | 16 + .../channel/AbstractChannelSink.java | 12 + .../internal/netty/channel/Channels.java | 32 +- .../channel/DownstreamReadAdviseEvent.java | 68 ++++ .../channel/DownstreamWriteAdviseEvent.java | 68 ++++ .../netty/channel/ReadAdviseEvent.java | 23 ++ .../SimpleChannelDownstreamHandler.java | 14 + .../netty/channel/SimpleChannelHandler.java | 28 ++ .../channel/SimpleChannelUpstreamHandler.java | 14 + .../channel/UpstreamReadAdviseEvent.java | 65 ++++ .../channel/UpstreamWriteAdviseEvent.java | 65 ++++ .../netty/channel/WriteAdviseEvent.java | 23 ++ .../internal/types/AgronaTypeSystem.java | 16 + .../driver/internal/types/FileTypeSystem.java | 16 + .../driver/internal/types/HttpTypeSystem.java | 18 + .../driver/internal/types/UdpTypeSystem.java | 16 + .../command/ReadConfigHandlerTest.java | 6 +- .../command/WriteConfigHandlerTest.java | 6 +- .../org/kaazing/k3po/lang/parser/v2/Robot.g4 | 28 ++ .../k3po/lang/internal/ast/AstNode.java | 5 + .../lang/internal/ast/AstReadAdviseNode.java | 123 +++++++ .../lang/internal/ast/AstReadAdvisedNode.java | 143 ++++++++ .../lang/internal/ast/AstWriteAdviseNode.java | 123 +++++++ .../internal/ast/AstWriteAdvisedNode.java | 143 ++++++++ .../ast/builder/AstReadAdviseNodeBuilder.java | 127 +++++++ .../builder/AstReadAdvisedNodeBuilder.java | 253 ++++++++++++++ .../builder/AstWriteAdviseNodeBuilder.java | 127 +++++++ .../builder/AstWriteAdvisedNodeBuilder.java | 253 ++++++++++++++ .../internal/parser/ScriptParseStrategy.java | 322 ++++++++++++++++++ .../parser/types/DefaultTypeSystem.java | 14 + .../internal/parser/types/TypeSystem.java | 28 ++ .../k3po/lang/types/TypeSystemSpi.java | 4 + .../internal/parser/ScriptParserImplTest.java | 119 +++++++ .../internal/parser/types/TestTypeSystem.java | 17 + 68 files changed, 3301 insertions(+), 40 deletions(-) create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ReadAdviseFactory.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ReadAdvisedFactory.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/WriteAdviseFactory.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/WriteAdvisedFactory.java rename driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/{ConfigDecoder.java => ChannelDecoder.java} (95%) rename driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/{ConfigEncoder.java => ChannelEncoder.java} (95%) create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadAdviseHandler.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteAdviseHandler.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ReadAdvisedHandler.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/WriteAdvisedHandler.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/DownstreamReadAdviseEvent.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/DownstreamWriteAdviseEvent.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/ReadAdviseEvent.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/UpstreamReadAdviseEvent.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/UpstreamWriteAdviseEvent.java create mode 100644 driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/WriteAdviseEvent.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstReadAdviseNode.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstReadAdvisedNode.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstWriteAdviseNode.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstWriteAdvisedNode.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAdviseNodeBuilder.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAdvisedNodeBuilder.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstWriteAdviseNodeBuilder.java create mode 100644 lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstWriteAdvisedNodeBuilder.java diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/BehaviorSystem.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/BehaviorSystem.java index 378015873..e6de46f98 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/BehaviorSystem.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/BehaviorSystem.java @@ -25,8 +25,12 @@ import org.jboss.netty.channel.ChannelHandler; import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageDecoder; import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageEncoder; +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; import org.kaazing.k3po.lang.internal.ast.AstReadOptionNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstWriteConfigNode; import org.kaazing.k3po.lang.internal.ast.AstWriteOptionNode; import org.kaazing.k3po.lang.internal.ast.matcher.AstValueMatcher; @@ -40,6 +44,10 @@ public final class BehaviorSystem { private final Map, WriteOptionFactory> writeOptions; private final Map readConfigs; private final Map writeConfigs; + private final Map readAdvises; + private final Map writeAdvises; + private final Map readAdviseds; + private final Map writeAdviseds; private BehaviorSystem(Iterable behaviorSystems) { @@ -47,6 +55,10 @@ private BehaviorSystem(Iterable behaviorSystems) { Map, WriteOptionFactory> writeOptions = new IdentityHashMap<>(); Map readConfigs = new IdentityHashMap<>(); Map writeConfigs = new IdentityHashMap<>(); + Map readAdvises = new IdentityHashMap<>(); + Map writeAdvises = new IdentityHashMap<>(); + Map readAdviseds = new IdentityHashMap<>(); + Map writeAdviseds = new IdentityHashMap<>(); for (BehaviorSystemSpi behaviorSystem : behaviorSystems) { for (TypeInfo optionType : behaviorSystem.getReadOptionTypes()) { @@ -62,12 +74,25 @@ private BehaviorSystem(Iterable behaviorSystems) { for (StructuredTypeInfo configType : behaviorSystem.getWriteConfigTypes()) { writeConfigs.put(configType, behaviorSystem.writeConfigFactory(configType)); } + + for (StructuredTypeInfo advisoryType : behaviorSystem.getReadAdvisoryTypes()) { + readAdvises.put(advisoryType, behaviorSystem.readAdviseFactory(advisoryType)); + writeAdviseds.put(advisoryType, behaviorSystem.writeAdvisedFactory(advisoryType)); + } + for (StructuredTypeInfo advisoryType : behaviorSystem.getWriteAdvisoryTypes()) { + writeAdvises.put(advisoryType, behaviorSystem.writeAdviseFactory(advisoryType)); + readAdviseds.put(advisoryType, behaviorSystem.readAdvisedFactory(advisoryType)); + } } this.readOptions = unmodifiableMap(readOptions); this.writeOptions = unmodifiableMap(writeOptions); this.readConfigs = unmodifiableMap(readConfigs); this.writeConfigs = unmodifiableMap(writeConfigs); + this.readAdvises = unmodifiableMap(readAdvises); + this.writeAdvises = unmodifiableMap(writeAdvises); + this.readAdviseds = unmodifiableMap(readAdviseds); + this.writeAdviseds = unmodifiableMap(writeAdviseds); } public ChannelHandler newReadOptionHandler( @@ -104,6 +129,42 @@ public ChannelHandler newWriteConfigHandler( return factory.newHandler(node, encoderFactory); } + public ChannelHandler newReadAdviseHandler( + AstReadAdviseNode node, + Function, MessageEncoder> encoderFactory) { + + StructuredTypeInfo type = node.getType(); + ReadAdviseFactory factory = readAdvises.getOrDefault(type, (n, f) -> null); + return factory.newHandler(node, encoderFactory); + } + + public ChannelHandler newWriteAdviseHandler( + AstWriteAdviseNode node, + Function, MessageEncoder> encoderFactory) { + + StructuredTypeInfo type = node.getType(); + WriteAdviseFactory factory = writeAdvises.getOrDefault(type, (n, f) -> null); + return factory.newHandler(node, encoderFactory); + } + + public ChannelHandler newReadAdvisedHandler( + AstReadAdvisedNode node, + Function decoderFactory) { + + StructuredTypeInfo type = node.getType(); + ReadAdvisedFactory factory = readAdviseds.getOrDefault(type, (n, f) -> null); + return factory.newHandler(node, decoderFactory); + } + + public ChannelHandler newWriteAdvisedHandler( + AstWriteAdvisedNode node, + Function decoderFactory) { + + StructuredTypeInfo type = node.getType(); + WriteAdvisedFactory factory = writeAdviseds.getOrDefault(type, (n, f) -> null); + return factory.newHandler(node, decoderFactory); + } + public static final BehaviorSystem newInstance() { return new BehaviorSystem(load(BehaviorSystemSpi.class)); } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/BehaviorSystemSpi.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/BehaviorSystemSpi.java index 08f202d93..974e04178 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/BehaviorSystemSpi.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/BehaviorSystemSpi.java @@ -38,4 +38,16 @@ public interface BehaviorSystemSpi { WriteConfigFactory writeConfigFactory(StructuredTypeInfo configType); + Set getReadAdvisoryTypes(); + + Set getWriteAdvisoryTypes(); + + ReadAdviseFactory readAdviseFactory(StructuredTypeInfo advisoryType); + + ReadAdvisedFactory readAdvisedFactory(StructuredTypeInfo advisoryType); + + WriteAdviseFactory writeAdviseFactory(StructuredTypeInfo advisoryType); + + WriteAdvisedFactory writeAdvisedFactory(StructuredTypeInfo advisoryType); + } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/FileBehaviorSystem.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/FileBehaviorSystem.java index 35ff7b6be..8b5b6fe57 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/FileBehaviorSystem.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/FileBehaviorSystem.java @@ -39,6 +39,11 @@ public class FileBehaviorSystem implements BehaviorSystemSpi { private final Map readConfigFactories; private final Map writeConfigFactories; + private final Map readAdviseFactories; + private final Map writeAdviseFactories; + private final Map readAdvisedFactories; + private final Map writeAdvisedFactories; + public FileBehaviorSystem() { Map, ReadOptionFactory> readOptionFactories = new LinkedHashMap<>(); @@ -51,6 +56,10 @@ public FileBehaviorSystem() this.readConfigFactories = emptyMap(); this.writeConfigFactories = emptyMap(); + this.readAdviseFactories = emptyMap(); + this.writeAdviseFactories = emptyMap(); + this.readAdvisedFactories = emptyMap(); + this.writeAdvisedFactories = emptyMap(); } @Override @@ -79,6 +88,46 @@ public WriteConfigFactory writeConfigFactory( return writeConfigFactories.get(configType); } + @Override + public Set getReadAdvisoryTypes() + { + return readAdviseFactories.keySet(); + } + + @Override + public Set getWriteAdvisoryTypes() + { + return writeAdviseFactories.keySet(); + } + + @Override + public ReadAdviseFactory readAdviseFactory( + StructuredTypeInfo advisoryType) + { + return readAdviseFactories.get(advisoryType); + } + + @Override + public ReadAdvisedFactory readAdvisedFactory( + StructuredTypeInfo advisoryType) + { + return readAdvisedFactories.get(advisoryType); + } + + @Override + public WriteAdviseFactory writeAdviseFactory( + StructuredTypeInfo advisoryType) + { + return writeAdviseFactories.get(advisoryType); + } + + @Override + public WriteAdvisedFactory writeAdvisedFactory( + StructuredTypeInfo advisoryType) + { + return writeAdvisedFactories.get(advisoryType); + } + @Override public Set> getReadOptionTypes() { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/HttpBehaviorSystem.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/HttpBehaviorSystem.java index 56954f898..f9b35d353 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/HttpBehaviorSystem.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/HttpBehaviorSystem.java @@ -15,6 +15,7 @@ */ package org.kaazing.k3po.driver.internal.behavior; +import static java.util.Collections.emptyMap; import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableMap; import static java.util.Objects.requireNonNull; @@ -77,6 +78,11 @@ public class HttpBehaviorSystem implements BehaviorSystemSpi { private final Map readConfigFactories; private final Map writeConfigFactories; + private final Map readAdviseFactories; + private final Map writeAdviseFactories; + private final Map readAdvisedFactories; + private final Map writeAdvisedFactories; + public HttpBehaviorSystem() { this.readOptionFactories = singletonMap(OPTION_CHUNK_EXT, HttpBehaviorSystem::newReadHttpChunkExtHandler); @@ -102,6 +108,11 @@ public HttpBehaviorSystem() writeConfigFactories.put(CONFIG_STATUS, HttpBehaviorSystem::newWriteHttpStatusHandler); writeConfigFactories.put(CONFIG_TRAILER, HttpBehaviorSystem::newWriteHttpTrailerHandler); this.writeConfigFactories = unmodifiableMap(writeConfigFactories); + + this.readAdviseFactories = emptyMap(); + this.writeAdviseFactories = emptyMap(); + this.readAdvisedFactories = emptyMap(); + this.writeAdvisedFactories = emptyMap(); } @Override @@ -130,6 +141,46 @@ public WriteConfigFactory writeConfigFactory( return writeConfigFactories.get(configType); } + @Override + public Set getReadAdvisoryTypes() + { + return readAdviseFactories.keySet(); + } + + @Override + public Set getWriteAdvisoryTypes() + { + return writeAdviseFactories.keySet(); + } + + @Override + public ReadAdviseFactory readAdviseFactory( + StructuredTypeInfo advisoryType) + { + return readAdviseFactories.get(advisoryType); + } + + @Override + public ReadAdvisedFactory readAdvisedFactory( + StructuredTypeInfo advisoryType) + { + return readAdvisedFactories.get(advisoryType); + } + + @Override + public WriteAdviseFactory writeAdviseFactory( + StructuredTypeInfo advisoryType) + { + return writeAdviseFactories.get(advisoryType); + } + + @Override + public WriteAdvisedFactory writeAdvisedFactory( + StructuredTypeInfo advisoryType) + { + return writeAdvisedFactories.get(advisoryType); + } + @Override public Set> getReadOptionTypes() { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ReadAdviseFactory.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ReadAdviseFactory.java new file mode 100644 index 000000000..7250ae690 --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ReadAdviseFactory.java @@ -0,0 +1,28 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior; + +import java.util.function.Function; + +import org.jboss.netty.channel.ChannelHandler; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageEncoder; +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.value.AstValue; + +public interface ReadAdviseFactory { + + ChannelHandler newHandler(AstReadAdviseNode node, Function, MessageEncoder> encoderFactory); +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ReadAdvisedFactory.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ReadAdvisedFactory.java new file mode 100644 index 000000000..f93cecdc5 --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/ReadAdvisedFactory.java @@ -0,0 +1,28 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior; + +import java.util.function.Function; + +import org.jboss.netty.channel.ChannelHandler; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageDecoder; +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; +import org.kaazing.k3po.lang.internal.ast.matcher.AstValueMatcher; + +public interface ReadAdvisedFactory { + + ChannelHandler newHandler(AstReadAdvisedNode node, Function decoderFactory); +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/WriteAdviseFactory.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/WriteAdviseFactory.java new file mode 100644 index 000000000..3439d8b36 --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/WriteAdviseFactory.java @@ -0,0 +1,28 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior; + +import java.util.function.Function; + +import org.jboss.netty.channel.ChannelHandler; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageEncoder; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.value.AstValue; + +public interface WriteAdviseFactory { + + ChannelHandler newHandler(AstWriteAdviseNode node, Function, MessageEncoder> encoderFactory); +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/WriteAdvisedFactory.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/WriteAdvisedFactory.java new file mode 100644 index 000000000..403cee9bf --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/WriteAdvisedFactory.java @@ -0,0 +1,28 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior; + +import java.util.function.Function; + +import org.jboss.netty.channel.ChannelHandler; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageDecoder; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; +import org.kaazing.k3po.lang.internal.ast.matcher.AstValueMatcher; + +public interface WriteAdvisedFactory { + + ChannelHandler newHandler(AstWriteAdvisedNode node, Function decoderFactory); +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/AbstractConfigDecoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/AbstractConfigDecoder.java index 898b0876d..c91d8eb7b 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/AbstractConfigDecoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/AbstractConfigDecoder.java @@ -18,7 +18,7 @@ import org.kaazing.k3po.lang.internal.RegionInfo; -public abstract class AbstractConfigDecoder implements ConfigDecoder { +public abstract class AbstractConfigDecoder implements ChannelDecoder { private RegionInfo regionInfo; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ConfigDecoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ChannelDecoder.java similarity index 95% rename from driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ConfigDecoder.java rename to driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ChannelDecoder.java index d60e3ed1f..483d1d567 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ConfigDecoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ChannelDecoder.java @@ -18,7 +18,7 @@ import org.jboss.netty.channel.Channel; -public interface ConfigDecoder { +public interface ChannelDecoder { boolean decode(Channel channel) throws Exception; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ConfigEncoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ChannelEncoder.java similarity index 95% rename from driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ConfigEncoder.java rename to driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ChannelEncoder.java index eac7c3e00..064957628 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ConfigEncoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/ChannelEncoder.java @@ -17,7 +17,7 @@ import org.jboss.netty.channel.Channel; -public interface ConfigEncoder { +public interface ChannelEncoder { void encode(Channel channel) throws Exception; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpContentLengthEncoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpContentLengthEncoder.java index 727a2d5bc..02237e0f1 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpContentLengthEncoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpContentLengthEncoder.java @@ -16,10 +16,10 @@ package org.kaazing.k3po.driver.internal.behavior.handler.codec.http; import org.jboss.netty.channel.Channel; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; import org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpChannelConfig; -public class HttpContentLengthEncoder implements ConfigEncoder { +public class HttpContentLengthEncoder implements ChannelEncoder { private final int maximumBufferedContentLength; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpHeaderEncoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpHeaderEncoder.java index 28b5b857a..7bc2bfbe8 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpHeaderEncoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpHeaderEncoder.java @@ -23,11 +23,11 @@ import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.channel.Channel; import org.jboss.netty.handler.codec.http.HttpHeaders; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageEncoder; import org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpChannelConfig; -public class HttpHeaderEncoder implements ConfigEncoder { +public class HttpHeaderEncoder implements ChannelEncoder { private final MessageEncoder nameEncoder; private final List valueEncoders; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpHostEncoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpHostEncoder.java index 63e683c4d..3ff703f02 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpHostEncoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpHostEncoder.java @@ -19,12 +19,12 @@ import org.jboss.netty.channel.Channel; import org.jboss.netty.handler.codec.http.HttpHeaders; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; import org.kaazing.k3po.driver.internal.netty.bootstrap.channel.AbstractChannel; import org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpChannelConfig; import org.kaazing.k3po.driver.internal.netty.channel.ChannelAddress; -public class HttpHostEncoder implements ConfigEncoder { +public class HttpHostEncoder implements ChannelEncoder { @Override @SuppressWarnings("unchecked") diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpMethodEncoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpMethodEncoder.java index 11a1a1c05..8e9118ada 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpMethodEncoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpMethodEncoder.java @@ -21,11 +21,11 @@ import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.channel.Channel; import org.jboss.netty.handler.codec.http.HttpMethod; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageEncoder; import org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpChannelConfig; -public class HttpMethodEncoder implements ConfigEncoder { +public class HttpMethodEncoder implements ChannelEncoder { private final MessageEncoder methodEncoder; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpParameterEncoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpParameterEncoder.java index 7e489677b..d2189c3bd 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpParameterEncoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpParameterEncoder.java @@ -24,12 +24,12 @@ import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.channel.Channel; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageEncoder; import org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpChannelConfig; import org.kaazing.k3po.driver.internal.netty.channel.ChannelAddress; -public class HttpParameterEncoder implements ConfigEncoder { +public class HttpParameterEncoder implements ChannelEncoder { private final MessageEncoder nameEncoder; private final List valueEncoders; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpRequestFormEncoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpRequestFormEncoder.java index 73a3a8c28..edeb84afd 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpRequestFormEncoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpRequestFormEncoder.java @@ -20,12 +20,12 @@ import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.channel.Channel; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageEncoder; import org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpChannelConfig; import org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpRequestForm; -public class HttpRequestFormEncoder implements ConfigEncoder { +public class HttpRequestFormEncoder implements ChannelEncoder { private MessageEncoder formEncoder; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpStatusEncoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpStatusEncoder.java index e2da96332..e07ac2c2f 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpStatusEncoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpStatusEncoder.java @@ -21,11 +21,11 @@ import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.channel.Channel; import org.jboss.netty.handler.codec.http.HttpResponseStatus; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageEncoder; import org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpChannelConfig; -public class HttpStatusEncoder implements ConfigEncoder { +public class HttpStatusEncoder implements ChannelEncoder { private final MessageEncoder codeEncoder; private final MessageEncoder reasonEncoder; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpTrailerEncoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpTrailerEncoder.java index f38966fb4..bab161bd6 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpTrailerEncoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpTrailerEncoder.java @@ -23,11 +23,11 @@ import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.channel.Channel; import org.jboss.netty.handler.codec.http.HttpHeaders; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageEncoder; import org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpChannelConfig; -public class HttpTrailerEncoder implements ConfigEncoder { +public class HttpTrailerEncoder implements ChannelEncoder { private final MessageEncoder nameEncoder; private final List valueEncoders; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpVersionEncoder.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpVersionEncoder.java index 7e1b70a08..e928e87ea 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpVersionEncoder.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/HttpVersionEncoder.java @@ -21,11 +21,11 @@ import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.channel.Channel; import org.jboss.netty.handler.codec.http.HttpVersion; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; import org.kaazing.k3po.driver.internal.behavior.handler.codec.MessageEncoder; import org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpChannelConfig; -public class HttpVersionEncoder implements ConfigEncoder { +public class HttpVersionEncoder implements ChannelEncoder { private MessageEncoder versionEncoder; diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadAdviseHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadAdviseHandler.java new file mode 100644 index 000000000..aed35efa5 --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadAdviseHandler.java @@ -0,0 +1,66 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior.handler.command; + +import static java.lang.String.format; +import static java.util.Collections.singletonList; +import static java.util.Objects.requireNonNull; +import static org.kaazing.k3po.driver.internal.netty.channel.Channels.adviseInput; + +import java.util.List; + +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; + +public class ReadAdviseHandler extends AbstractCommandHandler { + + private final Object value; + private final List encoders; + + public ReadAdviseHandler(Object value, ChannelEncoder encoder) { + this(value, singletonList(encoder)); + } + + public ReadAdviseHandler(Object value, List encoders) { + requireNonNull(encoders, "encoders"); + if (encoders.size() == 0) { + throw new IllegalArgumentException("must have at least one encoder"); + } + this.value = value; + this.encoders = encoders; + } + + @Override + protected void invokeCommand(ChannelHandlerContext ctx) throws Exception { + try { + Channel channel = ctx.getChannel(); + for (ChannelEncoder encoder : encoders) { + encoder.encode(channel); + } + adviseInput(ctx, getHandlerFuture(), value); + } + catch (Exception e) { + getHandlerFuture().setFailure(e); + } + } + + @Override + protected StringBuilder describe(StringBuilder sb) { + return sb.append(format("read advise %s %s", value, encoders)); + } + +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadConfigHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadConfigHandler.java index 67cc00782..085e041b9 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadConfigHandler.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadConfigHandler.java @@ -28,7 +28,7 @@ import org.jboss.netty.channel.ChannelFutureListener; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelStateEvent; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigDecoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelDecoder; // // Reading the configuration requires the channel to be readable as an indication that @@ -38,14 +38,14 @@ // public class ReadConfigHandler extends AbstractCommandHandler { - private final List decoders; + private final List decoders; private ChannelFuture readableFuture; - public ReadConfigHandler(ConfigDecoder decoder) { + public ReadConfigHandler(ChannelDecoder decoder) { this(singletonList(decoder)); } - public ReadConfigHandler(List decoders) { + public ReadConfigHandler(List decoders) { requireNonNull(decoders, "decoders"); if (decoders.size() == 0) { throw new IllegalArgumentException("must have at least one decoder"); @@ -88,7 +88,7 @@ private void invokeCommandWhenReadable(ChannelHandlerContext ctx) { Channel channel = ctx.getChannel(); try { - for (ConfigDecoder decoder : decoders) { + for (ChannelDecoder decoder : decoders) { decoder.decode(channel); } getHandlerFuture().setSuccess(); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteAdviseHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteAdviseHandler.java new file mode 100644 index 000000000..17476ba99 --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteAdviseHandler.java @@ -0,0 +1,66 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior.handler.command; + +import static java.lang.String.format; +import static java.util.Collections.singletonList; +import static java.util.Objects.requireNonNull; +import static org.kaazing.k3po.driver.internal.netty.channel.Channels.adviseOutput; + +import java.util.List; + +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; + +public class WriteAdviseHandler extends AbstractCommandHandler { + + private final Object value; + private final List encoders; + + public WriteAdviseHandler(Object value, ChannelEncoder encoder) { + this(value, singletonList(encoder)); + } + + public WriteAdviseHandler(Object value, List encoders) { + requireNonNull(encoders, "encoders"); + if (encoders.size() == 0) { + throw new IllegalArgumentException("must have at least one encoder"); + } + this.value = value; + this.encoders = encoders; + } + + @Override + protected void invokeCommand(ChannelHandlerContext ctx) throws Exception { + try { + Channel channel = ctx.getChannel(); + for (ChannelEncoder encoder : encoders) { + encoder.encode(channel); + } + adviseOutput(ctx, getHandlerFuture(), value); + } + catch (Exception e) { + getHandlerFuture().setFailure(e); + } + } + + @Override + protected StringBuilder describe(StringBuilder sb) { + return sb.append(format("write advise %s %s", value, encoders)); + } + +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteConfigHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteConfigHandler.java index 4cb4ac5ee..f8da14a2c 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteConfigHandler.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteConfigHandler.java @@ -23,17 +23,17 @@ import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; public class WriteConfigHandler extends AbstractCommandHandler { - private final List encoders; + private final List encoders; - public WriteConfigHandler(ConfigEncoder encoder) { + public WriteConfigHandler(ChannelEncoder encoder) { this(singletonList(encoder)); } - public WriteConfigHandler(List encoders) { + public WriteConfigHandler(List encoders) { requireNonNull(encoders, "encoders"); if (encoders.size() == 0) { throw new IllegalArgumentException("must have at least one encoder"); @@ -45,7 +45,7 @@ public WriteConfigHandler(List encoders) { protected void invokeCommand(ChannelHandlerContext ctx) throws Exception { try { Channel channel = ctx.getChannel(); - for (ConfigEncoder encoder : encoders) { + for (ChannelEncoder encoder : encoders) { encoder.encode(channel); } getHandlerFuture().setSuccess(); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/AbstractEventHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/AbstractEventHandler.java index 953af84b3..5bc27ae2c 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/AbstractEventHandler.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/AbstractEventHandler.java @@ -34,9 +34,11 @@ import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.OPEN; import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.OUTPUT_SHUTDOWN; import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.READ_ABORTED; +import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.READ_ADVISED; import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.UNBOUND; import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.UNKNOWN; import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.WRITE_ABORTED; +import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.WRITE_ADVISED; import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.WRITE_COMPLETED; import java.util.EnumSet; @@ -57,9 +59,11 @@ import org.kaazing.k3po.driver.internal.behavior.handler.ExecutionHandler; import org.kaazing.k3po.driver.internal.netty.channel.FlushEvent; import org.kaazing.k3po.driver.internal.netty.channel.ReadAbortEvent; +import org.kaazing.k3po.driver.internal.netty.channel.ReadAdviseEvent; import org.kaazing.k3po.driver.internal.netty.channel.ShutdownInputEvent; import org.kaazing.k3po.driver.internal.netty.channel.ShutdownOutputEvent; import org.kaazing.k3po.driver.internal.netty.channel.WriteAbortEvent; +import org.kaazing.k3po.driver.internal.netty.channel.WriteAdviseEvent; public abstract class AbstractEventHandler extends ExecutionHandler { @@ -69,7 +73,8 @@ public abstract class AbstractEventHandler extends ExecutionHandler { public enum ChannelEventKind { CHILD_OPEN, CHILD_CLOSED, OPEN, BOUND, CONNECTED, MESSAGE, WRITE_COMPLETED, DISCONNECTED, UNBOUND, CLOSED, EXCEPTION, - INTEREST_OPS, IDLE_STATE, INPUT_SHUTDOWN, OUTPUT_SHUTDOWN, FLUSHED, UNKNOWN, READ_ABORTED, WRITE_ABORTED + INTEREST_OPS, IDLE_STATE, INPUT_SHUTDOWN, OUTPUT_SHUTDOWN, FLUSHED, UNKNOWN, READ_ABORTED, WRITE_ABORTED, + READ_ADVISED, WRITE_ADVISED }; private final Set interestEvents; @@ -129,6 +134,10 @@ protected void handleUnexpectedEvent(ChannelHandlerContext ctx, ChannelEvent evt throw new ScriptProgressException(getRegionInfo(), "read aborted"); case WRITE_ABORTED: throw new ScriptProgressException(getRegionInfo(), "write aborted"); + case READ_ADVISED: + throw new ScriptProgressException(getRegionInfo(), "read advised ..."); + case WRITE_ADVISED: + throw new ScriptProgressException(getRegionInfo(), "write advised ..."); case MESSAGE: throw new ScriptProgressException(getRegionInfo(), "read ..."); case INPUT_SHUTDOWN: @@ -157,6 +166,14 @@ protected void handleUnexpectedEvent(ChannelHandlerContext ctx, ChannelEvent evt } private static ChannelEventKind asEventKind(ChannelEvent evt) { + if (evt instanceof ReadAdviseEvent) { + return READ_ADVISED; + } + + if (evt instanceof WriteAdviseEvent) { + return WRITE_ADVISED; + } + if (evt instanceof ReadAbortEvent) { return READ_ABORTED; } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ReadAdvisedHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ReadAdvisedHandler.java new file mode 100644 index 000000000..0ab81735d --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/ReadAdvisedHandler.java @@ -0,0 +1,89 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior.handler.event; + +import static java.util.Collections.singletonList; +import static java.util.EnumSet.of; +import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.READ_ADVISED; + +import java.util.List; +import java.util.Objects; + +import javax.el.ELException; + +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.kaazing.k3po.driver.internal.behavior.ScriptProgressException; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelDecoder; +import org.kaazing.k3po.driver.internal.netty.channel.ReadAdviseEvent; + +public class ReadAdvisedHandler extends AbstractEventHandler { + + private final Object value; + private final List decoders; + + public ReadAdvisedHandler(Object value, ChannelDecoder decoder) { + this(value, singletonList(decoder)); + } + + public ReadAdvisedHandler(Object value, List decoders) { + super(of(READ_ADVISED)); + this.value = value; + this.decoders = decoders; + } + + @Override + public void inputAdvised(ChannelHandlerContext ctx, ReadAdviseEvent e) { + + ChannelFuture handlerFuture = getHandlerFuture(); + assert handlerFuture != null; + + outer: + try { + if (!Objects.equals(value, e.getValue())) + { + handlerFuture.setFailure(new ScriptProgressException(getRegionInfo(), String.valueOf(e.getValue()))); + break outer; + } + + Channel channel = ctx.getChannel(); + for (ChannelDecoder decoder : decoders) { + boolean decoded = decoder.decode(channel); + if (!decoded) + { + handlerFuture.setFailure(new ScriptProgressException(getRegionInfo(), "decode failed")); + break outer; + } + } + handlerFuture.setSuccess(); + } + catch (ELException ele) { + ScriptProgressException exception = new ScriptProgressException(getRegionInfo(), ele.getMessage()); + exception.initCause(ele); + handlerFuture.setFailure(exception); + } + catch (Exception ex) { + handlerFuture.setFailure(ex); + } + } + + @Override + protected StringBuilder describe(StringBuilder sb) { + return sb.append(String.format("read advised %s %s", value, decoders)); + } +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/WriteAdvisedHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/WriteAdvisedHandler.java new file mode 100644 index 000000000..9a43122fd --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/event/WriteAdvisedHandler.java @@ -0,0 +1,89 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.behavior.handler.event; + +import static java.util.Collections.singletonList; +import static java.util.EnumSet.of; +import static org.kaazing.k3po.driver.internal.behavior.handler.event.AbstractEventHandler.ChannelEventKind.WRITE_ADVISED; + +import java.util.List; +import java.util.Objects; + +import javax.el.ELException; + +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.kaazing.k3po.driver.internal.behavior.ScriptProgressException; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelDecoder; +import org.kaazing.k3po.driver.internal.netty.channel.WriteAdviseEvent; + +public class WriteAdvisedHandler extends AbstractEventHandler { + + private final Object value; + private final List decoders; + + public WriteAdvisedHandler(Object value, ChannelDecoder decoder) { + this(value, singletonList(decoder)); + } + + public WriteAdvisedHandler(Object value, List decoders) { + super(of(WRITE_ADVISED)); + this.value = value; + this.decoders = decoders; + } + + @Override + public void outputAdvised(ChannelHandlerContext ctx, WriteAdviseEvent e) { + + ChannelFuture handlerFuture = getHandlerFuture(); + assert handlerFuture != null; + + outer: + try { + if (!Objects.equals(value, e.getValue())) + { + handlerFuture.setFailure(new ScriptProgressException(getRegionInfo(), String.valueOf(e.getValue()))); + break outer; + } + + Channel channel = ctx.getChannel(); + for (ChannelDecoder decoder : decoders) { + boolean decoded = decoder.decode(channel); + if (!decoded) + { + handlerFuture.setFailure(new ScriptProgressException(getRegionInfo(), "decode failed")); + break outer; + } + } + handlerFuture.setSuccess(); + } + catch (ELException ele) { + ScriptProgressException exception = new ScriptProgressException(getRegionInfo(), ele.getMessage()); + exception.initCause(ele); + handlerFuture.setFailure(exception); + } + catch (Exception ex) { + handlerFuture.setFailure(ex); + } + } + + @Override + protected StringBuilder describe(StringBuilder sb) { + return sb.append(String.format("read advised %s %s", value, decoders)); + } +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java index d5abd4cbd..ac87b5bf6 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/AssociateStreamsVisitor.java @@ -42,6 +42,8 @@ import org.kaazing.k3po.lang.internal.ast.AstPropertyNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstReadAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstReadClosedNode; import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; @@ -57,6 +59,8 @@ import org.kaazing.k3po.lang.internal.ast.AstUnboundNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstWriteCloseNode; import org.kaazing.k3po.lang.internal.ast.AstWriteConfigNode; @@ -374,6 +378,34 @@ public AstScriptNode visit(AstWriteConfigNode node, State state) { return null; } + @Override + public AstScriptNode visit(AstReadAdviseNode node, State state) + { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstWriteAdviseNode node, State state) + { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstReadAdvisedNode node, State state) + { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstWriteAdvisedNode node, State state) + { + state.streamables.add(node); + return null; + } + @Override public AstScriptNode visit(AstReadClosedNode node, State state) { state.streamables.add(node); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java index 408e86f7a..10e32ed7d 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/GenerateConfigurationVisitor.java @@ -119,6 +119,8 @@ import org.kaazing.k3po.lang.internal.ast.AstPropertyNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstReadAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstReadClosedNode; import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; @@ -133,6 +135,8 @@ import org.kaazing.k3po.lang.internal.ast.AstUnboundNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstWriteCloseNode; import org.kaazing.k3po.lang.internal.ast.AstWriteConfigNode; @@ -983,6 +987,7 @@ public Configuration visit(AstReadConfigNode node, State state) { throw new IllegalStateException("Unrecognized configuration type: " + node.getType()); } } + @Override public Configuration visit(AstWriteConfigNode node, State state) { @@ -1000,6 +1005,74 @@ public Configuration visit(AstWriteConfigNode node, State state) { } } + @Override + public Configuration visit(AstReadAdviseNode node, State state) { + + Function, MessageEncoder> encoderFactory = v -> v.accept(new GenerateWriteEncoderVisitor(), null); + ChannelHandler handler = behaviorSystem.newReadAdviseHandler(node, encoderFactory); + + if (handler != null) { + Map pipelineAsMap = state.pipelineAsMap; + String handlerName = String.format("readAdvise#%d (%s)", pipelineAsMap.size() + 1, node.getType().getName()); + pipelineAsMap.put(handlerName, handler); + return state.configuration; + } + else { + throw new IllegalStateException("Unrecognized advisory type: " + node.getType()); + } + } + + @Override + public Configuration visit(AstWriteAdviseNode node, State state) { + + Function, MessageEncoder> encoderFactory = v -> v.accept(new GenerateWriteEncoderVisitor(), null); + ChannelHandler handler = behaviorSystem.newWriteAdviseHandler(node, encoderFactory); + + if (handler != null) { + Map pipelineAsMap = state.pipelineAsMap; + String handlerName = String.format("writeAdvise#%d (%s)", pipelineAsMap.size() + 1, node.getType().getName()); + pipelineAsMap.put(handlerName, handler); + return state.configuration; + } + else { + throw new IllegalStateException("Unrecognized advisory type: " + node.getType()); + } + } + + @Override + public Configuration visit(AstReadAdvisedNode node, State state) { + + Function decoderFactory = m -> m.accept(new GenerateReadDecoderVisitor(), state.configuration); + ChannelHandler handler = behaviorSystem.newReadAdvisedHandler(node, decoderFactory); + + if (handler != null) { + Map pipelineAsMap = state.pipelineAsMap; + String handlerName = String.format("readAdvised#%d (%s)", pipelineAsMap.size() + 1, node.getType().getName()); + pipelineAsMap.put(handlerName, handler); + return state.configuration; + } + else { + throw new IllegalStateException("Unrecognized advisory type: " + node.getType()); + } + } + + @Override + public Configuration visit(AstWriteAdvisedNode node, State state) { + + Function decoderFactory = m -> m.accept(new GenerateReadDecoderVisitor(), state.configuration); + ChannelHandler handler = behaviorSystem.newWriteAdvisedHandler(node, decoderFactory); + + if (handler != null) { + Map pipelineAsMap = state.pipelineAsMap; + String handlerName = String.format("writeAdvised#%d (%s)", pipelineAsMap.size() + 1, node.getType().getName()); + pipelineAsMap.put(handlerName, handler); + return state.configuration; + } + else { + throw new IllegalStateException("Unrecognized advisory type: " + node.getType()); + } + } + @Override public Configuration visit(AstReadClosedNode node, State state) { InputShutdownHandler handler = new InputShutdownHandler(); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java index 953c8364a..016413f5a 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectBarriersVisitor.java @@ -38,6 +38,8 @@ import org.kaazing.k3po.lang.internal.ast.AstPropertyNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstReadAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstReadClosedNode; import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; @@ -52,6 +54,8 @@ import org.kaazing.k3po.lang.internal.ast.AstUnboundNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstWriteCloseNode; import org.kaazing.k3po.lang.internal.ast.AstWriteConfigNode; @@ -347,6 +351,30 @@ public AstScriptNode visit(AstWriteConfigNode node, State state) { return null; } + @Override + public AstScriptNode visit(AstReadAdviseNode node, State state) { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstWriteAdviseNode node, State state) { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstReadAdvisedNode node, State state) { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstWriteAdvisedNode node, State state) { + state.streamables.add(node); + return null; + } + @Override public AstScriptNode visit(AstReadClosedNode node, State state) { state.streamables.add(node); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java index 2c1ed0bf6..92b07a615 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectEventsVisitor.java @@ -37,6 +37,8 @@ import org.kaazing.k3po.lang.internal.ast.AstPropertyNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstReadAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstReadClosedNode; import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; @@ -51,6 +53,8 @@ import org.kaazing.k3po.lang.internal.ast.AstUnboundNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstWriteCloseNode; import org.kaazing.k3po.lang.internal.ast.AstWriteConfigNode; @@ -567,6 +571,58 @@ public AstScriptNode visit(AstWriteConfigNode node, State state) { return null; } + @Override + public AstScriptNode visit(AstReadAdviseNode node, State state) { + switch (state.connectivityState) { + case NONE: + case CONNECTED: + break; + default: + throw new IllegalStateException(String.format("Unexpected \"%s\" before connected", node)); + } + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstWriteAdviseNode node, State state) { + switch (state.connectivityState) { + case NONE: + case CONNECTED: + break; + default: + throw new IllegalStateException(String.format("Unexpected \"%s\" before connected", node)); + } + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstReadAdvisedNode node, State state) { + switch (state.connectivityState) { + case NONE: + case CONNECTED: + break; + default: + throw new IllegalStateException(String.format("Unexpected \"%s\" before connected", node)); + } + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstWriteAdvisedNode node, State state) { + switch (state.connectivityState) { + case NONE: + case CONNECTED: + break; + default: + throw new IllegalStateException(String.format("Unexpected \"%s\" before connected", node)); + } + state.streamables.add(node); + return null; + } + @Override public AstScriptNode visit(AstReadClosedNode node, State state) { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java index 33a1555e9..829b3b324 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/InjectFlushVisitor.java @@ -37,6 +37,8 @@ import org.kaazing.k3po.lang.internal.ast.AstPropertyNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstReadAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstReadClosedNode; import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; @@ -51,6 +53,8 @@ import org.kaazing.k3po.lang.internal.ast.AstUnboundNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstWriteCloseNode; import org.kaazing.k3po.lang.internal.ast.AstWriteConfigNode; @@ -385,6 +389,30 @@ public AstScriptNode visit(AstWriteConfigNode node, State state) { return null; } + @Override + public AstScriptNode visit(AstReadAdviseNode node, State state) { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstWriteAdviseNode node, State state) { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstReadAdvisedNode node, State state) { + state.streamables.add(node); + return null; + } + + @Override + public AstScriptNode visit(AstWriteAdvisedNode node, State state) { + state.streamables.add(node); + return null; + } + @Override public AstScriptNode visit(AstReadClosedNode node, State state) { state.streamables.add(node); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java index c2ca49a76..bae35118b 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/visitor/ValidateStreamsVisitor.java @@ -36,6 +36,8 @@ import org.kaazing.k3po.lang.internal.ast.AstPropertyNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstReadAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstReadClosedNode; import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; @@ -50,6 +52,8 @@ import org.kaazing.k3po.lang.internal.ast.AstUnboundNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstWriteCloseNode; import org.kaazing.k3po.lang.internal.ast.AstWriteConfigNode; @@ -176,6 +180,62 @@ public AstScriptNode visit(AstWriteConfigNode node, State state) { return null; } + @Override + public AstScriptNode visit(AstReadAdviseNode node, State state) { + + switch (state.readState) { + case OPEN: + case CLOSED: + break; + default: + throw new IllegalStateException(String.format("Unexpected read advise command (%s) while writing in state %s", node + .toString().trim(), state.writeState)); + } + return null; + } + + @Override + public AstScriptNode visit(AstReadAdvisedNode node, State state) { + + switch (state.readState) { + case OPEN: + case CLOSED: + break; + default: + throw new IllegalStateException(String.format("Unexpected read advised event (%s) while writing in state %s", node + .toString().trim(), state.writeState)); + } + return null; + } + + @Override + public AstScriptNode visit(AstWriteAdviseNode node, State state) { + + switch (state.writeState) { + case OPEN: + case CLOSED: + break; + default: + throw new IllegalStateException(String.format("Unexpected write advise command (%s) while writing in state %s", node + .toString().trim(), state.writeState)); + } + return null; + } + + @Override + public AstScriptNode visit(AstWriteAdvisedNode node, State state) { + + switch (state.writeState) { + case OPEN: + case CLOSED: + break; + default: + throw new IllegalStateException(String.format("Unexpected write advised event (%s) while writing in state %s", node + .toString().trim(), state.writeState)); + } + return null; + } + @Override public AstScriptNode visit(AstReadClosedNode node, State state) { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/ext/tls/TlsBehaviorSystem.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/ext/tls/TlsBehaviorSystem.java index 403ccd53e..243fa2877 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/ext/tls/TlsBehaviorSystem.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/ext/tls/TlsBehaviorSystem.java @@ -21,8 +21,12 @@ import java.util.Set; import org.kaazing.k3po.driver.internal.behavior.BehaviorSystemSpi; +import org.kaazing.k3po.driver.internal.behavior.ReadAdviseFactory; +import org.kaazing.k3po.driver.internal.behavior.ReadAdvisedFactory; import org.kaazing.k3po.driver.internal.behavior.ReadConfigFactory; import org.kaazing.k3po.driver.internal.behavior.ReadOptionFactory; +import org.kaazing.k3po.driver.internal.behavior.WriteAdviseFactory; +import org.kaazing.k3po.driver.internal.behavior.WriteAdvisedFactory; import org.kaazing.k3po.driver.internal.behavior.WriteConfigFactory; import org.kaazing.k3po.driver.internal.behavior.WriteOptionFactory; import org.kaazing.k3po.lang.types.StructuredTypeInfo; @@ -36,12 +40,21 @@ public class TlsBehaviorSystem implements BehaviorSystemSpi { private final Map readConfigFactories; private final Map writeConfigFactories; + private final Map readAdviseFactories; + private final Map writeAdviseFactories; + private final Map readAdvisedFactories; + private final Map writeAdvisedFactories; + public TlsBehaviorSystem() { this.readOptionFactories = emptyMap(); this.writeOptionFactories = emptyMap(); this.readConfigFactories = emptyMap(); this.writeConfigFactories = emptyMap(); + this.readAdviseFactories = emptyMap(); + this.writeAdviseFactories = emptyMap(); + this.readAdvisedFactories = emptyMap(); + this.writeAdvisedFactories = emptyMap(); } @Override @@ -70,6 +83,46 @@ public WriteConfigFactory writeConfigFactory( return writeConfigFactories.get(configType); } + @Override + public Set getReadAdvisoryTypes() + { + return readAdviseFactories.keySet(); + } + + @Override + public Set getWriteAdvisoryTypes() + { + return writeAdviseFactories.keySet(); + } + + @Override + public ReadAdviseFactory readAdviseFactory( + StructuredTypeInfo advisoryType) + { + return readAdviseFactories.get(advisoryType); + } + + @Override + public ReadAdvisedFactory readAdvisedFactory( + StructuredTypeInfo advisoryType) + { + return readAdvisedFactories.get(advisoryType); + } + + @Override + public WriteAdviseFactory writeAdviseFactory( + StructuredTypeInfo advisoryType) + { + return writeAdviseFactories.get(advisoryType); + } + + @Override + public WriteAdvisedFactory writeAdvisedFactory( + StructuredTypeInfo advisoryType) + { + return writeAdvisedFactories.get(advisoryType); + } + @Override public Set> getReadOptionTypes() { diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/ext/tls/TlsTypeSystem.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/ext/tls/TlsTypeSystem.java index e87b991f4..501e568ec 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/ext/tls/TlsTypeSystem.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/ext/tls/TlsTypeSystem.java @@ -43,6 +43,8 @@ public final class TlsTypeSystem implements TypeSystemSpi private final Set> writeOptions; private final Set readConfigs; private final Set writeConfigs; + private final Set readAdvisories; + private final Set writeAdvisories; public TlsTypeSystem() { @@ -70,6 +72,8 @@ public TlsTypeSystem() this.writeOptions = emptySet(); this.readConfigs = emptySet(); this.writeConfigs = emptySet();; + this.readAdvisories = emptySet(); + this.writeAdvisories = emptySet(); } @Override @@ -113,4 +117,16 @@ public Set writeConfigs() { return writeConfigs; } + + @Override + public Set readAdvisories() + { + return readAdvisories; + } + + @Override + public Set writeAdvisories() + { + return writeAdvisories; + } } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/channel/AbstractChannelSink.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/channel/AbstractChannelSink.java index 0e8d1c5da..0af637778 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/channel/AbstractChannelSink.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/channel/AbstractChannelSink.java @@ -21,9 +21,11 @@ import org.jboss.netty.channel.MessageEvent; import org.kaazing.k3po.driver.internal.netty.channel.FlushEvent; import org.kaazing.k3po.driver.internal.netty.channel.ReadAbortEvent; +import org.kaazing.k3po.driver.internal.netty.channel.ReadAdviseEvent; import org.kaazing.k3po.driver.internal.netty.channel.ShutdownInputEvent; import org.kaazing.k3po.driver.internal.netty.channel.ShutdownOutputEvent; import org.kaazing.k3po.driver.internal.netty.channel.WriteAbortEvent; +import org.kaazing.k3po.driver.internal.netty.channel.WriteAdviseEvent; public abstract class AbstractChannelSink extends org.jboss.netty.channel.AbstractChannelSink { @@ -71,6 +73,10 @@ public void eventSunk(ChannelPipeline pipeline, ChannelEvent e) throws Exception abortInputRequested(pipeline, (ReadAbortEvent) e); } else if (e instanceof WriteAbortEvent) { abortOutputRequested(pipeline, (WriteAbortEvent) e); + } else if (e instanceof ReadAdviseEvent) { + adviseInputRequested(pipeline, (ReadAdviseEvent) e); + } else if (e instanceof WriteAdviseEvent) { + adviseOutputRequested(pipeline, (WriteAdviseEvent) e); } else { eventSunk0(pipeline, e); } @@ -109,6 +115,12 @@ protected void abortInputRequested(ChannelPipeline pipeline, ReadAbortEvent evt) protected void abortOutputRequested(ChannelPipeline pipeline, WriteAbortEvent evt) throws Exception { } + protected void adviseInputRequested(ChannelPipeline pipeline, ReadAdviseEvent evt) throws Exception { + } + + protected void adviseOutputRequested(ChannelPipeline pipeline, WriteAdviseEvent evt) throws Exception { + } + protected void shutdownInputRequested(ChannelPipeline pipeline, ShutdownInputEvent evt) throws Exception { } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/Channels.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/Channels.java index 98ab2556f..7aa2fe92d 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/Channels.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/Channels.java @@ -183,7 +183,6 @@ public static ChannelFuture abortOutput(Channel channel) { return future; } - public static void abortOutput(ChannelHandlerContext ctx, ChannelFuture future) { ctx.sendDownstream(new DownstreamWriteAbortEvent(ctx.getChannel(), future)); } @@ -199,7 +198,6 @@ public static ChannelFuture abortInput(Channel channel) { return future; } - public static void abortInput(ChannelHandlerContext ctx, ChannelFuture future) { ctx.sendDownstream(new DownstreamReadAbortEvent(ctx.getChannel(), future)); } @@ -208,6 +206,36 @@ public static void fireInputAborted(Channel channel) { channel.getPipeline().sendUpstream(new UpstreamReadAbortEvent(channel)); } + public static ChannelFuture adviseOutput(Channel channel, Object value) { + ChannelFuture future = future(channel); + channel.getPipeline().sendDownstream( + new DownstreamWriteAdviseEvent(channel, future, value)); + return future; + } + + public static void adviseOutput(ChannelHandlerContext ctx, ChannelFuture future, Object value) { + ctx.sendDownstream(new DownstreamWriteAdviseEvent(ctx.getChannel(), future, value)); + } + + public static void fireOutputAdvised(Channel channel, Object value) { + channel.getPipeline().sendUpstream(new UpstreamWriteAdviseEvent(channel, value)); + } + + public static ChannelFuture adviseInput(Channel channel, Object value) { + ChannelFuture future = future(channel); + channel.getPipeline().sendDownstream( + new DownstreamReadAdviseEvent(channel, future, value)); + return future; + } + + public static void adviseInput(ChannelHandlerContext ctx, ChannelFuture future, Object value) { + ctx.sendDownstream(new DownstreamReadAdviseEvent(ctx.getChannel(), future, value)); + } + + public static void fireInputAdvised(Channel channel, Object value) { + channel.getPipeline().sendUpstream(new UpstreamReadAdviseEvent(channel, value)); + } + public static ChannelFuture shutdownOutputOrClose(Channel channel) { if (channel instanceof AbstractChannel) { return shutdownOutput(channel); diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/DownstreamReadAdviseEvent.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/DownstreamReadAdviseEvent.java new file mode 100644 index 000000000..48beeefad --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/DownstreamReadAdviseEvent.java @@ -0,0 +1,68 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.netty.channel; + +import static java.util.Objects.requireNonNull; + +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelFuture; + +final class DownstreamReadAdviseEvent implements ReadAdviseEvent { + + private final Channel channel; + private final ChannelFuture future; + private final Object value; + + DownstreamReadAdviseEvent( + Channel channel, + ChannelFuture future, + Object value) { + requireNonNull(channel); + requireNonNull(future); + this.channel = channel; + this.future = future; + this.value = value; + } + + @Override + public Channel getChannel() { + return channel; + } + + @Override + public ChannelFuture getFuture() { + return future; + } + + @Override + public Object getValue() { + return value; + } + + @Override + public String toString() { + String channelString = getChannel().toString(); + StringBuilder buf = new StringBuilder(channelString.length() + 64); + buf.append(channelString); + buf.append(" READ_ADVISE_REQUEST"); + if (value != null) { + buf.append(" "); + buf.append(value); + } + return buf.toString(); + } + +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/DownstreamWriteAdviseEvent.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/DownstreamWriteAdviseEvent.java new file mode 100644 index 000000000..b7f828a50 --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/DownstreamWriteAdviseEvent.java @@ -0,0 +1,68 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.netty.channel; + +import static java.util.Objects.requireNonNull; + +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelFuture; + +final class DownstreamWriteAdviseEvent implements WriteAdviseEvent { + + private final Channel channel; + private final ChannelFuture future; + private final Object value; + + DownstreamWriteAdviseEvent( + Channel channel, + ChannelFuture future, + Object value) { + requireNonNull(channel); + requireNonNull(future); + this.channel = channel; + this.future = future; + this.value = value; + } + + @Override + public Channel getChannel() { + return channel; + } + + @Override + public ChannelFuture getFuture() { + return future; + } + + @Override + public Object getValue() { + return value; + } + + @Override + public String toString() { + String channelString = getChannel().toString(); + StringBuilder buf = new StringBuilder(channelString.length() + 64); + buf.append(channelString); + buf.append(" WRITE_ADVISE_REQUEST"); + if (value != null) { + buf.append(" "); + buf.append(value); + } + return buf.toString(); + } + +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/ReadAdviseEvent.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/ReadAdviseEvent.java new file mode 100644 index 000000000..be4f8252a --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/ReadAdviseEvent.java @@ -0,0 +1,23 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.netty.channel; + +import org.jboss.netty.channel.ChannelEvent; + +public interface ReadAdviseEvent extends ChannelEvent { + + Object getValue(); +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelDownstreamHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelDownstreamHandler.java index 34ca00660..11631e1dd 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelDownstreamHandler.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelDownstreamHandler.java @@ -37,6 +37,12 @@ else if (e instanceof ReadAbortEvent) { else if (e instanceof WriteAbortEvent) { abortOutputRequested(ctx, (WriteAbortEvent) e); } + else if (e instanceof ReadAdviseEvent) { + adviseInputRequested(ctx, (ReadAdviseEvent) e); + } + else if (e instanceof WriteAdviseEvent) { + adviseOutputRequested(ctx, (WriteAdviseEvent) e); + } else { super.handleDownstream(ctx, e); } @@ -62,4 +68,12 @@ public void abortOutputRequested(ChannelHandlerContext ctx, WriteAbortEvent e) { ctx.sendDownstream(e); } + public void adviseInputRequested(ChannelHandlerContext ctx, ReadAdviseEvent e) { + ctx.sendDownstream(e); + } + + public void adviseOutputRequested(ChannelHandlerContext ctx, WriteAdviseEvent e) { + ctx.sendDownstream(e); + } + } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelHandler.java index fdbe43ffd..49e85decc 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelHandler.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelHandler.java @@ -38,6 +38,12 @@ else if (e instanceof ReadAbortEvent) { else if (e instanceof WriteAbortEvent) { outputAborted(ctx, (WriteAbortEvent) e); } + else if (e instanceof ReadAdviseEvent) { + inputAdvised(ctx, (ReadAdviseEvent) e); + } + else if (e instanceof WriteAdviseEvent) { + outputAdvised(ctx, (WriteAdviseEvent) e); + } else { super.handleUpstream(ctx, e); } @@ -63,6 +69,14 @@ public void outputAborted(ChannelHandlerContext ctx, WriteAbortEvent e) { ctx.sendUpstream(e); } + public void inputAdvised(ChannelHandlerContext ctx, ReadAdviseEvent e) { + ctx.sendUpstream(e); + } + + public void outputAdvised(ChannelHandlerContext ctx, WriteAdviseEvent e) { + ctx.sendUpstream(e); + } + @Override public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof ShutdownInputEvent) { @@ -80,6 +94,12 @@ else if (e instanceof ReadAbortEvent) { else if (e instanceof WriteAbortEvent) { abortOutputRequested(ctx, (WriteAbortEvent) e); } + else if (e instanceof ReadAdviseEvent) { + adviseInputRequested(ctx, (ReadAdviseEvent) e); + } + else if (e instanceof WriteAdviseEvent) { + adviseOutputRequested(ctx, (WriteAdviseEvent) e); + } else { super.handleDownstream(ctx, e); } @@ -105,4 +125,12 @@ public void abortOutputRequested(ChannelHandlerContext ctx, WriteAbortEvent e) { ctx.sendDownstream(e); } + public void adviseInputRequested(ChannelHandlerContext ctx, ReadAdviseEvent e) { + ctx.sendDownstream(e); + } + + public void adviseOutputRequested(ChannelHandlerContext ctx, WriteAdviseEvent e) { + ctx.sendDownstream(e); + } + } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelUpstreamHandler.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelUpstreamHandler.java index 479b286e4..4d7b8e5c1 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelUpstreamHandler.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/SimpleChannelUpstreamHandler.java @@ -38,6 +38,12 @@ else if (e instanceof ReadAbortEvent) { else if (e instanceof WriteAbortEvent) { outputAborted(ctx, (WriteAbortEvent) e); } + else if (e instanceof ReadAdviseEvent) { + inputAdvised(ctx, (ReadAdviseEvent) e); + } + else if (e instanceof WriteAdviseEvent) { + outputAdvised(ctx, (WriteAdviseEvent) e); + } else { super.handleUpstream(ctx, e); } @@ -62,4 +68,12 @@ public void inputAborted(ChannelHandlerContext ctx, ReadAbortEvent e) { public void outputAborted(ChannelHandlerContext ctx, WriteAbortEvent e) { ctx.sendUpstream(e); } + + public void inputAdvised(ChannelHandlerContext ctx, ReadAdviseEvent e) { + ctx.sendUpstream(e); + } + + public void outputAdvised(ChannelHandlerContext ctx, WriteAdviseEvent e) { + ctx.sendUpstream(e); + } } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/UpstreamReadAdviseEvent.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/UpstreamReadAdviseEvent.java new file mode 100644 index 000000000..7a4f0fa8f --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/UpstreamReadAdviseEvent.java @@ -0,0 +1,65 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.netty.channel; + +import static java.util.Objects.requireNonNull; +import static org.jboss.netty.channel.Channels.succeededFuture; + +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelFuture; + +final class UpstreamReadAdviseEvent implements ReadAdviseEvent { + + private final Channel channel; + private final Object value; + + UpstreamReadAdviseEvent( + Channel channel, + Object value) { + requireNonNull(channel); + this.channel = channel; + this.value = value; + } + + @Override + public Channel getChannel() { + return channel; + } + + @Override + public ChannelFuture getFuture() { + return succeededFuture(channel); + } + + @Override + public Object getValue() { + return value; + } + + @Override + public String toString() { + String channelString = getChannel().toString(); + StringBuilder buf = new StringBuilder(channelString.length() + 64); + buf.append(channelString); + buf.append(" READ_ADVISED"); + if (value != null) { + buf.append(" "); + buf.append(value); + } + return buf.toString(); + } + +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/UpstreamWriteAdviseEvent.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/UpstreamWriteAdviseEvent.java new file mode 100644 index 000000000..306dc7951 --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/UpstreamWriteAdviseEvent.java @@ -0,0 +1,65 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.netty.channel; + +import static java.util.Objects.requireNonNull; +import static org.jboss.netty.channel.Channels.succeededFuture; + +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelFuture; + +final class UpstreamWriteAdviseEvent implements WriteAdviseEvent { + + private final Channel channel; + private final Object value; + + UpstreamWriteAdviseEvent( + Channel channel, + Object value) { + requireNonNull(channel); + this.channel = channel; + this.value = value; + } + + @Override + public Channel getChannel() { + return channel; + } + + @Override + public ChannelFuture getFuture() { + return succeededFuture(channel); + } + + @Override + public Object getValue() { + return value; + } + + @Override + public String toString() { + String channelString = getChannel().toString(); + StringBuilder buf = new StringBuilder(channelString.length() + 64); + buf.append(channelString); + buf.append(" WRITE_ADVISED"); + if (value != null) { + buf.append(" "); + buf.append(value); + } + return buf.toString(); + } + +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/WriteAdviseEvent.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/WriteAdviseEvent.java new file mode 100644 index 000000000..a9f08f212 --- /dev/null +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/WriteAdviseEvent.java @@ -0,0 +1,23 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.driver.internal.netty.channel; + +import org.jboss.netty.channel.ChannelEvent; + +public interface WriteAdviseEvent extends ChannelEvent { + + Object getValue(); +} diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/types/AgronaTypeSystem.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/types/AgronaTypeSystem.java index fe146f3cc..8200204ac 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/types/AgronaTypeSystem.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/types/AgronaTypeSystem.java @@ -34,6 +34,8 @@ public final class AgronaTypeSystem implements TypeSystemSpi private final Set> writeOptions; private final Set readConfigs; private final Set writeConfigs; + private final Set readAdvisories; + private final Set writeAdvisories; public AgronaTypeSystem() { @@ -54,6 +56,8 @@ public AgronaTypeSystem() this.writeOptions = emptySet(); this.readConfigs = emptySet(); this.writeConfigs = emptySet(); + this.readAdvisories = emptySet(); + this.writeAdvisories = emptySet(); } @Override @@ -97,4 +101,16 @@ public Set writeConfigs() { return writeConfigs; } + + @Override + public Set readAdvisories() + { + return readAdvisories; + } + + @Override + public Set writeAdvisories() + { + return writeAdvisories; + } } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/types/FileTypeSystem.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/types/FileTypeSystem.java index 0286c77f8..bdda42ede 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/types/FileTypeSystem.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/types/FileTypeSystem.java @@ -38,6 +38,8 @@ public final class FileTypeSystem implements TypeSystemSpi private final Set> writeOptions; private final Set readConfigs; private final Set writeConfigs; + private final Set readAdvisories; + private final Set writeAdvisories; public FileTypeSystem() { @@ -55,6 +57,8 @@ public FileTypeSystem() this.writeOptions = singleton(OPTION_OFFSET); this.readConfigs = emptySet(); this.writeConfigs = emptySet(); + this.readAdvisories = emptySet(); + this.writeAdvisories = emptySet(); } @Override @@ -98,4 +102,16 @@ public Set writeConfigs() { return writeConfigs; } + + @Override + public Set readAdvisories() + { + return readAdvisories; + } + + @Override + public Set writeAdvisories() + { + return writeAdvisories; + } } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/types/HttpTypeSystem.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/types/HttpTypeSystem.java index f3a51b5a7..707d68b8e 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/types/HttpTypeSystem.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/types/HttpTypeSystem.java @@ -17,6 +17,7 @@ import static java.util.Arrays.asList; import static java.util.Collections.emptyList; +import static java.util.Collections.emptySet; import static java.util.Collections.singleton; import static java.util.Collections.singletonList; @@ -49,6 +50,8 @@ public final class HttpTypeSystem implements TypeSystemSpi private final Set> writeOptions; private final Set readConfigs; private final Set writeConfigs; + private final Set readAdvisories; + private final Set writeAdvisories; public HttpTypeSystem() { @@ -77,6 +80,9 @@ public HttpTypeSystem() writeConfigs.add(CONFIG_HOST); writeConfigs.add(CONFIG_CONTENT_LENGTH); this.writeConfigs = writeConfigs; + + this.readAdvisories = emptySet(); + this.writeAdvisories = emptySet(); } @Override @@ -120,4 +126,16 @@ public Set writeConfigs() { return writeConfigs; } + + @Override + public Set readAdvisories() + { + return readAdvisories; + } + + @Override + public Set writeAdvisories() + { + return writeAdvisories; + } } diff --git a/driver/src/main/java/org/kaazing/k3po/driver/internal/types/UdpTypeSystem.java b/driver/src/main/java/org/kaazing/k3po/driver/internal/types/UdpTypeSystem.java index a381f5c46..ae4c1961c 100644 --- a/driver/src/main/java/org/kaazing/k3po/driver/internal/types/UdpTypeSystem.java +++ b/driver/src/main/java/org/kaazing/k3po/driver/internal/types/UdpTypeSystem.java @@ -34,6 +34,8 @@ public final class UdpTypeSystem implements TypeSystemSpi private final Set> writeOptions; private final Set readConfigs; private final Set writeConfigs; + private final Set readAdvisories; + private final Set writeAdvisories; public UdpTypeSystem() { @@ -43,6 +45,8 @@ public UdpTypeSystem() this.writeOptions = emptySet(); this.readConfigs = emptySet(); this.writeConfigs = emptySet(); + this.readAdvisories = emptySet(); + this.writeAdvisories = emptySet(); } @Override @@ -86,4 +90,16 @@ public Set writeConfigs() { return writeConfigs; } + + @Override + public Set readAdvisories() + { + return readAdvisories; + } + + @Override + public Set writeAdvisories() + { + return writeAdvisories; + } } diff --git a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadConfigHandlerTest.java b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadConfigHandlerTest.java index 240bd8ffb..81ce246ef 100644 --- a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadConfigHandlerTest.java +++ b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/ReadConfigHandlerTest.java @@ -34,7 +34,7 @@ import org.junit.Before; import org.junit.Test; import org.kaazing.k3po.driver.internal.behavior.handler.ExecutionHandler; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigDecoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelDecoder; import org.kaazing.k3po.driver.internal.behavior.handler.prepare.PreparationEvent; import org.kaazing.k3po.driver.internal.jmock.Expectations; import org.kaazing.k3po.driver.internal.jmock.Mockery; @@ -49,7 +49,7 @@ public class ReadConfigHandlerTest { private ChannelFactory channelFactory; private ReadConfigHandler handler; private ExecutionHandler execution; - private ConfigDecoder decoder; + private ChannelDecoder decoder; @Before public void setUp() throws Exception { @@ -64,7 +64,7 @@ public void setUp() throws Exception { execution = new ExecutionHandler(); - decoder = context.mock(ConfigDecoder.class); + decoder = context.mock(ChannelDecoder.class); handler = new ReadConfigHandler(decoder); diff --git a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteConfigHandlerTest.java b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteConfigHandlerTest.java index 25c012689..11e180b0e 100644 --- a/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteConfigHandlerTest.java +++ b/driver/src/test/java/org/kaazing/k3po/driver/internal/behavior/handler/command/WriteConfigHandlerTest.java @@ -34,7 +34,7 @@ import org.junit.Before; import org.junit.Test; import org.kaazing.k3po.driver.internal.behavior.handler.ExecutionHandler; -import org.kaazing.k3po.driver.internal.behavior.handler.codec.ConfigEncoder; +import org.kaazing.k3po.driver.internal.behavior.handler.codec.ChannelEncoder; import org.kaazing.k3po.driver.internal.behavior.handler.prepare.PreparationEvent; import org.kaazing.k3po.driver.internal.jmock.Expectations; import org.kaazing.k3po.driver.internal.jmock.Mockery; @@ -49,7 +49,7 @@ public class WriteConfigHandlerTest { private ChannelFactory channelFactory; private WriteConfigHandler handler; private ExecutionHandler execution; - private ConfigEncoder encoder; + private ChannelEncoder encoder; @Before public void setUp() throws Exception { @@ -64,7 +64,7 @@ public void setUp() throws Exception { execution = new ExecutionHandler(); - encoder = context.mock(ConfigEncoder.class); + encoder = context.mock(ChannelEncoder.class); handler = new WriteConfigHandler(encoder); diff --git a/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 b/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 index 6fc5b01bc..dd0ec5cc9 100644 --- a/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 +++ b/lang/src/main/antlr4/org/kaazing/k3po/lang/parser/v2/Robot.g4 @@ -124,6 +124,8 @@ commandNode | writeCloseNode | writeAbortNode | readAbortNode + | writeAdviseNode + | readAdviseNode | closeNode ; @@ -136,6 +138,8 @@ eventNode | readClosedNode | readAbortedNode | writeAbortedNode + | readAdvisedNode + | writeAdvisedNode | disconnectedNode | unboundNode | closedNode @@ -177,6 +181,14 @@ writeAbortedNode : WriteKeyword AbortedKeyword ; +writeAdviseNode + : WriteKeyword AdviseKeyword QualifiedName writeValue* + ; + +writeAdvisedNode + : WriteKeyword AdvisedKeyword QualifiedName matcher* MissingKeyword? + ; + disconnectNode : DisconnectKeyword ; @@ -229,6 +241,14 @@ readAbortedNode : ReadKeyword AbortedKeyword ; +readAdviseNode + : ReadKeyword AdviseKeyword QualifiedName writeValue* + ; + +readAdvisedNode + : ReadKeyword AdvisedKeyword QualifiedName matcher* MissingKeyword? + ; + readClosedNode : ReadKeyword ClosedKeyword ; @@ -378,6 +398,14 @@ AcceptedKeyword : 'accepted' ; +AdviseKeyword + : 'advise' + ; + +AdvisedKeyword + : 'advised' + ; + AsKeyword : 'as' ; diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java index 820ee438b..84e5c9976 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstNode.java @@ -65,5 +65,10 @@ public interface Visitor { R visit(AstReadOptionNode node, P parameter); R visit(AstWriteOptionNode node, P parameter); + + R visit(AstReadAdviseNode node, P parameter); + R visit(AstWriteAdviseNode node, P parameter); + R visit(AstReadAdvisedNode node, P parameter); + R visit(AstWriteAdvisedNode node, P parameter); } } diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstReadAdviseNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstReadAdviseNode.java new file mode 100644 index 000000000..4bbc43ad4 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstReadAdviseNode.java @@ -0,0 +1,123 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast; + +import static org.kaazing.k3po.lang.internal.ast.util.AstUtil.equivalent; + +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.Map; + +import org.kaazing.k3po.lang.internal.ast.value.AstValue; +import org.kaazing.k3po.lang.types.StructuredTypeInfo; + +public class AstReadAdviseNode extends AstCommandNode { + + private StructuredTypeInfo type; + private Collection> values; + private Map> valuesByName; + + public AstReadAdviseNode() { + this.valuesByName = new LinkedHashMap<>(); + this.values = new LinkedList<>(); + } + + public void setType(StructuredTypeInfo type) { + this.type = type; + } + + public StructuredTypeInfo getType() { + return type; + } + + public void setValue(String name, AstValue value) { + valuesByName.put(name, value); + } + + public AstValue getValue(String name) { + return valuesByName.get(name); + } + + public void addValue(AstValue value) { + values.add(value); + } + + public Collection> getValues() { + return values; + } + + public AstValue getValue() { + + if (valuesByName.isEmpty()) { + switch (values.size()) { + case 0: + return null; + case 1: + return values.iterator().next(); + } + } + + throw new IllegalStateException("Multiple values available, yet assuming only one value"); + } + + @Override + public R accept(Visitor visitor, P parameter) { + return visitor.visit(this, parameter); + } + + @Override + protected int hashTo() { + int hashCode = getClass().hashCode(); + + if (type != null) { + hashCode <<= 4; + hashCode ^= type.hashCode(); + } + if (valuesByName != null) { + hashCode <<= 4; + hashCode ^= valuesByName.hashCode(); + } + + return hashCode; + } + + @Override + protected boolean equalTo(AstRegion that) { + return that instanceof AstReadAdviseNode && equalTo((AstReadAdviseNode) that); + } + + protected boolean equalTo(AstReadAdviseNode that) { + return equivalent(this.type, that.type) && + equivalent(this.values, that.values) && + equivalent(this.valuesByName, that.valuesByName); + } + + @Override + protected void describe(StringBuilder buf) { + super.describe(buf); + buf.append("read advise ").append(type); + for (Map.Entry> entry : valuesByName.entrySet()) { + String name = entry.getKey(); + AstValue value = entry.getValue(); + buf.append(' ').append(name).append('=').append(value); + } + for (AstValue value : values) { + buf.append(' ').append(value); + } + buf.append('\n'); + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstReadAdvisedNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstReadAdvisedNode.java new file mode 100644 index 000000000..593124f71 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstReadAdvisedNode.java @@ -0,0 +1,143 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast; + +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.Map; +import java.util.Objects; + +import org.kaazing.k3po.lang.internal.ast.matcher.AstValueMatcher; +import org.kaazing.k3po.lang.types.StructuredTypeInfo; + +public class AstReadAdvisedNode extends AstEventNode { + + private StructuredTypeInfo type; + private Map matchersByName; + private Collection matchers; + private boolean missing; + + public AstReadAdvisedNode() { + this.matchersByName = new LinkedHashMap<>(); + this.matchers = new LinkedList<>(); + } + + public void setType(StructuredTypeInfo type) { + this.type = type; + } + + public StructuredTypeInfo getType() { + return type; + } + + public void setMissing(boolean missing) { + this.missing = missing; + } + + public boolean isMissing() { + return missing; + } + + public AstValueMatcher getMatcher() { + + if (matchersByName.isEmpty()) { + switch (matchers.size()) { + case 0: + return null; + case 1: + return matchers.iterator().next(); + } + } + + throw new IllegalStateException("Multiple values available, yet assuming only one value"); + } + + public Collection getMatchers() { + return matchers; + } + + public AstValueMatcher getMatcher(String name) { + return matchersByName.get(name); + } + + public void setMatcher(String name, AstValueMatcher matcher) { + matchersByName.put(name, matcher); + } + + public void addMatcher(AstValueMatcher matcher) { + matchers.add(matcher); + } + + public void addMatchers(Collection matchers) { + this.matchers.addAll(matchers); + } + + @Override + public R accept(Visitor visitor, P parameter) { + return visitor.visit(this, parameter); + } + + @Override + protected int hashTo() { + int hashCode = getClass().hashCode(); + + if (type != null) { + hashCode <<= 4; + hashCode ^= type.hashCode(); + } + if (matchers != null) { + hashCode <<= 4; + hashCode ^= matchers.hashCode(); + } + if (matchersByName != null) { + hashCode <<= 4; + hashCode ^= matchersByName.hashCode(); + } + + hashCode <<= 4; + hashCode ^= Boolean.hashCode(missing); + + return hashCode; + } + + @Override + protected boolean equalTo(AstRegion that) { + return that instanceof AstReadAdvisedNode && equalTo((AstReadAdvisedNode) that); + } + + protected boolean equalTo(AstReadAdvisedNode that) { + return this.missing == that.missing && + Objects.equals(this.type, that.type) && + Objects.equals(this.matchers, that.matchers) && + Objects.equals(this.matchersByName, that.matchersByName); + } + + @Override + protected void describe(StringBuilder buf) { + super.describe(buf); + buf.append("read advised ").append(type); + for (Map.Entry entry : matchersByName.entrySet()) { + String name = entry.getKey(); + AstValueMatcher matcher = entry.getValue(); + buf.append(' ').append(name).append('=').append(matcher); + } + for (AstValueMatcher value : matchers) { + buf.append(' ').append(value); + } + buf.append('\n'); + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstWriteAdviseNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstWriteAdviseNode.java new file mode 100644 index 000000000..c6af919d3 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstWriteAdviseNode.java @@ -0,0 +1,123 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast; + +import static org.kaazing.k3po.lang.internal.ast.util.AstUtil.equivalent; + +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.Map; + +import org.kaazing.k3po.lang.internal.ast.value.AstValue; +import org.kaazing.k3po.lang.types.StructuredTypeInfo; + +public class AstWriteAdviseNode extends AstCommandNode { + + private StructuredTypeInfo type; + private Collection> values; + private Map> valuesByName; + + public AstWriteAdviseNode() { + this.valuesByName = new LinkedHashMap<>(); + this.values = new LinkedList<>(); + } + + public void setType(StructuredTypeInfo type) { + this.type = type; + } + + public StructuredTypeInfo getType() { + return type; + } + + public void setValue(String name, AstValue value) { + valuesByName.put(name, value); + } + + public AstValue getValue(String name) { + return valuesByName.get(name); + } + + public void addValue(AstValue value) { + values.add(value); + } + + public Collection> getValues() { + return values; + } + + public AstValue getValue() { + + if (valuesByName.isEmpty()) { + switch (values.size()) { + case 0: + return null; + case 1: + return values.iterator().next(); + } + } + + throw new IllegalStateException("Multiple values available, yet assuming only one value"); + } + + @Override + public R accept(Visitor visitor, P parameter) { + return visitor.visit(this, parameter); + } + + @Override + protected int hashTo() { + int hashCode = getClass().hashCode(); + + if (type != null) { + hashCode <<= 4; + hashCode ^= type.hashCode(); + } + if (valuesByName != null) { + hashCode <<= 4; + hashCode ^= valuesByName.hashCode(); + } + + return hashCode; + } + + @Override + protected boolean equalTo(AstRegion that) { + return that instanceof AstWriteAdviseNode && equalTo((AstWriteAdviseNode) that); + } + + protected boolean equalTo(AstWriteAdviseNode that) { + return equivalent(this.type, that.type) && + equivalent(this.values, that.values) && + equivalent(this.valuesByName, that.valuesByName); + } + + @Override + protected void describe(StringBuilder buf) { + super.describe(buf); + buf.append("write advise ").append(type); + for (Map.Entry> entry : valuesByName.entrySet()) { + String name = entry.getKey(); + AstValue value = entry.getValue(); + buf.append(' ').append(name).append('=').append(value); + } + for (AstValue value : values) { + buf.append(' ').append(value); + } + buf.append('\n'); + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstWriteAdvisedNode.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstWriteAdvisedNode.java new file mode 100644 index 000000000..7c14da234 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/AstWriteAdvisedNode.java @@ -0,0 +1,143 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast; + +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.Map; +import java.util.Objects; + +import org.kaazing.k3po.lang.internal.ast.matcher.AstValueMatcher; +import org.kaazing.k3po.lang.types.StructuredTypeInfo; + +public class AstWriteAdvisedNode extends AstEventNode { + + private StructuredTypeInfo type; + private Map matchersByName; + private Collection matchers; + private boolean missing; + + public AstWriteAdvisedNode() { + this.matchersByName = new LinkedHashMap<>(); + this.matchers = new LinkedList<>(); + } + + public void setType(StructuredTypeInfo type) { + this.type = type; + } + + public StructuredTypeInfo getType() { + return type; + } + + public void setMissing(boolean missing) { + this.missing = missing; + } + + public boolean isMissing() { + return missing; + } + + public AstValueMatcher getMatcher() { + + if (matchersByName.isEmpty()) { + switch (matchers.size()) { + case 0: + return null; + case 1: + return matchers.iterator().next(); + } + } + + throw new IllegalStateException("Multiple values available, yet assuming only one value"); + } + + public Collection getMatchers() { + return matchers; + } + + public AstValueMatcher getMatcher(String name) { + return matchersByName.get(name); + } + + public void setMatcher(String name, AstValueMatcher matcher) { + matchersByName.put(name, matcher); + } + + public void addMatcher(AstValueMatcher matcher) { + matchers.add(matcher); + } + + public void addMatchers(Collection matchers) { + this.matchers.addAll(matchers); + } + + @Override + public R accept(Visitor visitor, P parameter) { + return visitor.visit(this, parameter); + } + + @Override + protected int hashTo() { + int hashCode = getClass().hashCode(); + + if (type != null) { + hashCode <<= 4; + hashCode ^= type.hashCode(); + } + if (matchers != null) { + hashCode <<= 4; + hashCode ^= matchers.hashCode(); + } + if (matchersByName != null) { + hashCode <<= 4; + hashCode ^= matchersByName.hashCode(); + } + + hashCode <<= 4; + hashCode ^= Boolean.hashCode(missing); + + return hashCode; + } + + @Override + protected boolean equalTo(AstRegion that) { + return that instanceof AstWriteAdvisedNode && equalTo((AstWriteAdvisedNode) that); + } + + protected boolean equalTo(AstWriteAdvisedNode that) { + return this.missing == that.missing && + Objects.equals(this.type, that.type) && + Objects.equals(this.matchers, that.matchers) && + Objects.equals(this.matchersByName, that.matchersByName); + } + + @Override + protected void describe(StringBuilder buf) { + super.describe(buf); + buf.append("write advised ").append(type); + for (Map.Entry entry : matchersByName.entrySet()) { + String name = entry.getKey(); + AstValueMatcher matcher = entry.getValue(); + buf.append(' ').append(name).append('=').append(matcher); + } + for (AstValueMatcher value : matchers) { + buf.append(' ').append(value); + } + buf.append('\n'); + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAdviseNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAdviseNodeBuilder.java new file mode 100644 index 000000000..0f087d602 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAdviseNodeBuilder.java @@ -0,0 +1,127 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast.builder; + +import javax.el.ValueExpression; + +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstStreamNode; +import org.kaazing.k3po.lang.internal.ast.value.AstExpressionValue; +import org.kaazing.k3po.lang.internal.ast.value.AstLiteralBytesValue; +import org.kaazing.k3po.lang.internal.ast.value.AstLiteralTextValue; +import org.kaazing.k3po.lang.internal.el.ExpressionContext; +import org.kaazing.k3po.lang.types.StructuredTypeInfo; + +public class AstReadAdviseNodeBuilder extends AbstractAstStreamableNodeBuilder { + + public AstReadAdviseNodeBuilder() { + this(new AstReadAdviseNode()); + } + + private AstReadAdviseNodeBuilder(AstReadAdviseNode node) { + super(node, node); + } + + @Override + public AstReadAdviseNode done() { + return result; + } + + public AstReadAdviseNodeBuilder setType(StructuredTypeInfo type) { + node.setType(type); + return this; + } + + public AstReadAdviseNodeBuilder setValue(String name, String value) { + node.setValue(name, new AstLiteralTextValue(value)); + return this; + } + + public AstReadAdviseNodeBuilder setValue(String name, byte[] value) { + node.setValue(name, new AstLiteralBytesValue(value)); + return this; + } + + public AstReadAdviseNodeBuilder setValue(String name, ValueExpression value, ExpressionContext environment) { + node.setValue(name, new AstExpressionValue<>(value, environment)); + return this; + } + + public AstReadAdviseNodeBuilder addValue(String value) { + node.addValue(new AstLiteralTextValue(value)); + return this; + } + + public AstReadAdviseNodeBuilder addValue(byte[] value) { + node.addValue(new AstLiteralBytesValue(value)); + return this; + } + + public AstReadAdviseNodeBuilder addValue(ValueExpression value, ExpressionContext environment) { + node.addValue(new AstExpressionValue<>(value, environment)); + return this; + } + + public static class StreamNested> extends + AbstractAstStreamableNodeBuilder { + + public StreamNested(R builder) { + super(new AstReadAdviseNode(), builder); + } + + public StreamNested setType(StructuredTypeInfo type) { + node.setType(type); + return this; + } + + public StreamNested setValue(String name, String value) { + node.setValue(name, new AstLiteralTextValue(value)); + return this; + } + + public StreamNested setValue(String name, byte[] value) { + node.setValue(name, new AstLiteralBytesValue(value)); + return this; + } + + public StreamNested setValue(String name, ValueExpression value, ExpressionContext environment) { + node.setValue(name, new AstExpressionValue<>(value, environment)); + return this; + } + + public StreamNested addValue(String value) { + node.addValue(new AstLiteralTextValue(value)); + return this; + } + + public StreamNested addValue(byte[] valueBytes) { + node.addValue(new AstLiteralBytesValue(valueBytes)); + return this; + } + + public StreamNested addValue(ValueExpression value, ExpressionContext environment) { + node.addValue(new AstExpressionValue<>(value, environment)); + return this; + } + + @Override + public R done() { + AstStreamNode streamNode = node(result); + streamNode.getStreamables().add(node); + return result; + } + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAdvisedNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAdvisedNodeBuilder.java new file mode 100644 index 000000000..1e585de9a --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstReadAdvisedNodeBuilder.java @@ -0,0 +1,253 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast.builder; + +import javax.el.ValueExpression; + +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; +import org.kaazing.k3po.lang.internal.ast.AstStreamNode; +import org.kaazing.k3po.lang.internal.ast.matcher.AstExactBytesMatcher; +import org.kaazing.k3po.lang.internal.ast.matcher.AstExactTextMatcher; +import org.kaazing.k3po.lang.internal.ast.matcher.AstExpressionMatcher; +import org.kaazing.k3po.lang.internal.ast.matcher.AstFixedLengthBytesMatcher; +import org.kaazing.k3po.lang.internal.ast.matcher.AstRegexMatcher; +import org.kaazing.k3po.lang.internal.ast.matcher.AstVariableLengthBytesMatcher; +import org.kaazing.k3po.lang.internal.el.ExpressionContext; +import org.kaazing.k3po.lang.internal.regex.NamedGroupPattern; +import org.kaazing.k3po.lang.types.StructuredTypeInfo; + +public class AstReadAdvisedNodeBuilder extends AbstractAstRejectableNodeBuilder { + + public AstReadAdvisedNodeBuilder() { + this(new AstReadAdvisedNode()); + } + + private AstReadAdvisedNodeBuilder(AstReadAdvisedNode node) { + super(node, node); + } + + @Override + public AstReadAdvisedNode done() { + return result; + } + + public AstReadAdvisedNodeBuilder setType(StructuredTypeInfo type) { + node.setType(type); + return this; + } + + public AstReadAdvisedNodeBuilder setMissing(boolean missing) { + node.setMissing(missing); + return this; + } + + public AstReadAdvisedNodeBuilder setMatcherFixedLengthBytes(String name, int valueLength) { + node.setMatcher(name, new AstFixedLengthBytesMatcher(valueLength)); + return this; + } + + public AstReadAdvisedNodeBuilder setMatcherExactText(String name, String valueExactText) { + node.setMatcher(name, new AstExactTextMatcher(valueExactText)); + return this; + } + + public AstReadAdvisedNodeBuilder setMatcherExactBytes(String name, byte[] valueBytes) { + node.setMatcher(name, new AstExactBytesMatcher(valueBytes)); + return this; + } + + public AstReadAdvisedNodeBuilder setMatcherExpression(String name, ValueExpression valueValueExpression, + ExpressionContext environment) { + node.setMatcher(name, new AstExpressionMatcher(valueValueExpression, environment)); + return this; + } + + public AstReadAdvisedNodeBuilder setMatcherFixedLengthBytes(String name, int valueLength, String valueCaptureName, + ExpressionContext environment) { + node.setMatcher(name, new AstFixedLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public AstReadAdvisedNodeBuilder setMatcherRegex(String name, NamedGroupPattern valuePattern, ExpressionContext environment) { + node.setMatcher(name, new AstRegexMatcher(valuePattern, environment)); + return this; + } + + public AstReadAdvisedNodeBuilder setMatcherVariableLengthBytes(String name, ValueExpression valueLength, + ExpressionContext environment) { + node.setMatcher(name, new AstVariableLengthBytesMatcher(valueLength, environment)); + return this; + } + + public AstReadAdvisedNodeBuilder setMatcherVariableLengthBytes(String name, ValueExpression valueLength, + String valueCaptureName, ExpressionContext environment) { + node.setMatcher(name, new AstVariableLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public AstReadAdvisedNodeBuilder addMatcherFixedLengthBytes(int valueLength) { + node.addMatcher(new AstFixedLengthBytesMatcher(valueLength)); + return this; + } + + public AstReadAdvisedNodeBuilder addMatcherExactText(String valueExactText) { + node.addMatcher(new AstExactTextMatcher(valueExactText)); + return this; + } + + public AstReadAdvisedNodeBuilder addMatcherExactBytes(byte[] valueBytes, ExpressionContext environment) { + node.addMatcher(new AstExactBytesMatcher(valueBytes)); + return this; + } + + public AstReadAdvisedNodeBuilder addMatcherExpression(ValueExpression valueValueExpression, ExpressionContext environment) { + node.addMatcher(new AstExpressionMatcher(valueValueExpression, environment)); + return this; + } + + public AstReadAdvisedNodeBuilder addMatcherFixedLengthBytes(int valueLength, String valueCaptureName, + ExpressionContext environment) { + node.addMatcher(new AstFixedLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public AstReadAdvisedNodeBuilder addMatcherRegex(NamedGroupPattern valuePattern, ExpressionContext environment) { + node.addMatcher(new AstRegexMatcher(valuePattern, environment)); + return this; + } + + public AstReadAdvisedNodeBuilder addMatcherVariableLengthBytes(ValueExpression valueLength, ExpressionContext environment) { + node.addMatcher(new AstVariableLengthBytesMatcher(valueLength, environment)); + return this; + } + + public AstReadAdvisedNodeBuilder addMatcherVariableLengthBytes(ValueExpression valueLength, String valueCaptureName, + ExpressionContext environment) { + node.addMatcher(new AstVariableLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public static class StreamNested> extends + AbstractAstStreamableNodeBuilder { + + public StreamNested(R builder) { + super(new AstReadAdvisedNode(), builder); + } + + public StreamNested setType(StructuredTypeInfo type) { + node.setType(type); + return this; + } + + public StreamNested setMissing(boolean missing) { + node.setMissing(missing); + return this; + } + + public StreamNested setMatcherFixedLengthBytes(String name, int valueLength) { + node.setMatcher(name, new AstFixedLengthBytesMatcher(valueLength)); + return this; + } + + public StreamNested setMatcherExactText(String name, String valueExactText) { + node.setMatcher(name, new AstExactTextMatcher(valueExactText)); + return this; + } + + public StreamNested setMatcherExactBytes(String name, byte[] valueBytes, ExpressionContext environment) { + node.setMatcher(name, new AstExactBytesMatcher(valueBytes)); + return this; + } + + public StreamNested setMatcherExpression(String name, ValueExpression valueValueExpression, + ExpressionContext environment) { + node.setMatcher(name, new AstExpressionMatcher(valueValueExpression, environment)); + return this; + } + + public StreamNested setMatcherFixedLengthBytes(String name, int valueLength, String valueCaptureName, + ExpressionContext environment) { + node.setMatcher(name, new AstFixedLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public StreamNested setMatcherRegex(String name, NamedGroupPattern valuePattern, ExpressionContext environment) { + node.setMatcher(name, new AstRegexMatcher(valuePattern, environment)); + return this; + } + + public StreamNested setMatcherVariableLengthBytes(String name, ValueExpression valueLength, + ExpressionContext environment) { + node.setMatcher(name, new AstVariableLengthBytesMatcher(valueLength, environment)); + return this; + } + + public StreamNested setMatcherVariableLengthBytes(String name, ValueExpression valueLength, String valueCaptureName, + ExpressionContext environment) { + node.setMatcher(name, new AstVariableLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public StreamNested addMatcherFixedLengthBytes(int valueLength) { + node.addMatcher(new AstFixedLengthBytesMatcher(valueLength)); + return this; + } + + public StreamNested addMatcherExactText(String valueExactText) { + node.addMatcher(new AstExactTextMatcher(valueExactText)); + return this; + } + + public StreamNested addMatcherExactBytes(byte[] valueBytes, ExpressionContext environment) { + node.addMatcher(new AstExactBytesMatcher(valueBytes)); + return this; + } + + public StreamNested addMatcherExpression(ValueExpression valueValueExpression, ExpressionContext environment) { + node.addMatcher(new AstExpressionMatcher(valueValueExpression, environment)); + return this; + } + + public StreamNested addMatcherFixedLengthBytes(int valueLength, String valueCaptureName, + ExpressionContext environment) { + node.addMatcher(new AstFixedLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public StreamNested addMatcherRegex(NamedGroupPattern valuePattern, ExpressionContext environment) { + node.addMatcher(new AstRegexMatcher(valuePattern, environment)); + return this; + } + + public StreamNested addMatcherVariableLengthBytes(ValueExpression valueLength, ExpressionContext environment) { + node.addMatcher(new AstVariableLengthBytesMatcher(valueLength, environment)); + return this; + } + + public StreamNested addMatcherVariableLengthBytes(ValueExpression valueLength, String valueCaptureName, + ExpressionContext environment) { + node.addMatcher(new AstVariableLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + @Override + public R done() { + AstStreamNode streamNode = node(result); + streamNode.getStreamables().add(node); + return result; + } + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstWriteAdviseNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstWriteAdviseNodeBuilder.java new file mode 100644 index 000000000..8d105a652 --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstWriteAdviseNodeBuilder.java @@ -0,0 +1,127 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast.builder; + +import javax.el.ValueExpression; + +import org.kaazing.k3po.lang.internal.ast.AstStreamNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.value.AstExpressionValue; +import org.kaazing.k3po.lang.internal.ast.value.AstLiteralBytesValue; +import org.kaazing.k3po.lang.internal.ast.value.AstLiteralTextValue; +import org.kaazing.k3po.lang.internal.el.ExpressionContext; +import org.kaazing.k3po.lang.types.StructuredTypeInfo; + +public class AstWriteAdviseNodeBuilder extends AbstractAstStreamableNodeBuilder { + + public AstWriteAdviseNodeBuilder() { + this(new AstWriteAdviseNode()); + } + + private AstWriteAdviseNodeBuilder(AstWriteAdviseNode node) { + super(node, node); + } + + @Override + public AstWriteAdviseNode done() { + return result; + } + + public AstWriteAdviseNodeBuilder setType(StructuredTypeInfo type) { + node.setType(type); + return this; + } + + public AstWriteAdviseNodeBuilder setValue(String name, String value) { + node.setValue(name, new AstLiteralTextValue(value)); + return this; + } + + public AstWriteAdviseNodeBuilder setValue(String name, byte[] value) { + node.setValue(name, new AstLiteralBytesValue(value)); + return this; + } + + public AstWriteAdviseNodeBuilder setValue(String name, ValueExpression value, ExpressionContext environment) { + node.setValue(name, new AstExpressionValue<>(value, environment)); + return this; + } + + public AstWriteAdviseNodeBuilder addValue(String value) { + node.addValue(new AstLiteralTextValue(value)); + return this; + } + + public AstWriteAdviseNodeBuilder addValue(byte[] value) { + node.addValue(new AstLiteralBytesValue(value)); + return this; + } + + public AstWriteAdviseNodeBuilder addValue(ValueExpression value, ExpressionContext environment) { + node.addValue(new AstExpressionValue<>(value, environment)); + return this; + } + + public static class StreamNested> extends + AbstractAstStreamableNodeBuilder { + + public StreamNested(R builder) { + super(new AstWriteAdviseNode(), builder); + } + + public StreamNested setType(StructuredTypeInfo type) { + node.setType(type); + return this; + } + + public StreamNested setValue(String name, String value) { + node.setValue(name, new AstLiteralTextValue(value)); + return this; + } + + public StreamNested setValue(String name, byte[] value) { + node.setValue(name, new AstLiteralBytesValue(value)); + return this; + } + + public StreamNested setValue(String name, ValueExpression value, ExpressionContext environment) { + node.setValue(name, new AstExpressionValue<>(value, environment)); + return this; + } + + public StreamNested addValue(String value) { + node.addValue(new AstLiteralTextValue(value)); + return this; + } + + public StreamNested addValue(byte[] valueBytes) { + node.addValue(new AstLiteralBytesValue(valueBytes)); + return this; + } + + public StreamNested addValue(ValueExpression value, ExpressionContext environment) { + node.addValue(new AstExpressionValue<>(value, environment)); + return this; + } + + @Override + public R done() { + AstStreamNode streamNode = node(result); + streamNode.getStreamables().add(node); + return result; + } + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstWriteAdvisedNodeBuilder.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstWriteAdvisedNodeBuilder.java new file mode 100644 index 000000000..bb313237a --- /dev/null +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/ast/builder/AstWriteAdvisedNodeBuilder.java @@ -0,0 +1,253 @@ +/** + * Copyright 2007-2015, Kaazing Corporation. All rights reserved. + * + * Licensed 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.kaazing.k3po.lang.internal.ast.builder; + +import javax.el.ValueExpression; + +import org.kaazing.k3po.lang.internal.ast.AstStreamNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; +import org.kaazing.k3po.lang.internal.ast.matcher.AstExactBytesMatcher; +import org.kaazing.k3po.lang.internal.ast.matcher.AstExactTextMatcher; +import org.kaazing.k3po.lang.internal.ast.matcher.AstExpressionMatcher; +import org.kaazing.k3po.lang.internal.ast.matcher.AstFixedLengthBytesMatcher; +import org.kaazing.k3po.lang.internal.ast.matcher.AstRegexMatcher; +import org.kaazing.k3po.lang.internal.ast.matcher.AstVariableLengthBytesMatcher; +import org.kaazing.k3po.lang.internal.el.ExpressionContext; +import org.kaazing.k3po.lang.internal.regex.NamedGroupPattern; +import org.kaazing.k3po.lang.types.StructuredTypeInfo; + +public class AstWriteAdvisedNodeBuilder extends AbstractAstRejectableNodeBuilder { + + public AstWriteAdvisedNodeBuilder() { + this(new AstWriteAdvisedNode()); + } + + private AstWriteAdvisedNodeBuilder(AstWriteAdvisedNode node) { + super(node, node); + } + + @Override + public AstWriteAdvisedNode done() { + return result; + } + + public AstWriteAdvisedNodeBuilder setType(StructuredTypeInfo type) { + node.setType(type); + return this; + } + + public AstWriteAdvisedNodeBuilder setMissing(boolean missing) { + node.setMissing(missing); + return this; + } + + public AstWriteAdvisedNodeBuilder setMatcherFixedLengthBytes(String name, int valueLength) { + node.setMatcher(name, new AstFixedLengthBytesMatcher(valueLength)); + return this; + } + + public AstWriteAdvisedNodeBuilder setMatcherExactText(String name, String valueExactText) { + node.setMatcher(name, new AstExactTextMatcher(valueExactText)); + return this; + } + + public AstWriteAdvisedNodeBuilder setMatcherExactBytes(String name, byte[] valueBytes) { + node.setMatcher(name, new AstExactBytesMatcher(valueBytes)); + return this; + } + + public AstWriteAdvisedNodeBuilder setMatcherExpression(String name, ValueExpression valueValueExpression, + ExpressionContext environment) { + node.setMatcher(name, new AstExpressionMatcher(valueValueExpression, environment)); + return this; + } + + public AstWriteAdvisedNodeBuilder setMatcherFixedLengthBytes(String name, int valueLength, String valueCaptureName, + ExpressionContext environment) { + node.setMatcher(name, new AstFixedLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public AstWriteAdvisedNodeBuilder setMatcherRegex(String name, NamedGroupPattern valuePattern, ExpressionContext environment) { + node.setMatcher(name, new AstRegexMatcher(valuePattern, environment)); + return this; + } + + public AstWriteAdvisedNodeBuilder setMatcherVariableLengthBytes(String name, ValueExpression valueLength, + ExpressionContext environment) { + node.setMatcher(name, new AstVariableLengthBytesMatcher(valueLength, environment)); + return this; + } + + public AstWriteAdvisedNodeBuilder setMatcherVariableLengthBytes(String name, ValueExpression valueLength, + String valueCaptureName, ExpressionContext environment) { + node.setMatcher(name, new AstVariableLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public AstWriteAdvisedNodeBuilder addMatcherFixedLengthBytes(int valueLength) { + node.addMatcher(new AstFixedLengthBytesMatcher(valueLength)); + return this; + } + + public AstWriteAdvisedNodeBuilder addMatcherExactText(String valueExactText) { + node.addMatcher(new AstExactTextMatcher(valueExactText)); + return this; + } + + public AstWriteAdvisedNodeBuilder addMatcherExactBytes(byte[] valueBytes, ExpressionContext environment) { + node.addMatcher(new AstExactBytesMatcher(valueBytes)); + return this; + } + + public AstWriteAdvisedNodeBuilder addMatcherExpression(ValueExpression valueValueExpression, ExpressionContext environment) { + node.addMatcher(new AstExpressionMatcher(valueValueExpression, environment)); + return this; + } + + public AstWriteAdvisedNodeBuilder addMatcherFixedLengthBytes(int valueLength, String valueCaptureName, + ExpressionContext environment) { + node.addMatcher(new AstFixedLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public AstWriteAdvisedNodeBuilder addMatcherRegex(NamedGroupPattern valuePattern, ExpressionContext environment) { + node.addMatcher(new AstRegexMatcher(valuePattern, environment)); + return this; + } + + public AstWriteAdvisedNodeBuilder addMatcherVariableLengthBytes(ValueExpression valueLength, ExpressionContext environment) { + node.addMatcher(new AstVariableLengthBytesMatcher(valueLength, environment)); + return this; + } + + public AstWriteAdvisedNodeBuilder addMatcherVariableLengthBytes(ValueExpression valueLength, String valueCaptureName, + ExpressionContext environment) { + node.addMatcher(new AstVariableLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public static class StreamNested> extends + AbstractAstStreamableNodeBuilder { + + public StreamNested(R builder) { + super(new AstWriteAdvisedNode(), builder); + } + + public StreamNested setType(StructuredTypeInfo type) { + node.setType(type); + return this; + } + + public StreamNested setMissing(boolean missing) { + node.setMissing(missing); + return this; + } + + public StreamNested setMatcherFixedLengthBytes(String name, int valueLength) { + node.setMatcher(name, new AstFixedLengthBytesMatcher(valueLength)); + return this; + } + + public StreamNested setMatcherExactText(String name, String valueExactText) { + node.setMatcher(name, new AstExactTextMatcher(valueExactText)); + return this; + } + + public StreamNested setMatcherExactBytes(String name, byte[] valueBytes, ExpressionContext environment) { + node.setMatcher(name, new AstExactBytesMatcher(valueBytes)); + return this; + } + + public StreamNested setMatcherExpression(String name, ValueExpression valueValueExpression, + ExpressionContext environment) { + node.setMatcher(name, new AstExpressionMatcher(valueValueExpression, environment)); + return this; + } + + public StreamNested setMatcherFixedLengthBytes(String name, int valueLength, String valueCaptureName, + ExpressionContext environment) { + node.setMatcher(name, new AstFixedLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public StreamNested setMatcherRegex(String name, NamedGroupPattern valuePattern, ExpressionContext environment) { + node.setMatcher(name, new AstRegexMatcher(valuePattern, environment)); + return this; + } + + public StreamNested setMatcherVariableLengthBytes(String name, ValueExpression valueLength, + ExpressionContext environment) { + node.setMatcher(name, new AstVariableLengthBytesMatcher(valueLength, environment)); + return this; + } + + public StreamNested setMatcherVariableLengthBytes(String name, ValueExpression valueLength, String valueCaptureName, + ExpressionContext environment) { + node.setMatcher(name, new AstVariableLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public StreamNested addMatcherFixedLengthBytes(int valueLength) { + node.addMatcher(new AstFixedLengthBytesMatcher(valueLength)); + return this; + } + + public StreamNested addMatcherExactText(String valueExactText) { + node.addMatcher(new AstExactTextMatcher(valueExactText)); + return this; + } + + public StreamNested addMatcherExactBytes(byte[] valueBytes, ExpressionContext environment) { + node.addMatcher(new AstExactBytesMatcher(valueBytes)); + return this; + } + + public StreamNested addMatcherExpression(ValueExpression valueValueExpression, ExpressionContext environment) { + node.addMatcher(new AstExpressionMatcher(valueValueExpression, environment)); + return this; + } + + public StreamNested addMatcherFixedLengthBytes(int valueLength, String valueCaptureName, + ExpressionContext environment) { + node.addMatcher(new AstFixedLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + public StreamNested addMatcherRegex(NamedGroupPattern valuePattern, ExpressionContext environment) { + node.addMatcher(new AstRegexMatcher(valuePattern, environment)); + return this; + } + + public StreamNested addMatcherVariableLengthBytes(ValueExpression valueLength, ExpressionContext environment) { + node.addMatcher(new AstVariableLengthBytesMatcher(valueLength, environment)); + return this; + } + + public StreamNested addMatcherVariableLengthBytes(ValueExpression valueLength, String valueCaptureName, + ExpressionContext environment) { + node.addMatcher(new AstVariableLengthBytesMatcher(valueLength, valueCaptureName, environment)); + return this; + } + + @Override + public R done() { + AstStreamNode streamNode = node(result); + streamNode.getStreamables().add(node); + return result; + } + } +} diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java index 9a78c32e0..9cbd33b67 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/ScriptParseStrategy.java @@ -55,6 +55,8 @@ import org.kaazing.k3po.lang.internal.ast.AstPropertyNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstReadAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstReadClosedNode; import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; @@ -70,6 +72,8 @@ import org.kaazing.k3po.lang.internal.ast.AstUnboundNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstWriteCloseNode; import org.kaazing.k3po.lang.internal.ast.AstWriteConfigNode; @@ -138,6 +142,8 @@ import org.kaazing.k3po.lang.parser.v2.RobotParser.PropertyNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ReadAbortNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ReadAbortedNodeContext; +import org.kaazing.k3po.lang.parser.v2.RobotParser.ReadAdviseNodeContext; +import org.kaazing.k3po.lang.parser.v2.RobotParser.ReadAdvisedNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ReadAwaitNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ReadClosedNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.ReadConfigNodeContext; @@ -156,6 +162,8 @@ import org.kaazing.k3po.lang.parser.v2.RobotParser.VariableLengthBytesMatcherContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.WriteAbortNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.WriteAbortedNodeContext; +import org.kaazing.k3po.lang.parser.v2.RobotParser.WriteAdviseNodeContext; +import org.kaazing.k3po.lang.parser.v2.RobotParser.WriteAdvisedNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.WriteAwaitNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.WriteCloseNodeContext; import org.kaazing.k3po.lang.parser.v2.RobotParser.WriteConfigNodeContext; @@ -617,6 +625,44 @@ public AstWriteConfigNode parse(RobotParser parser, ExpressionFactory factory, E } }; + public static final ScriptParseStrategy READ_ADVISE = + new ScriptParseStrategy() { + @Override + public AstReadAdviseNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) + throws RecognitionException { + return new AstReadAdviseNodeVisitor(factory, environment) + .visit(parser.readAdviseNode()); + } + }; + + public static final ScriptParseStrategy WRITE_ADVISE = + new ScriptParseStrategy() { + @Override + public AstWriteAdviseNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) + throws RecognitionException { + return new AstWriteAdviseNodeVisitor(factory, environment) + .visit(parser.writeAdviseNode()); + } + }; + + public static final ScriptParseStrategy READ_ADVISED = + new ScriptParseStrategy() { + @Override + public AstReadAdvisedNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) + throws RecognitionException { + return new AstReadAdvisedNodeVisitor(factory, environment).visit(parser.readAdvisedNode()); + } + }; + + public static final ScriptParseStrategy WRITE_ADVISED = + new ScriptParseStrategy() { + @Override + public AstWriteAdvisedNode parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) + throws RecognitionException { + return new AstWriteAdvisedNodeVisitor(factory, environment).visit(parser.writeAdvisedNode()); + } + }; + public abstract T parse(RobotParser parser, ExpressionFactory factory, ExpressionContext environment) throws RecognitionException; @@ -1198,6 +1244,30 @@ public AstOpenedNode visitOpenedNode(OpenedNodeContext ctx) { return openedNode; } + @Override + public AstReadAdvisedNode visitReadAdvisedNode(ReadAdvisedNodeContext ctx) { + + AstReadAdvisedNodeVisitor visitor = new AstReadAdvisedNodeVisitor(factory, environment); + AstReadAdvisedNode readAdvisedNode = visitor.visitReadAdvisedNode(ctx); + if (readAdvisedNode != null) { + childInfos().add(readAdvisedNode.getRegionInfo()); + } + + return readAdvisedNode; + } + + @Override + public AstWriteAdvisedNode visitWriteAdvisedNode(WriteAdvisedNodeContext ctx) { + + AstWriteAdvisedNodeVisitor visitor = new AstWriteAdvisedNodeVisitor(factory, environment); + AstWriteAdvisedNode writeAdvisedNode = visitor.visitWriteAdvisedNode(ctx); + if (writeAdvisedNode != null) { + childInfos().add(writeAdvisedNode.getRegionInfo()); + } + + return writeAdvisedNode; + } + @Override public AstReadConfigNode visitReadConfigNode(ReadConfigNodeContext ctx) { @@ -1299,6 +1369,30 @@ public AstUnbindNode visitUnbindNode(UnbindNodeContext ctx) { return unbindNode; } + @Override + public AstReadAdviseNode visitReadAdviseNode(ReadAdviseNodeContext ctx) { + + AstReadAdviseNodeVisitor visitor = new AstReadAdviseNodeVisitor(factory, environment); + AstReadAdviseNode readAdviseNode = visitor.visitReadAdviseNode(ctx); + if (readAdviseNode != null) { + childInfos().add(readAdviseNode.getRegionInfo()); + } + + return readAdviseNode; + } + + @Override + public AstWriteAdviseNode visitWriteAdviseNode(WriteAdviseNodeContext ctx) { + + AstWriteAdviseNodeVisitor visitor = new AstWriteAdviseNodeVisitor(factory, environment); + AstWriteAdviseNode writeAdviseNode = visitor.visitWriteAdviseNode(ctx); + if (writeAdviseNode != null) { + childInfos().add(writeAdviseNode.getRegionInfo()); + } + + return writeAdviseNode; + } + @Override public AstWriteConfigNode visitWriteConfigNode(WriteConfigNodeContext ctx) { @@ -2267,6 +2361,234 @@ public AstExpressionValue visitExpressionValue(ExpressionValueContext ctx) { } + private static class AstReadAdviseNodeVisitor extends AstNodeVisitor { + + private Iterator> namedFields; + private int anonymousFields; + + public AstReadAdviseNodeVisitor(ExpressionFactory factory, ExpressionContext environment) { + super(factory, environment); + } + + @Override + public AstReadAdviseNode visitReadAdviseNode(ReadAdviseNodeContext ctx) { + + String advisoryQName = ctx.QualifiedName().getText(); + + node = new AstReadAdviseNode(); + + StructuredTypeInfo advisoryType = TYPE_SYSTEM.readAdvisory(advisoryQName); + namedFields = advisoryType.getNamedFields().iterator(); + anonymousFields = advisoryType.getAnonymousFields(); + + node.setType(advisoryType); + + super.visitReadAdviseNode(ctx); + + node.setRegionInfo(asSequentialRegion(childInfos, ctx)); + + return node; + } + + @Override + public AstReadAdviseNode visitWriteValue(WriteValueContext ctx) { + + AstValueVisitor visitor = new AstValueVisitor<>(factory, environment, Object.class); + AstValue value = visitor.visit(ctx); + + if (value != null) { + + if (namedFields.hasNext()) { + TypeInfo field = namedFields.next(); + node.setValue(field.getName(), value); + } + else if (anonymousFields > 0) { + anonymousFields--; + node.addValue(value); + } + else { + throw new IllegalStateException(String.format("Unexpected %s syntax", node.getType())); + } + + childInfos().add(value.getRegionInfo()); + } + + return node; + } + } + + private static class AstWriteAdviseNodeVisitor extends AstNodeVisitor { + + private Iterator> namedFields; + private int anonymousFields; + + public AstWriteAdviseNodeVisitor(ExpressionFactory factory, ExpressionContext environment) { + super(factory, environment); + } + + @Override + public AstWriteAdviseNode visitWriteAdviseNode(WriteAdviseNodeContext ctx) { + + String advisoryQName = ctx.QualifiedName().getText(); + + node = new AstWriteAdviseNode(); + + StructuredTypeInfo advisoryType = TYPE_SYSTEM.writeAdvisory(advisoryQName); + namedFields = advisoryType.getNamedFields().iterator(); + anonymousFields = advisoryType.getAnonymousFields(); + + node.setType(advisoryType); + + super.visitWriteAdviseNode(ctx); + + node.setRegionInfo(asSequentialRegion(childInfos, ctx)); + + return node; + } + + @Override + public AstWriteAdviseNode visitWriteValue(WriteValueContext ctx) { + + AstValueVisitor visitor = new AstValueVisitor<>(factory, environment, Object.class); + AstValue value = visitor.visit(ctx); + + if (value != null) { + + if (namedFields.hasNext()) { + TypeInfo field = namedFields.next(); + node.setValue(field.getName(), value); + } + else if (anonymousFields > 0) { + anonymousFields--; + node.addValue(value); + } + else { + throw new IllegalStateException(String.format("Unexpected %s syntax", node.getType())); + } + + childInfos().add(value.getRegionInfo()); + } + + return node; + } + } + + private static class AstReadAdvisedNodeVisitor extends AstNodeVisitor { + + private Iterator> namedFields; + private int anonymousFields; + + public AstReadAdvisedNodeVisitor(ExpressionFactory factory, ExpressionContext environment) { + super(factory, environment); + } + + @Override + public AstReadAdvisedNode visitReadAdvisedNode(ReadAdvisedNodeContext ctx) { + + String advistoryQName = ctx.QualifiedName().getText(); + boolean missing = ctx.MissingKeyword() != null; + + node = new AstReadAdvisedNode(); + node.setMissing(missing); + + StructuredTypeInfo advisoryType = TYPE_SYSTEM.writeAdvisory(advistoryQName); + namedFields = advisoryType.getNamedFields().iterator(); + anonymousFields = advisoryType.getAnonymousFields(); + + node.setType(advisoryType); + + super.visitReadAdvisedNode(ctx); + + node.setRegionInfo(asSequentialRegion(childInfos, ctx)); + + return node; + } + + @Override + public AstReadAdvisedNode visitMatcher(MatcherContext ctx) { + + AstValueMatcherVisitor visitor = new AstValueMatcherVisitor(factory, environment); + AstValueMatcher matcher = visitor.visit(ctx); + + if (matcher != null) { + + if (namedFields.hasNext()) { + TypeInfo field = namedFields.next(); + node.setMatcher(field.getName(), matcher); + } + else if (anonymousFields > 0) { + anonymousFields--; + node.addMatcher(matcher); + } + else { + throw new IllegalStateException(String.format("Unexpected %s syntax", node.getType())); + } + + childInfos().add(matcher.getRegionInfo()); + } + + return node; + } + } + + private static class AstWriteAdvisedNodeVisitor extends AstNodeVisitor { + + private Iterator> namedFields; + private int anonymousFields; + + public AstWriteAdvisedNodeVisitor(ExpressionFactory factory, ExpressionContext environment) { + super(factory, environment); + } + + @Override + public AstWriteAdvisedNode visitWriteAdvisedNode(WriteAdvisedNodeContext ctx) { + + String advisoryQName = ctx.QualifiedName().getText(); + boolean missing = ctx.MissingKeyword() != null; + + node = new AstWriteAdvisedNode(); + node.setMissing(missing); + + StructuredTypeInfo advisoryType = TYPE_SYSTEM.readAdvisory(advisoryQName); + namedFields = advisoryType.getNamedFields().iterator(); + anonymousFields = advisoryType.getAnonymousFields(); + + node.setType(advisoryType); + + super.visitWriteAdvisedNode(ctx); + + node.setRegionInfo(asSequentialRegion(childInfos, ctx)); + + return node; + } + + @Override + public AstWriteAdvisedNode visitMatcher(MatcherContext ctx) { + + AstValueMatcherVisitor visitor = new AstValueMatcherVisitor(factory, environment); + AstValueMatcher matcher = visitor.visit(ctx); + + if (matcher != null) { + + if (namedFields.hasNext()) { + TypeInfo field = namedFields.next(); + node.setMatcher(field.getName(), matcher); + } + else if (anonymousFields > 0) { + anonymousFields--; + node.addMatcher(matcher); + } + else { + throw new IllegalStateException(String.format("Unexpected %s syntax", node.getType())); + } + + childInfos().add(matcher.getRegionInfo()); + } + + return node; + } + } + private static class AstReadConfigNodeVisitor extends AstNodeVisitor { private Iterator> namedFields; diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/types/DefaultTypeSystem.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/types/DefaultTypeSystem.java index 053265e66..d45c43b3e 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/types/DefaultTypeSystem.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/types/DefaultTypeSystem.java @@ -34,6 +34,8 @@ public final class DefaultTypeSystem implements TypeSystemSpi private final Set> writeOptions; private final Set readConfigs; private final Set writeConfigs; + private final Set readAdvisories; + private final Set writeAdvisories; DefaultTypeSystem() { @@ -43,6 +45,8 @@ public final class DefaultTypeSystem implements TypeSystemSpi this.writeOptions = singleton(OPTION_MASK); this.readConfigs = emptySet(); this.writeConfigs = emptySet(); + this.readAdvisories = emptySet(); + this.writeAdvisories = emptySet(); } @Override @@ -86,4 +90,14 @@ public Set writeConfigs() { return writeConfigs; } + + @Override + public Set readAdvisories() { + return readAdvisories; + } + + @Override + public Set writeAdvisories() { + return writeAdvisories; + } } \ No newline at end of file diff --git a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/types/TypeSystem.java b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/types/TypeSystem.java index 001a0bc9d..3423c60a8 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/types/TypeSystem.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/internal/parser/types/TypeSystem.java @@ -34,6 +34,8 @@ public final class TypeSystem { private final Map> writeOptions; private final Map readConfigs; private final Map writeConfigs; + private final Map readAdvisories; + private final Map writeAdvisories; private TypeSystem(Iterable typeSystems) { @@ -43,6 +45,8 @@ private TypeSystem(Iterable typeSystems) { Map> writeOptions = new TreeMap<>(); Map readConfigs = new TreeMap<>(); Map writeConfigs = new TreeMap<>(); + Map readAdvisories = new TreeMap<>(); + Map writeAdvisories = new TreeMap<>(); for (TypeSystemSpi typeSystem : typeSystems) { Function, String> namer = t -> String.format("%s:%s", typeSystem.getName(), t.getName()); @@ -54,6 +58,8 @@ private TypeSystem(Iterable typeSystems) { populate(namer, writeOptions, typeSystem.writeOptions()); populate(structNamer, readConfigs, typeSystem.readConfigs()); populate(structNamer, writeConfigs, typeSystem.writeConfigs()); + populate(structNamer, readAdvisories, typeSystem.readAdvisories()); + populate(structNamer, writeAdvisories, typeSystem.writeAdvisories()); } Function, String> defaultNamer = t -> t.getName(); @@ -65,6 +71,8 @@ private TypeSystem(Iterable typeSystems) { populate(defaultNamer, writeOptions, defaultTypeSystem.writeOptions()); populate(defaultStructNamer, readConfigs, defaultTypeSystem.readConfigs()); populate(defaultStructNamer, writeConfigs, defaultTypeSystem.writeConfigs()); + populate(defaultStructNamer, readAdvisories, defaultTypeSystem.readAdvisories()); + populate(defaultStructNamer, writeAdvisories, defaultTypeSystem.writeAdvisories()); this.acceptOptions = acceptOptions; this.connectOptions = connectOptions; @@ -72,6 +80,8 @@ private TypeSystem(Iterable typeSystems) { this.writeOptions = writeOptions; this.readConfigs = readConfigs; this.writeConfigs = writeConfigs; + this.readAdvisories = readAdvisories; + this.writeAdvisories = writeAdvisories; } public TypeInfo acceptOption(String optionName) { @@ -98,6 +108,14 @@ public StructuredTypeInfo writeConfig(String configName) { return verifyConfig(writeConfigs.get(configName), configName); } + public StructuredTypeInfo readAdvisory(String advisoryName) { + return verifyAdvisory(readAdvisories.get(advisoryName), advisoryName); + } + + public StructuredTypeInfo writeAdvisory(String advisoryName) { + return verifyAdvisory(writeAdvisories.get(advisoryName), advisoryName); + } + private static T verifyOption( T value, String optionName) @@ -118,6 +136,16 @@ private static T verifyConfig( return value; } + private static T verifyAdvisory( + T value, + String advisoryName) + { + if (value == null) { + throw new IllegalArgumentException("Unrecognized advisory: " + advisoryName); + } + return value; + } + private static void populate( Function qualifiedNamer, Map optionsByName, diff --git a/lang/src/main/java/org/kaazing/k3po/lang/types/TypeSystemSpi.java b/lang/src/main/java/org/kaazing/k3po/lang/types/TypeSystemSpi.java index ad521831e..f35f8ff04 100644 --- a/lang/src/main/java/org/kaazing/k3po/lang/types/TypeSystemSpi.java +++ b/lang/src/main/java/org/kaazing/k3po/lang/types/TypeSystemSpi.java @@ -32,4 +32,8 @@ public interface TypeSystemSpi { Set readConfigs(); Set writeConfigs(); + + Set readAdvisories(); + + Set writeAdvisories(); } diff --git a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java index dbb060465..6672de526 100644 --- a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java +++ b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/ScriptParserImplTest.java @@ -32,6 +32,8 @@ import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ_ABORT; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ_ABORTED; +import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ_ADVISE; +import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ_ADVISED; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ_AWAIT; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ_CONFIG; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.READ_NOTIFY; @@ -42,11 +44,14 @@ import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.WRITE; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.WRITE_ABORT; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.WRITE_ABORTED; +import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.WRITE_ADVISE; +import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.WRITE_ADVISED; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.WRITE_AWAIT; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.WRITE_CONFIG; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.WRITE_NOTIFY; import static org.kaazing.k3po.lang.internal.parser.ScriptParseStrategy.WRITE_OPTION; import static org.kaazing.k3po.lang.internal.parser.types.DefaultTypeSystem.OPTION_MASK; +import static org.kaazing.k3po.lang.internal.parser.types.TestTypeSystem.ADVISORY_ADVICE; import static org.kaazing.k3po.lang.internal.parser.types.TestTypeSystem.CONFIG_CONFIG; import static org.kaazing.k3po.lang.internal.parser.types.TestTypeSystem.OPTION_BYTES; import static org.kaazing.k3po.lang.internal.parser.types.TestTypeSystem.OPTION_EXPRESSION; @@ -74,6 +79,8 @@ import org.kaazing.k3po.lang.internal.ast.AstPropertyNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortNode; import org.kaazing.k3po.lang.internal.ast.AstReadAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstReadAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstReadAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstReadConfigNode; import org.kaazing.k3po.lang.internal.ast.AstReadNotifyNode; @@ -83,6 +90,8 @@ import org.kaazing.k3po.lang.internal.ast.AstScriptNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAbortedNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdviseNode; +import org.kaazing.k3po.lang.internal.ast.AstWriteAdvisedNode; import org.kaazing.k3po.lang.internal.ast.AstWriteAwaitNode; import org.kaazing.k3po.lang.internal.ast.AstWriteConfigNode; import org.kaazing.k3po.lang.internal.ast.AstWriteNotifyNode; @@ -98,6 +107,8 @@ import org.kaazing.k3po.lang.internal.ast.builder.AstPropertyNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstReadAbortNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstReadAbortedNodeBuilder; +import org.kaazing.k3po.lang.internal.ast.builder.AstReadAdviseNodeBuilder; +import org.kaazing.k3po.lang.internal.ast.builder.AstReadAdvisedNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstReadAwaitNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstReadConfigNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstReadNodeBuilder; @@ -107,6 +118,8 @@ import org.kaazing.k3po.lang.internal.ast.builder.AstScriptNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstWriteAbortNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstWriteAbortedNodeBuilder; +import org.kaazing.k3po.lang.internal.ast.builder.AstWriteAdviseNodeBuilder; +import org.kaazing.k3po.lang.internal.ast.builder.AstWriteAdvisedNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstWriteAwaitNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstWriteConfigNodeBuilder; import org.kaazing.k3po.lang.internal.ast.builder.AstWriteNodeBuilder; @@ -2128,6 +2141,112 @@ public void shouldParseWriteConfigStringExpressionParameter() throws Exception { assertEquals(expected, actual); } + @Test + public void shouldParseReadAdvise() throws Exception { + + String scriptFragment = "read advise test:advice [0x01 0x02 0x03 0x04]"; + + ScriptParserImpl parser = new ScriptParserImpl(); + AstReadAdviseNode actual = parser.parseWithStrategy(scriptFragment, READ_ADVISE); + + AstReadAdviseNode expected = new AstReadAdviseNodeBuilder() + .setType(ADVISORY_ADVICE) + .addValue(new byte[]{0x01, 0x02, 0x03, 0x04}) + .done(); + + assertEquals(expected, actual); + } + + @Test + public void shouldParseReadAdviseStringExpressionParameter() throws Exception { + + String scriptFragment = "read advise test:advice ${'value'}"; + + ScriptParserImpl parser = new ScriptParserImpl(); + ExpressionFactory factory = parser.getExpressionFactory(); + ExpressionContext context = parser.getExpressionContext(); + + AstReadAdviseNode actual = parser.parseWithStrategy(scriptFragment, READ_ADVISE); + + AstReadAdviseNode expected = new AstReadAdviseNodeBuilder() + .setType(ADVISORY_ADVICE) + .addValue(factory.createValueExpression(context, "${'value'}", Object.class), + parser.getExpressionContext()) + .done(); + + assertEquals(expected, actual); + } + + @Test + public void shouldParseWriteAdvise() throws Exception { + + String scriptFragment = "write advise test:advice [0x01 0x02 0x03 0x04]"; + + ScriptParserImpl parser = new ScriptParserImpl(); + AstWriteAdviseNode actual = parser.parseWithStrategy(scriptFragment, WRITE_ADVISE); + + AstWriteAdviseNode expected = new AstWriteAdviseNodeBuilder() + .setType(ADVISORY_ADVICE) + .addValue(new byte[]{0x01, 0x02, 0x03, 0x04}) + .done(); + + assertEquals(expected, actual); + } + + @Test + public void shouldParseWriteAdviseStringExpressionParameter() throws Exception { + + String scriptFragment = "write advise test:advice ${'value'}"; + + ScriptParserImpl parser = new ScriptParserImpl(); + ExpressionFactory factory = parser.getExpressionFactory(); + ExpressionContext context = parser.getExpressionContext(); + + AstWriteAdviseNode actual = parser.parseWithStrategy(scriptFragment, WRITE_ADVISE); + + AstWriteAdviseNode expected = new AstWriteAdviseNodeBuilder() + .setType(ADVISORY_ADVICE) + .addValue(factory.createValueExpression(context, "${'value'}", Object.class), + parser.getExpressionContext()) + .done(); + + assertEquals(expected, actual); + } + + @Test + public void shouldParseReadAdvised() throws Exception { + + String scriptFragment = "read advised test:advice \"value1\" \"value2\""; + + ScriptParserImpl parser = new ScriptParserImpl(); + AstReadAdvisedNode actual = parser.parseWithStrategy(scriptFragment, READ_ADVISED); + + AstReadAdvisedNode expected = new AstReadAdvisedNodeBuilder() + .setType(ADVISORY_ADVICE) + .addMatcherExactText("value1") + .addMatcherExactText("value2") + .done(); + + assertEquals(expected, actual); + } + + @Test + public void shouldParseWriteAdvised() throws Exception { + + String scriptFragment = "write advised test:advice \"value1\" \"value2\""; + + ScriptParserImpl parser = new ScriptParserImpl(); + AstWriteAdvisedNode actual = parser.parseWithStrategy(scriptFragment, WRITE_ADVISED); + + AstWriteAdvisedNode expected = new AstWriteAdvisedNodeBuilder() + .setType(ADVISORY_ADVICE) + .addMatcherExactText("value1") + .addMatcherExactText("value2") + .done(); + + assertEquals(expected, actual); + } + @Test public void shouldParseCapturingFixedLengthBytesMatcher2() throws Exception { diff --git a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/types/TestTypeSystem.java b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/types/TestTypeSystem.java index 6a18604df..a38b81382 100644 --- a/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/types/TestTypeSystem.java +++ b/lang/src/test/java/org/kaazing/k3po/lang/internal/parser/types/TestTypeSystem.java @@ -34,6 +34,7 @@ public final class TestTypeSystem implements TypeSystemSpi public static final TypeInfo OPTION_NUMBER = new TypeInfo<>("number", int.class); public static final TypeInfo OPTION_EXPRESSION = new TypeInfo<>("expression", Object.class); public static final StructuredTypeInfo CONFIG_CONFIG = new StructuredTypeInfo("test", "config", emptyList(), Integer.MAX_VALUE); + public static final StructuredTypeInfo ADVISORY_ADVICE = new StructuredTypeInfo("test", "advice", emptyList(), Integer.MAX_VALUE); private final Set> acceptOptions; private final Set> connectOptions; @@ -41,6 +42,8 @@ public final class TestTypeSystem implements TypeSystemSpi private final Set> writeOptions; private final Set readConfigs; private final Set writeConfigs; + private final Set readAdvisories; + private final Set writeAdvisories; public TestTypeSystem() { @@ -65,6 +68,8 @@ public TestTypeSystem() this.writeOptions = singleton(optionType); this.readConfigs = singleton(CONFIG_CONFIG); this.writeConfigs = singleton(CONFIG_CONFIG); + this.readAdvisories = singleton(ADVISORY_ADVICE); + this.writeAdvisories = singleton(ADVISORY_ADVICE); } @Override @@ -108,4 +113,16 @@ public Set writeConfigs() { return writeConfigs; } + + @Override + public Set readAdvisories() + { + return readAdvisories; + } + + @Override + public Set writeAdvisories() + { + return writeAdvisories; + } } From 3d93a39fb4687834b46e870f25c5b4386c925a0b Mon Sep 17 00:00:00 2001 From: John Fallows Date: Fri, 16 Oct 2020 19:58:14 -0700 Subject: [PATCH 29/29] Prepare release 3.1.0 --- control/pom.xml | 2 +- driver/pom.xml | 2 +- examples/pom.xml | 2 +- junit/pom.xml | 2 +- k3po-maven-plugin/pom.xml | 2 +- k3po.pcap.converter/pom.xml | 2 +- lang/pom.xml | 2 +- launcher/pom.xml | 2 +- pom.xml | 2 +- specification/amqp_0.9.1/pom.xml | 2 +- specification/amqp_1_0.jms/pom.xml | 2 +- specification/bbosh/pom.xml | 2 +- specification/http.multi.auth/pom.xml | 2 +- specification/http/pom.xml | 2 +- specification/http2/pom.xml | 2 +- specification/httpx/pom.xml | 2 +- specification/httpxe/pom.xml | 2 +- specification/k3po.control/pom.xml | 2 +- specification/mqtt_3_1_1/pom.xml | 2 +- specification/socks5/pom.xml | 2 +- specification/sse/pom.xml | 2 +- specification/tcp/pom.xml | 2 +- specification/tls/pom.xml | 2 +- specification/turn/pom.xml | 2 +- specification/udp/pom.xml | 2 +- specification/ws.extensions/x-kaazing-idle-timeout/pom.xml | 2 +- specification/ws.extensions/x-kaazing-ping-pong/pom.xml | 2 +- specification/ws/pom.xml | 2 +- specification/wse/pom.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/control/pom.xml b/control/pom.xml index 2ae801c0b..152180085 100644 --- a/control/pom.xml +++ b/control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 k3po.control diff --git a/driver/pom.xml b/driver/pom.xml index 0ede3271d..f43b9b48e 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 k3po.driver diff --git a/examples/pom.xml b/examples/pom.xml index bcb95701e..fc8a99c13 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 k3po.examples diff --git a/junit/pom.xml b/junit/pom.xml index 206c50310..d23328150 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 k3po.junit diff --git a/k3po-maven-plugin/pom.xml b/k3po-maven-plugin/pom.xml index 172774951..3fd73be43 100644 --- a/k3po-maven-plugin/pom.xml +++ b/k3po-maven-plugin/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 k3po-maven-plugin diff --git a/k3po.pcap.converter/pom.xml b/k3po.pcap.converter/pom.xml index 5910ec7e6..4bd305b9d 100644 --- a/k3po.pcap.converter/pom.xml +++ b/k3po.pcap.converter/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 k3po.pcap.converter diff --git a/lang/pom.xml b/lang/pom.xml index d40c788cc..6788a77cd 100644 --- a/lang/pom.xml +++ b/lang/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 k3po.lang diff --git a/launcher/pom.xml b/launcher/pom.xml index b1b7d7c2b..b95ea30eb 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 k3po.launcher diff --git a/pom.xml b/pom.xml index 388e06439..c48c24b0d 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ k3po.parent - develop-SNAPSHOT + 3.1.0 k3po/parent https://github.com/kaazing/k3po diff --git a/specification/amqp_0.9.1/pom.xml b/specification/amqp_0.9.1/pom.xml index e3855f925..9f626fd12 100644 --- a/specification/amqp_0.9.1/pom.xml +++ b/specification/amqp_0.9.1/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/amqp_1_0.jms/pom.xml b/specification/amqp_1_0.jms/pom.xml index 4fb7e9fc9..e6c021fe3 100644 --- a/specification/amqp_1_0.jms/pom.xml +++ b/specification/amqp_1_0.jms/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/bbosh/pom.xml b/specification/bbosh/pom.xml index 04cb7ee38..a985f842e 100644 --- a/specification/bbosh/pom.xml +++ b/specification/bbosh/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/http.multi.auth/pom.xml b/specification/http.multi.auth/pom.xml index b5e4d9df0..3a2c5f4d3 100644 --- a/specification/http.multi.auth/pom.xml +++ b/specification/http.multi.auth/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/http/pom.xml b/specification/http/pom.xml index 49dab8895..34f575056 100644 --- a/specification/http/pom.xml +++ b/specification/http/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/http2/pom.xml b/specification/http2/pom.xml index a6a4a4848..137de4c97 100644 --- a/specification/http2/pom.xml +++ b/specification/http2/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/httpx/pom.xml b/specification/httpx/pom.xml index e2282b9e5..1eb09ac7e 100644 --- a/specification/httpx/pom.xml +++ b/specification/httpx/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/httpxe/pom.xml b/specification/httpxe/pom.xml index bc84df5c8..180c83213 100644 --- a/specification/httpxe/pom.xml +++ b/specification/httpxe/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/k3po.control/pom.xml b/specification/k3po.control/pom.xml index 6a039d53b..04ae936ac 100644 --- a/specification/k3po.control/pom.xml +++ b/specification/k3po.control/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/mqtt_3_1_1/pom.xml b/specification/mqtt_3_1_1/pom.xml index a1ada92eb..c2e7123b4 100644 --- a/specification/mqtt_3_1_1/pom.xml +++ b/specification/mqtt_3_1_1/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/socks5/pom.xml b/specification/socks5/pom.xml index aad151216..dfdc97e3c 100644 --- a/specification/socks5/pom.xml +++ b/specification/socks5/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/sse/pom.xml b/specification/sse/pom.xml index 7297e48c4..d97de5bc4 100644 --- a/specification/sse/pom.xml +++ b/specification/sse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/tcp/pom.xml b/specification/tcp/pom.xml index 86fb179fb..fa0515f05 100755 --- a/specification/tcp/pom.xml +++ b/specification/tcp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/tls/pom.xml b/specification/tls/pom.xml index f45de7922..54253290a 100644 --- a/specification/tls/pom.xml +++ b/specification/tls/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/turn/pom.xml b/specification/turn/pom.xml index 06393924a..883c38cb4 100644 --- a/specification/turn/pom.xml +++ b/specification/turn/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/udp/pom.xml b/specification/udp/pom.xml index 19157e37f..b2a09b480 100755 --- a/specification/udp/pom.xml +++ b/specification/udp/pom.xml @@ -4,7 +4,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml index 2c57791b3..66f197349 100644 --- a/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml +++ b/specification/ws.extensions/x-kaazing-idle-timeout/pom.xml @@ -3,7 +3,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../../pom.xml specification.x-kaazing-idle-timeout diff --git a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml index 5c1c3c1a9..ad6141307 100644 --- a/specification/ws.extensions/x-kaazing-ping-pong/pom.xml +++ b/specification/ws.extensions/x-kaazing-ping-pong/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../../pom.xml diff --git a/specification/ws/pom.xml b/specification/ws/pom.xml index 288918caf..1097f0d71 100755 --- a/specification/ws/pom.xml +++ b/specification/ws/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml diff --git a/specification/wse/pom.xml b/specification/wse/pom.xml index d7d73b6e1..2ace0f335 100644 --- a/specification/wse/pom.xml +++ b/specification/wse/pom.xml @@ -5,7 +5,7 @@ org.kaazing k3po.parent - develop-SNAPSHOT + 3.1.0 ../../pom.xml