Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Commit 42acfeb

Browse files
srinivaskrishnanyaminikb
authored andcommitted
Fixes #21716: IIOP Listener SSL page is not displaying new button (#22123)
1 parent eb02440 commit 42acfeb

4 files changed

Lines changed: 152 additions & 1 deletion

File tree

appserver/admingui/common/src/main/java/org/glassfish/admingui/common/handlers/RestApiHandlers.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,37 @@ public static void createEntity(HandlerContext handlerCtx) {
193193
handlerCtx.setOutputValue("result", endpoint);
194194
}
195195

196+
/**
197+
*
198+
* REST-based version of createProxy
199+
* @param handlerCtx
200+
*/
201+
@Handler(id = "gf.createEntityResponseOutput",
202+
input = {
203+
@HandlerInput(name = "endpoint", type = String.class, required = true),
204+
@HandlerInput(name = "attrs", type = Map.class, required = true),
205+
@HandlerInput(name = "skipAttrs", type = List.class),
206+
@HandlerInput(name = "onlyUseAttrs", type = List.class),
207+
@HandlerInput(name = "convertToFalse", type = List.class),
208+
@HandlerInput(name = "throwException", type = boolean.class, defaultValue = "true")},
209+
output = {
210+
@HandlerOutput(name = "result", type = Map.class)
211+
})
212+
public static void createEntityResponseOutput(HandlerContext handlerCtx) {
213+
Map<String, Object> attrs = (Map) handlerCtx.getInputValue("attrs");
214+
if (attrs == null) {
215+
attrs = new HashMap<String, Object>();
216+
}
217+
String endpoint = (String) handlerCtx.getInputValue("endpoint");
218+
219+
RestResponse response = sendCreateRequest(endpoint, attrs, (List) handlerCtx.getInputValue("skipAttrs"),
220+
(List) handlerCtx.getInputValue("onlyUseAttrs"), (List) handlerCtx.getInputValue("convertToFalse"));
221+
222+
boolean throwException = (Boolean) handlerCtx.getInputValue("throwException");
223+
parseResponse(response, handlerCtx, endpoint, attrs, false, throwException);
224+
handlerCtx.setOutputValue("result", response.getResponse());
225+
}
226+
196227
/**
197228
* <p> This handler can be used to execute a generic REST request. It
198229
* will return a Java data structure based on the response of the

appserver/admingui/corba/src/main/resources/sslEdit.jsf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@
6565
setPageSessionAttribute(key="createSslUrl", value="#{pageSession.parentUrl}/create-ssl");
6666
createMap(result="#{pageSession.createMap}");
6767
mapPut(map="#{pageSession.createMap}" key="target" value="#{pageSession.configName}");
68-
#include "/common/shared/sslPrepare.inc"
68+
<!-- This is a workaround for issue 21716 and can be reverted once REST issue 22134 is fixed -->
69+
<!-- #include "/common/shared/sslPrepare.inc" -->
70+
#include "sslPrepare-copy.inc"
6971
/>
7072
</event>
7173

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<!--
2+
3+
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4+
5+
Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
6+
7+
The contents of this file are subject to the terms of either the GNU
8+
General Public License Version 2 only ("GPL") or the Common Development
9+
and Distribution License("CDDL") (collectively, the "License"). You
10+
may not use this file except in compliance with the License. You can
11+
obtain a copy of the License at
12+
https://oss.oracle.com/licenses/CDDL+GPL-1.1
13+
or LICENSE.txt. See the License for the specific
14+
language governing permissions and limitations under the License.
15+
16+
When distributing the software, include this License Header Notice in each
17+
file and include the License file at LICENSE.txt.
18+
19+
GPL Classpath Exception:
20+
Oracle designates this particular file as subject to the "Classpath"
21+
exception as provided by Oracle in the GPL Version 2 section of the License
22+
file that accompanied this code.
23+
24+
Modifications:
25+
If applicable, add the following below the License Header, with the fields
26+
enclosed by brackets [] replaced by your own identifying information:
27+
"Portions Copyright [year] [name of copyright owner]"
28+
29+
Contributor(s):
30+
If you wish your version of this file to be governed by only the CDDL or
31+
only the GPL Version 2, indicate your decision by adding "[Contributor]
32+
elects to include this software in this distribution under the [CDDL or GPL
33+
Version 2] license." If you don't indicate a single choice of license, a
34+
recipient has the option to distribute your version of this file under
35+
either the CDDL, the GPL Version 2 or to extend the choice of license to
36+
its licensees as provided above. However, if you add GPL Version 2 code
37+
and therefore, elected the GPL Version 2 license, then the option applies
38+
only if the new code is made subject to such option by the copyright
39+
holder.
40+
41+
-->
42+
43+
<!-- sslPrepare-copy.inc -->
44+
45+
setPageSessionAttribute(key="edit" value="#{true}" )
46+
gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}.json" valueMap="#{pageSession.valueMap}");
47+
gf.createEntityResponseOutput(endpoint="#{pageSession.selfUrl}" attrs="#{pageSession.valueMap}" throwException="false" result="#{pageSession.resultMap}");
48+
if ("#{pageSession.resultMap.data.exit_code}=FAILURE") {
49+
setPageSessionAttribute(key="edit" value="#{false}" )
50+
}
51+
if (#{pageSession.edit}){
52+
gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}.json" valueMap="#{pageSession.valueMap}");
53+
convertToDifferentCiphersGroup(ciphers="#{pageSession.valueMap['ssl3TlsCiphers']}"
54+
CommonCiphersList="#{pageSession.selectedCommon}"
55+
EphemeralCiphersList="#{pageSession.selectedEphemeral}"
56+
OtherCiphersList="#{pageSession.selectedOther}"
57+
EccCiphersList="#{pageSession.selectedEcc}")
58+
59+
}
60+
if (! #{pageSession.edit}){
61+
<!-- this <ssl> does not exists, we cannot find a way to get the default value, so hard coded here for now.
62+
TODO: REST need to provide an endpoint to get the default value.
63+
-->
64+
createMap(result="#{pageSession.valueMap}");
65+
mapPut(map="#{pageSession.valueMap}" key="ssl3Enabled" value="true");
66+
mapPut(map="#{pageSession.valueMap}" key="tlsEnabled" value="true");
67+
mapPut(map="#{pageSession.valueMap}" key="trustMaxCertLength" value="5");
68+
69+
convertToDifferentCiphersGroup(ciphers="#{pageSession.valueMap['ssl3TlsCiphers']}"
70+
CommonCiphersList="#{pageSession.selectedCommon}"
71+
EphemeralCiphersList="#{pageSession.selectedEphemeral}"
72+
OtherCiphersList="#{pageSession.selectedOther}"
73+
EccCiphersList="#{pageSession.selectedEcc}")
74+
}
75+
76+
//set the following for including buttons.inc
77+
setPageSessionAttribute(key="convertToFalseList" value={"ssl3Enabled" "tlsEnabled" "clientAuthEnabled" })
78+
setPageSessionAttribute(key="skipAttrsList", value={"sslInactivityTimeout"});
79+
setPageSessionAttribute(key="showDefaultButton" value="#{false}" )
80+
setPageSessionAttribute(key="hasPropertySheet" value="#{true}" )
81+
setPageSessionAttribute(key="hasPropertyTable" value="#{false}" )

appserver/admingui/devtests/src/test/java/org/glassfish/admingui/devtests/IiopListenerTest.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,41 @@ public void testORB() {
109109
//assertEquals("1024", getFieldValue("form1:propertySheet:propertySectionTextField:TotalConnsProp:TotalConns"));
110110
//assertEquals("1024", getFieldValue("form1:propertySheet:propertySectionTextField:MaxMsgSizeProp:MaxMsgSize"));
111111
}
112+
113+
@Test
114+
public void testSSLIiopListener() {
115+
final String iiopName = "testIiopListener" + generateRandomString();
116+
final String networkAddress = "0.0.0.0";
117+
final String listenerPort = Integer.toString(generateRandomNumber(32768));;
118+
final String certName = "s1as";
119+
120+
clickAndWait("treeForm:tree:configurations:server-config:orb:iiopListeners:iiopListeners_link", TRIGGER_IIOP_LISTENERS);
121+
clickAndWait("propertyForm:configs:topActionsGroup1:newButton", TRIGGER_NEW_IIOP_LISTENER);
122+
setFieldValue("propertyForm:propertySheet:generalSettingsSetion:IiopNameTextProp:IiopNameText", iiopName);
123+
setFieldValue("propertyForm:propertySheet:generalSettingsSetion:NetwkAddrProp:NetwkAddr", networkAddress);
124+
setFieldValue("propertyForm:propertySheet:generalSettingsSetion:ListenerPortProp:ListenerPort", listenerPort);
125+
126+
int count = addTableRow("propertyForm:basicTable", "propertyForm:basicTable:topActionsGroup1:addSharedTableButton");
127+
setFieldValue("propertyForm:basicTable:rowGroup1:0:col2:col1St", "a");
128+
setFieldValue("propertyForm:basicTable:rowGroup1:0:col3:col1St", "b");
129+
setFieldValue("propertyForm:basicTable:rowGroup1:0:col4:col1St", "c");
130+
clickAndWait("propertyForm:propertyContentPage:topButtons:newButton", TRIGGER_IIOP_LISTENERS);
131+
assertTrue(isTextPresent(iiopName));
132+
133+
clickAndWait(getLinkIdByLinkText("propertyForm:configs", iiopName), TRIGGER_EDIT_IIOP_LISTENER);
134+
assertEquals(networkAddress, getFieldValue("propertyForm:propertySheet:generalSettingsSetion:NetwkAddrProp:NetwkAddr"));
135+
assertEquals(listenerPort, getFieldValue("propertyForm:propertySheet:generalSettingsSetion:ListenerPortProp:ListenerPort"));
136+
137+
assertTableRowCount("propertyForm:basicTable", count);
138+
139+
// access the SSL Page
140+
clickAndWait("propertyForm:iiopTab:sslEdit", TRIGGER_EDIT_IIOP_SSL);
141+
setFieldValue("propertyForm:propertySheet:propertySheetSection:CertNicknameProp:CertNickname", certName);
142+
clickAndWait("propertyForm:propertyContentPage:topButtons:newButton", TRIGGER_NEW_VALUES_SAVED);
143+
assertEquals(certName, getFieldValue("propertyForm:propertySheet:propertySheetSection:CertNicknameProp:CertNickname"));
144+
145+
clickAndWait("propertyForm:propertyContentPage:topButtons:cancelButton", TRIGGER_IIOP_LISTENERS);
146+
147+
deleteRow("propertyForm:configs:topActionsGroup1:button1", "propertyForm:configs", iiopName);
148+
}
112149
}

0 commit comments

Comments
 (0)