Package com.eviware.soapui.config

Examples of com.eviware.soapui.config.SoapuiProjectDocumentConfig


    beforeSave();
    // work with copy beacuse we do not want to change working project while
    // working with it
    // if user choose save project, save all etc.
    SoapuiProjectDocumentConfig projectDocument = ( SoapuiProjectDocumentConfig )this.projectDocument.copy();

    // check for caching
    if( !getSettings().getBoolean( WsdlSettings.CACHE_WSDLS ) )
    {
      // no caching -> create copy and remove definition cachings
      removeDefinitionCaches( projectDocument );
    }

    // remove project root
    XmlBeansSettingsImpl tempSettings = new XmlBeansSettingsImpl( this, null, projectDocument.getSoapuiProject()
        .getSettings() );
    tempSettings.clearSetting( ProjectSettings.PROJECT_ROOT );

    // check for encryption
    String passwordForEncryption = getSettings().getString( ProjectSettings.SHADOW_PASSWORD, null );

    // if it has encryptedContend that means it is not decrypted corectly( bad
    // password, etc ), so do not encrypt it again.
    if( projectDocument.getSoapuiProject().getEncryptedContent() == null )
    {
      if( passwordForEncryption != null )
      {
        if( passwordForEncryption.length() > 1 )
        {
          // we have password so do encryption
          try
          {
            String data = getConfig().xmlText();
            byte[] encrypted = OpenSSL.encrypt( "des3", passwordForEncryption.toCharArray(), data.getBytes() );
            projectDocument.getSoapuiProject().setEncryptedContent( encrypted );
            projectDocument.getSoapuiProject().setInterfaceArray( null );
            projectDocument.getSoapuiProject().setTestSuiteArray( null );
            projectDocument.getSoapuiProject().setMockServiceArray( null );
            projectDocument.getSoapuiProject().unsetWssContainer();
            projectDocument.getSoapuiProject().unsetSettings();
            projectDocument.getSoapuiProject().unsetProperties();

          }
          catch( GeneralSecurityException e )
          {
            UISupport.showErrorMessage( "Encryption Error" );
          }
        }
        else
        {
          // no password no encryption.
          projectDocument.getSoapuiProject().setEncryptedContent( null );
        }
      }
    }
    // end of encryption.

    XmlOptions options = new XmlOptions();
    if( SoapUI.getSettings().getBoolean( WsdlSettings.PRETTY_PRINT_PROJECT_FILES ) )
      options.setSavePrettyPrint();

    projectDocument.getSoapuiProject().setSoapuiVersion( SoapUI.SOAPUI_VERSION );

    try
    {
      File tempFile = File.createTempFile( "project-temp-", ".xml", projectFile.getParentFile() );

      // save once to make sure it can be saved
      FileOutputStream tempOut = new FileOutputStream( tempFile );
      projectDocument.save( tempOut, options );
      tempOut.close();

      if( getSettings().getBoolean( UISettings.LINEBREAK ) )
      {
        normalizeLineBreak( projectFile, tempFile );
      }
      else
      {
        // now save it for real
        FileOutputStream projectOut = new FileOutputStream( projectFile );
        projectDocument.save( projectOut, options );
        projectOut.close();
        // delete tempFile here so we have it as backup in case second save
        // fails
        if( !tempFile.delete() )
        {
View Full Code Here


        beforeSave();
        // work with copy because we do not want to change working project while
        // working with it
        // if user choose save project, save all etc.
        SoapuiProjectDocumentConfig projectDocument = (SoapuiProjectDocumentConfig) this.projectDocument.copy();

        // check for caching
        if (!getSettings().getBoolean(WsdlSettings.CACHE_WSDLS)) {
            // no caching -> create copy and remove definition cachings
            removeDefinitionCaches(projectDocument);
        }

        removeProjectRoot(projectDocument);

        if (hasBeenSuccessfullyDecrypted(projectDocument) && hasEncryptionPassword()) {
            ProjectConfig encryptedProjectConfig = encrypt(projectDocument);
            projectDocument.setSoapuiProject(encryptedProjectConfig);
        }

        XmlOptions options = new XmlOptions();
        if (SoapUI.getSettings().getBoolean(WsdlSettings.PRETTY_PRINT_PROJECT_FILES)) {
            options.setSavePrettyPrint();
        }

        projectDocument.getSoapuiProject().setSoapuiVersion(SoapUI.SOAPUI_VERSION);

        try {
            File tempFile = File.createTempFile("project-temp-", XML_EXTENSION, projectFile.getParentFile());

            // save once to make sure it can be saved
            FileOutputStream tempOut = new FileOutputStream(tempFile);
            projectDocument.save(tempOut, options);
            tempOut.close();

            if (getSettings().getBoolean(UISettings.LINEBREAK)) {
                normalizeLineBreak(projectFile, tempFile);
            } else {
                // now save it for real
                FileOutputStream projectOut = new FileOutputStream(projectFile);
                projectDocument.save(projectOut, options);
                projectOut.close();
            }

            // delete tempFile here so we have it as backup in case second save fails
            if (!tempFile.delete()) {
View Full Code Here

TOP

Related Classes of com.eviware.soapui.config.SoapuiProjectDocumentConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.