File: UnsetConnFullDuringAwaitTestCase

package info (click to toggle)
jboss-xnio 3.8.10-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 4,368 kB
  • sloc: java: 59,981; xml: 529; makefile: 3
file content (76 lines) | stat: -rw-r--r-- 3,013 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#
# JBoss, Home of Professional Open Source.
# Copyright 2012, Red Hat, Inc., and individual contributors
# as indicated by the @author tags. See the copyright.txt file in the
# distribution for a full listing of individual contributors.
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this software; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
#

RULE awaitAcceptable checks CONN_FULL is set
CLASS org.xnio.nio.NioTcpServer
METHOD awaitAcceptable
AFTER INVOKE allAreSet 1
IF incrementCounter("run 'awaitAcceptable checks CONN_FULL' once") == 1
DO
    debug("AwaitWritable checked that connection is full, wait until it is no longer full before proceeding"),
    signalWake("CONN_FULL is verified", true),
    waitFor("channel closed"),
    debug("Proceeding with double check on CONN_FULL at awaitAcceptable")
ENDRULE

RULE plainAwait test calls close only after previous rule is executed
CLASS org.xnio.nio.test.racecondition.UnsetConnFullDuringAwaitTestCase
METHOD plainAwait
AT INVOKE org.xnio.channels.ConnectedStreamChannel.close
IF incrementCounter("run 'test calls close' once") == 1
DO
    debug("waiting for awaiter to check CONN_FULL is set before closing channels"),
    waitFor("CONN_FULL is verified"),
    debug("proceeding with closing channels")
ENDRULE

RULE timeoutAwait test calls close only after previous rule is executed
CLASS org.xnio.nio.test.racecondition.UnsetConnFullDuringAwaitTestCase
METHOD timeoutAwait
AT INVOKE org.xnio.channels.ConnectedStreamChannel.close
IF incrementCounter("run 'test calls close' once") == 1
DO
    debug("waiting for awaiter to check CONN_FULL is set before closing channels"),
    waitFor("CONN_FULL is verified"),
    debug("proceeding with closing channels")
ENDRULE

RULE channelClosed unsets CONN_FULL
CLASS org.xnio.nio.NioTcpServer
METHOD channelClosed
AT EXIT
IF incrementCounter("run 'channelClosed unsets CONN_FULL' once") == 1
DO
    debug("Channel closed, resuming awaitAcceptable"),
    signalWake("channel closed", true),
    debug("awaitAcceptable resumed. Proceeding...")
ENDRULE

RULE clearCounters
CLASS org.xnio.nio.test.racecondition.UnsetConnFullDuringAwaitTestCase
METHOD afterTest
IF TRUE
DO
    deleteCounter("run 'awaitAcceptable checks CONN_FULL' once"),
    deleteCounter("run 'test calls close' once"),
    deleteCounter("run 'channelClosed unsets CONN_FULL' once")
ENDRULE