21
21
*/
22
22
package org .jboss .as .test .integration .management .api ;
23
23
24
+ import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .ADD ;
25
+ import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .ADMIN_ONLY ;
26
+ import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .NAME ;
27
+ import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .READ_ATTRIBUTE_OPERATION ;
28
+ import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .REMOVE ;
29
+ import static org .jboss .as .test .integration .management .util .ModelUtil .createOpNode ;
30
+
24
31
import java .net .URL ;
25
32
import java .util .concurrent .Callable ;
33
+
26
34
import org .jboss .arquillian .container .test .api .Deployment ;
27
35
import org .jboss .arquillian .container .test .api .RunAsClient ;
28
36
import org .jboss .arquillian .junit .Arquillian ;
29
37
import org .jboss .arquillian .test .api .ArquillianResource ;
38
+ import org .jboss .as .test .integration .management .base .ContainerResourceMgmtTestBase ;
39
+ import org .jboss .as .test .integration .management .util .WebUtil ;
40
+ import org .jboss .as .test .shared .RetryTaskExecutor ;
30
41
import org .jboss .dmr .ModelNode ;
31
42
import org .jboss .shrinkwrap .api .Archive ;
32
43
import org .jboss .shrinkwrap .api .ShrinkWrap ;
33
44
import org .jboss .shrinkwrap .api .spec .JavaArchive ;
45
+ import org .junit .Assert ;
34
46
import org .junit .Test ;
35
47
import org .junit .runner .RunWith ;
36
- import org .junit .Assert ;
37
- import static org .jboss .as .test .integration .management .util .ModelUtil .createOpNode ;
38
- import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .ADD ;
39
- import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .ADMIN_ONLY ;
40
- import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .READ_ATTRIBUTE_OPERATION ;
41
- import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .REMOVE ;
42
- import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .NAME ;
43
-
44
- import org .jboss .as .test .integration .management .base .ContainerResourceMgmtTestBase ;
45
- import org .jboss .as .test .integration .management .util .WebUtil ;
46
- import org .jboss .as .test .shared .RetryTaskExecutor ;
47
- import org .junit .Ignore ;
48
48
49
49
/**
50
- *
51
50
* @author Dominik Pospisil <[email protected] >
52
51
*/
53
52
@ RunWith (Arquillian .class )
54
53
@ RunAsClient
55
- @ Ignore ("ARQ-791" )
56
54
public class ManagementOnlyModeTestCase extends ContainerResourceMgmtTestBase {
57
55
58
56
@ ArquillianResource
@@ -75,20 +73,20 @@ public void testManagementOnlyMode() throws Exception {
75
73
ModelNode result = executeOperation (op );
76
74
77
75
// wait until the server is admin-only mode
78
- RetryTaskExecutor rte = new RetryTaskExecutor ();
76
+ RetryTaskExecutor < ModelNode > rte = new RetryTaskExecutor <> ();
79
77
rte .retryTask (new Callable <ModelNode >() {
80
78
81
79
public ModelNode call () throws Exception {
82
80
ModelNode rop = createOpNode (null , READ_ATTRIBUTE_OPERATION );
83
81
rop .get (NAME ).set ("running-mode" );
84
82
ModelNode mode = executeOperation (rop );
85
- if (! mode .asString ().equals ("ADMIN_ONLY" )) throw new Exception ("Wrong mode." );
83
+ if (!mode .asString ().equals ("ADMIN_ONLY" )) { throw new Exception ("Wrong mode." ); }
86
84
return mode ;
87
85
}
88
86
});
89
87
90
88
// check that the server is unreachable
91
- Assert .assertFalse ("Could not connect to created connector." ,WebUtil .testHttpURL (new URL (
89
+ Assert .assertFalse ("Could not connect to created connector." , WebUtil .testHttpURL (new URL (
92
90
"http" , url .getHost (), url .getPort (), "/" ).toString ()));
93
91
94
92
// update the model in admin-only mode - add a web connector
@@ -97,7 +95,7 @@ public ModelNode call() throws Exception {
97
95
op .get ("port" ).set (TEST_PORT );
98
96
result = executeOperation (op );
99
97
100
- op = createOpNode ("subsystem=undertow/listener=test" , ADD );
98
+ op = createOpNode ("subsystem=undertow/server=default-server/http- listener=test" , ADD );
101
99
op .get ("socket-binding" ).set ("test-binding" );
102
100
result = executeOperation (op );
103
101
@@ -107,28 +105,26 @@ public ModelNode call() throws Exception {
107
105
result = executeOperation (op );
108
106
109
107
// wait until the server is in normal mode
110
- rte = new RetryTaskExecutor ();
111
- rte .retryTask (new Callable <ModelNode >() {
112
- public ModelNode call () throws Exception {
113
- ModelNode rop = createOpNode (null , READ_ATTRIBUTE_OPERATION );
114
- rop .get (NAME ).set ("running-mode" );
115
- ModelNode mode = executeOperation (rop );
116
- if (! mode .asString ().equals ("NORMAL" )) throw new Exception ("Wrong mode." );
117
- return mode ;
118
- }
108
+ rte = new RetryTaskExecutor <>();
109
+ rte .retryTask (() -> {
110
+ ModelNode rop = createOpNode (null , READ_ATTRIBUTE_OPERATION );
111
+ rop .get (NAME ).set ("running-mode" );
112
+ ModelNode mode = executeOperation (rop );
113
+ if (!mode .asString ().equals ("NORMAL" )) { throw new Exception ("Wrong mode." ); }
114
+ return mode ;
119
115
});
120
116
121
117
122
118
// check that the server is up
123
- Assert .assertTrue ("Could not connect to created connector." ,WebUtil .testHttpURL (new URL (
119
+ Assert .assertTrue ("Could not connect to created connector." , WebUtil .testHttpURL (new URL (
124
120
"http" , url .getHost (), url .getPort (), "/" ).toString ()));
125
121
126
122
// check that the changes made in admin-only mode have been applied - test the connector
127
- Assert .assertTrue ("Could not connect to created connector." ,WebUtil .testHttpURL (new URL (
123
+ Assert .assertTrue ("Could not connect to created connector." , WebUtil .testHttpURL (new URL (
128
124
"http" , url .getHost (), TEST_PORT , "/" ).toString ()));
129
125
130
126
// remove the conector
131
- op = createOpNode ("subsystem=undertow/listener=test" , REMOVE );
127
+ op = createOpNode ("subsystem=undertow/server=default-server/http- listener=test" , REMOVE );
132
128
result = executeOperation (op );
133
129
op = createOpNode ("socket-binding-group=standard-sockets/socket-binding=test-binding" , REMOVE );
134
130
result = executeOperation (op );
0 commit comments