/** To be overridden.. */ public void onClose(T modelItem) { if (dialog == null) return; if (modelItem == null) { SoapUI.getSettings().setString(valuesSettingID, dialog.getValues().toXml()); } else { modelItem.getSettings().setString(valuesSettingID, dialog.getValues().toXml()); } }
private Object[] getSourceProperties() { if (dialog == null) return new Object[] {null}; String sourceStep = dialog.getValues().get(SOURCE_STEP); TestStep testStep = request.getTestCase().getTestStepByName(sourceStep); if (testStep == null) return new Object[] {null}; StringList result = new StringList(); result.addAll(testStep.getPropertyNames()); if (testStep instanceof WsdlPropertiesTestStep) { result.add(0, null); } return result.toArray(); }
private Object[] getPropertyTransfers() { if (dialog == null) return new Object[] {null}; String targetStep = dialog.getValues().get(TRANSFER_STEP); TransferResponseValuesTestStep testStep = (TransferResponseValuesTestStep) request.getTestCase().getTestStepByName(targetStep); if (testStep == null) return new Object[] {null}; StringList result = new StringList(); result.add(null); for (int c = 0; c < testStep.getTransferCount(); c++) { result.add(testStep.getTransferAt(c).getName()); } return result.toArray(); }
public Credentials getCredentials(final AuthScope authScope) { if (authScope == null) { throw new IllegalArgumentException("Authentication scope may not be null"); } // if( cache.containsKey( authScope ) ) // { // return cache.get( authScope ); // } String pw = getPassword(); if (pw == null) pw = ""; if (AuthPolicy.NTLM.equalsIgnoreCase(authScope.getScheme()) || AuthPolicy.SPNEGO.equalsIgnoreCase(authScope.getScheme())) { String workstation = ""; try { workstation = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { } if (hasCredentials()) { log.info("Returning url credentials"); return new NTCredentials(getUsername(), pw, workstation, null); } log.info( authScope.getHost() + ":" + authScope.getPort() + " requires Windows authentication"); if (ntDialog == null) { buildNtDialog(); } StringToStringMap values = new StringToStringMap(); values.put( "Info", "Authentication required for [" + authScope.getHost() + ":" + authScope.getPort() + "]"); ntDialog.setValues(values); if (ntDialog.show()) { values = ntDialog.getValues(); NTCredentials credentials = new NTCredentials( values.get("Username"), values.get("Password"), workstation, values.get("Domain")); cache.put(authScope, credentials); return credentials; } } else if (AuthPolicy.BASIC.equalsIgnoreCase(authScope.getScheme()) || AuthPolicy.DIGEST.equalsIgnoreCase(authScope.getScheme())) { if (hasCredentials()) { log.info("Returning url credentials"); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(getUsername(), pw); cache.put(authScope, credentials); return credentials; } log.info( authScope.getHost() + ":" + authScope.getPort() + " requires authentication with the realm '" + authScope.getRealm() + "'"); ShowDialog showDialog = new ShowDialog(); showDialog.values.put( "Info", "Authentication required for [" + authScope.getHost() + ":" + authScope.getPort() + "]"); UISupport.getUIUtils().runInUIThreadIfSWT(showDialog); if (showDialog.result) { UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( showDialog.values.get("Username"), showDialog.values.get("Password")); cache.put(authScope, credentials); return credentials; } } return null; }