Package com.eviware.soapui.impl.wsdl.testcase

Examples of com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase


  public void perform( WsdlMockResponse mockResponse, Object param )
  {
    WsdlProject project = ( WsdlProject )ModelSupport.getModelItemProject( mockResponse );

    WsdlTestCase testCase = getTargetTestCase( project );
    if( testCase != null )
      addRequest( testCase, mockResponse, -1 );
  }
View Full Code Here


  }

  public void perform( WsdlTestStep testStep, Object param )
  {
    WsdlTestStepFactory factory = ( WsdlTestStepFactory )param;
    WsdlTestCase testCase = testStep.getTestCase();

    if( !factory.canAddTestStepToTestCase( testCase ) )
      return;

    String name = UISupport.prompt( "Specify name for new step", "Insert Step", factory.getTestStepName() );
    if( name != null )
    {
      TestStepConfig newTestStepConfig = factory.createNewTestStep( testCase, name );
      if( newTestStepConfig != null )
      {
        int ix = testCase.getIndexOfTestStep( testStep );
        testStep = testCase.insertTestStep( newTestStepConfig, ix + 1);
        if( testStep != null )
          UISupport.selectAndShow( testStep );
      }
    }
  }
View Full Code Here

  }

  public void perform( WsdlMockResponse mockResponse, Object param )
  {
    WsdlMockService mockService = mockResponse.getMockOperation().getMockService();
    WsdlTestCase testCase = getTargetTestCase( mockService.getProject() );
    if( testCase == null )
      return;

    addMockResponseToTestCase( mockResponse, testCase, -1 );
  }
View Full Code Here

    super( "Move Step Up", "Moves this TestStep up" );
  }

  public void perform( WsdlTestStep testStep, Object param )
  {
    WsdlTestCase testCase = testStep.getTestCase();
    int ix = testCase.getIndexOfTestStep( testStep );
    if( ix == -1 || ix == 0 )
      return;

    testCase.moveTestStep( ix, -1 );
    UISupport.select( testStep );
  }
View Full Code Here

    super( "Add as MockResponse Step", "Creates a MockResponseStep for this Operation" );
  }

  public void perform( WsdlOperation operation, Object param )
  {
    WsdlTestCase testCase = getTargetTestCase( operation.getInterface().getProject() );
    if( testCase != null )
      addMockResponse( testCase, operation );
  }
View Full Code Here

      String targetTestCaseName = dialog.getValue( Form.TESTCASE );
      String name = dialog.getValue( Form.NAME );

      WsdlProject project = testStep.getTestCase().getTestSuite().getProject();
      WsdlTestSuite targetTestSuite = null;
      WsdlTestCase targetTestCase = null;
      Set<Interface> requiredInterfaces = new HashSet<Interface>();

      // to another project project?
      if( !targetProjectName.equals( project.getName() ) )
      {
        // get required interfaces
        requiredInterfaces.addAll( testStep.getRequiredInterfaces() );

        project = ( WsdlProject )workspace.getProjectByName( targetProjectName );
        if( project == null )
        {
          targetProjectName = UISupport.prompt( "Enter name for new Project", "Clone TestStep", "" );
          if( targetProjectName == null )
            return;

          try
          {
            project = workspace.createProject( targetProjectName, null );
          }
          catch( SoapUIException e )
          {
            UISupport.showErrorMessage( e );
          }

          if( project == null )
            return;
        }

        if( requiredInterfaces.size() > 0 && project.getInterfaceCount() > 0 )
        {
          Map<String, Interface> bindings = new HashMap<String, Interface>();
          for( Interface iface : requiredInterfaces )
          {
            bindings.put( iface.getTechnicalId(), iface );
          }

          for( Interface iface : project.getInterfaceList() )
          {
            bindings.remove( iface.getTechnicalId() );
          }

          requiredInterfaces.retainAll( bindings.values() );
        }

        if( requiredInterfaces.size() > 0 )
        {
          String msg = "Target project [" + targetProjectName + "] is missing required Interfaces;\r\n\r\n";
          for( Interface iface : requiredInterfaces )
          {
            msg += iface.getName() + " [" + iface.getTechnicalId() + "]\r\n";
          }
          msg += "\r\nThese will be cloned to the targetProject as well";

          if( !UISupport.confirm( msg, "Clone TestStep" ) )
            return;

          for( Interface iface : requiredInterfaces )
          {
            project.importInterface( ( AbstractInterface<?> )iface, true, true );
          }
        }
      }

      targetTestSuite = project.getTestSuiteByName( targetTestSuiteName );
      if( targetTestSuite == null )
      {
        targetTestSuiteName = UISupport.prompt( "Specify name for new TestSuite", "Clone TestStep", "Copy of "
            + testStep.getTestCase().getTestSuite().getName() );
        if( targetTestSuiteName == null )
          return;

        targetTestSuite = project.addNewTestSuite( targetTestSuiteName );
      }

      targetTestCase = targetTestSuite.getTestCaseByName( targetTestCaseName );
      if( targetTestCase == null )
      {
        targetTestCaseName = UISupport.prompt( "Specify name for new TestCase", "Clone TestStep", "Copy of "
            + testStep.getTestCase().getName() );
        if( targetTestCaseName == null )
          return;

        targetTestCase = targetTestSuite.addNewTestCase( targetTestCaseName );
      }

      boolean move = dialog.getBooleanValue( Form.MOVE );

      WsdlTestStep newTestStep = targetTestCase.importTestStep( testStep, name, -1, !move );
      if( newTestStep == null )
        return;

      if( dialog.getBooleanValue( Form.OPEN ) )
        UISupport.selectAndShow( newTestStep );
View Full Code Here

    super( "Move Step Down", "Moves this TestStep down" );
  }

  public void perform( WsdlTestStep testStep, Object param )
  {
    WsdlTestCase testCase = testStep.getTestCase();
    int ix = testCase.getIndexOfTestStep( testStep );
    if( ix == -1 || ix >= testCase.getTestStepCount() - 1 )
      return;

    testCase.moveTestStep( ix, 1 );
    UISupport.select( testStep );
  }
View Full Code Here

        targetTestSuite = project.addNewTestSuite( targetTestSuiteName );
      }

      boolean move = dialog.getBooleanValue( Form.MOVE );
      WsdlTestCase newTestCase = targetTestSuite.importTestCase( testCase, name, -1,
          dialog.getBooleanValue( Form.CLONE_LOADTESTS ), dialog.getBooleanValue( Form.CLONE_SECURITYTESTS ),
          !move );
      UISupport.select( newTestCase );

      if( move )
      {
        testCase.getTestSuite().removeTestCase( testCase );
      }
      boolean cloneDescription = dialog.getBooleanValue( Form.CLONE_DESCRIPTION );
      if( !cloneDescription )
      {
        newTestCase.setDescription( dialog.getValue( Form.DESCRIPTION ) );
      }
    }
  }
View Full Code Here

        dialog.show();
      }
      String testStepName = dialog.getValue( Form.URL );
      String url = HttpUtils.ensureEndpointStartsWithProtocol( testStepName );
      WsdlTestSuite targetTestSuite = null;
      WsdlTestCase targetTestCase = null;

      targetTestSuite = project.getTestSuiteByName( targetTestSuiteName );
      if( targetTestSuite == null )
      {
        targetTestSuiteName = "Web TestSuite";
        while( project.getTestSuiteByName( targetTestSuiteName ) != null )
        {
          targetTestSuiteName = UISupport.prompt(
              "TestSuite name must be unique, please specify new name for TestSuite\n" + "[" + project.getName()
                  + "->" + targetTestSuiteName + "]", "Change TestSuite name", targetTestSuiteName );

          if( targetTestSuiteName == null )
            return;
        }

        targetTestSuite = project.addNewTestSuite( targetTestSuiteName );
      }
      targetTestCase = targetTestSuite.getTestCaseByName( targetTestCaseName );
      if( targetTestCase == null )
      {
        while( targetTestSuite.getTestCaseByName( targetTestCaseName ) != null )
        {
          targetTestCaseName = UISupport.prompt(
              "TestCase name must be unique, please specify new name for TestCase\n" + "[" + targetTestCaseName
                  + "] in TestSuite [" + project.getName() + "->" + targetTestSuiteName + "]",
              "Change TestCase name", targetTestCaseName );
          if( targetTestCaseName == null )
            return;
        }
        targetTestCase = targetTestSuite.addNewTestCase( targetTestCaseName );

      }
      while( testStepName == null || targetTestCase.getTestStepByName( testStepName ) != null )
      {
        testStepName = UISupport.prompt( "TestStep name must be unique, please specify new name for step\n" + "["
            + testStepName + "] in TestCase [" + project.getName() + "->" + targetTestSuiteName + "->"
            + targetTestCaseName + "]", "Change TestStep name", testStepName );
View Full Code Here

            testStep.getId(), AbstractSecurityScanWithProperties.class ) );
        dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
      }
    } );

    WsdlTestCase wsdlTestCase = ( WsdlTestCase )securityScan.getTestStep().getTestCase();

    dialog.setOptions( CloneParameterDialog.TARGET_TESTSUITE,
        ModelSupport.getNames( wsdlTestCase.getTestSuite().getProject().getTestSuiteList() ) );
    dialog.setValue( CloneParameterDialog.TARGET_TESTSUITE, wsdlTestCase.getTestSuite().getName() );

    List<TestCase> wsdlTestCaseList = wsdlTestCase.getTestSuite().getTestCaseList();
    dialog.setOptions( CloneParameterDialog.TARGET_TESTCASE, ModelSupport.getNames( wsdlTestCaseList ) );
    dialog.setValue( CloneParameterDialog.TARGET_TESTCASE, wsdlTestCase.getName() );

    dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, getSecurableTestStepsNames( wsdlTestCase ) );
    dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST,
        ModelSupport.getNames( wsdlTestCase.getSecurityTestList() ) );

    String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
    SecurityTest securityTest = wsdlTestCase.getSecurityTestByName( securityTestName );
    String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
    TestStep testStep = wsdlTestCase.getTestStepByName( testStepName );

    String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType( testStep.getId(),
        AbstractSecurityScanWithProperties.class ) );
    dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase

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.