private ConfigurationDocument createConfigFile(StringToStringMap values, Interface modelItem) { ConfigurationDocument configDocument = ConfigurationDocument.Factory.newInstance(); ConfigurationType config = configDocument.addNewConfiguration(); try { StringToStringMap nsMappings = StringToStringMap.fromXml(values.get(NAMESPACE_MAPPING)); if (!nsMappings.isEmpty()) { GlobalType global = config.addNewGlobal(); for (String namespace : nsMappings.keySet()) { PkgNSType entry = global.addNewPackageNamespace(); entry.setNamespace(namespace); entry.setPackage(nsMappings.get(namespace)); } } } catch (Exception e) { SoapUI.logError(e); } WsdlToJavaType wsdl2Java = config.addNewWsdlJava(); String wsdlUrl = getWsdlUrl(values, modelItem); try { new URL(wsdlUrl); wsdl2Java.setLocation(wsdlUrl); } catch (MalformedURLException e) { ((Element) wsdl2Java.getDomNode()).setAttribute("file", wsdlUrl); } if (values.getBoolean(UNWRAP)) wsdl2Java.setParameterStyle(ParameterStyle.BARE); else wsdl2Java.setParameterStyle(ParameterStyle.WRAPPED); if (values.get(EJB_LINK) != null && values.get(EJB_LINK).length() > 0) { WsxmlType webservices = wsdl2Java.addNewWebservices(); webservices.setEjbLink(values.get(EJB_LINK)); webservices.setAppend(values.getBoolean(APPEND)); } else if (values.get(SERVLET_LINK) != null && values.get(SERVLET_LINK).length() > 0) { WsxmlType webservices = wsdl2Java.addNewWebservices(); webservices.setServletLink(values.get(SERVLET_LINK)); webservices.setAppend(values.getBoolean(APPEND)); } String mappingFile = values.get(MAPPING).toString().trim(); if (mappingFile.length() > 0) { wsdl2Java.addNewMapping().setFile(mappingFile); } return configDocument; }
protected String getWsdlUrl(StringToStringMap values, T modelItem) { String wsdl = values.get(WSDL); boolean useCached = values.getBoolean(CACHED_WSDL); if (modelItem instanceof AbstractInterface) { AbstractInterface<?> iface = (AbstractInterface<?>) modelItem; boolean hasDefinition = StringUtils.hasContent(iface.getDefinition()); if (wsdl == null && !useCached && hasDefinition) { return PathUtils.expandPath(iface.getDefinition(), iface); } if (!hasDefinition || (useCached && iface.getDefinitionContext().isCached())) { try { File tempFile = File.createTempFile("tempdir", null); String path = tempFile.getAbsolutePath(); tempFile.delete(); wsdl = iface.getDefinitionContext().export(path); // CachedWsdlLoader loader = (CachedWsdlLoader) // iface.createWsdlLoader(); // wsdl = loader.saveDefinition(path); } catch (Exception e) { SoapUI.logError(e); } } } return wsdl; }
protected void initWSDL(StringToStringMap values, WsdlInterface iface) { boolean cached = iface.isCached(); if (useCached != null) useCached.setEnabled(cached); if (!values.containsKey(CACHED_WSDL)) values.put(CACHED_WSDL, Boolean.toString(cached)); if (values.getBoolean(CACHED_WSDL) || !values.hasValue(WSDL)) values.put(WSDL, PathUtils.expandPath(iface.getDefinition(), iface)); }
public boolean configure() { if (dialog == null) buildDialog(); StringToStringMap values = new StringToStringMap(); values.put(CONTENT, token); values.put(IGNORE_CASE, ignoreCase); values.put(USE_REGEX, useRegEx); values = dialog.show(values); if (dialog.getReturnValue() == XFormDialog.OK_OPTION) { token = values.get(CONTENT); ignoreCase = values.getBoolean(IGNORE_CASE); useRegEx = values.getBoolean(USE_REGEX); } setConfiguration(createConfiguration()); return true; }
protected void createTransfer(StringToStringMap values) { String propertyTransfer = values.get(TRANSFER_STEP); WsdlTestCase testCase = (WsdlTestCase) request.getTestCase(); TransferResponseValuesTestStep transferStep = (TransferResponseValuesTestStep) testCase.getTestStepByName(propertyTransfer); if (transferStep == null) { int index = testCase.getIndexOfTestStep(request.getRequestStep()); transferStep = (TransferResponseValuesTestStep) testCase.insertTestStep( TransferValuesStepFactory.TRANSFER_TYPE, propertyTransfer, index); } if (transferStep == null) { UISupport.showErrorMessage("Missing transfer step [" + propertyTransfer + "]"); return; } PropertyTransfer transfer = transferStep.getTransferByName(values.get(TRANSFER_NAME)); if (transfer == null) transfer = transferStep.addTransfer(values.get(TRANSFER_NAME)); transfer.setTargetStepName(request.getRequestStep().getName()); transfer.setTargetPropertyName("Request"); transfer.setTargetPath(values.get(TARGET_XPATH)); String sourceStepName = values.get(SOURCE_STEP); transfer.setSourceStepName(sourceStepName); TestStep sourceStep = testCase.getTestStepByName(sourceStepName); if (sourceStep == null) { sourceStep = (WsdlPropertiesTestStep) testCase.insertTestStep(PropertiesStepFactory.PROPERTIES_TYPE, sourceStepName, 0); } String sourcePropertyName = values.get(SOURCE_PROPERTY); if (sourceStep.getProperty(sourcePropertyName) == null && sourceStep instanceof WsdlPropertiesTestStep) { ((WsdlPropertiesTestStep) sourceStep).addProperty(sourcePropertyName); } transfer.setSourcePropertyName(sourcePropertyName); if (values.getBoolean(OPEN_EDITOR)) { TransferResponseValuesDesktopPanel panel = (TransferResponseValuesDesktopPanel) UISupport.showDesktopPanel(transferStep); panel.selectTransfer(transfer); } }
public boolean configure() { if (dialog == null) buildDialog(); StringToStringMap values = new StringToStringMap(); values.put(ASSERT_ACTION, assertWsaAction); values.put(ASSERT_TO, assertWsaTo); values.put(ASSERT_REPLY_TO, assertWsaReplyTo); values.put(ASSERT_MESSAGE_ID, assertWsaMessageId); // values.put(ASSERT_RELATES_TO, assertWsaRelatesTo); // values.put(ASSERT_REPLY_TO_REF_PARAMS, assertReplyToRefParams); // values.put(ASSERT_FAULT_TO_REF_PARAMS, assertFaultToRefParams); values = dialog.show(values); if (dialog.getReturnValue() == XFormDialog.OK_OPTION) { assertWsaAction = values.getBoolean(ASSERT_ACTION); assertWsaTo = values.getBoolean(ASSERT_TO); assertWsaReplyTo = values.getBoolean(ASSERT_REPLY_TO); assertWsaMessageId = values.getBoolean(ASSERT_MESSAGE_ID); // assertWsaRelatesTo = values.getBoolean(ASSERT_RELATES_TO); // assertReplyToRefParams = values // .getBoolean(ASSERT_REPLY_TO_REF_PARAMS); // assertFaultToRefParams = values // .getBoolean(ASSERT_FAULT_TO_REF_PARAMS); } wsaAssertionConfiguration = new WsaAssertionConfiguration( assertWsaAction, assertWsaTo, assertWsaReplyTo, assertWsaMessageId, false, false, false); setConfiguration(createConfiguration()); return true; }
public void storeValues(StringToStringMap values, Settings settings) { if (editorFontTextField != null) { settings.setString(UISettings.EDITOR_FONT, editorFontTextField.getText()); } settings.setBoolean( UISettings.NO_RESIZE_REQUEST_EDITOR, values.getBoolean(NO_RESIZE_REQUEST_EDITOR)); settings.setBoolean( UISettings.START_WITH_REQUEST_TABS, values.getBoolean(START_WITH_REQUEST_TABS)); settings.setBoolean(UISettings.AUTO_VALIDATE_REQUEST, values.getBoolean(AUTO_VALIDATE_REQUEST)); settings.setBoolean( UISettings.ABORT_ON_INVALID_REQUEST, values.getBoolean(ABORT_ON_INVALID_REQUEST)); settings.setBoolean( UISettings.AUTO_VALIDATE_RESPONSE, values.getBoolean(AUTO_VALIDATE_RESPONSE)); settings.setBoolean(UISettings.SHOW_XML_LINE_NUMBERS, values.getBoolean(XML_LINE_NUMBERS)); settings.setBoolean( UISettings.SHOW_GROOVY_LINE_NUMBERS, values.getBoolean(GROOVY_LINE_NUMBERS)); }