Package com.eviware.soapui.security

Examples of com.eviware.soapui.security.SecurityTest


  @Override
  public void afterRun( TestCaseRunner testRunner, SecurityTestRunContext runContext )
  {
    TestCase testCase = testRunner.getTestCase();

    SecurityTest securityTest = ( ( SecurityTestRunner )testRunner ).getSecurityTest();

    JUnitReport report = new JUnitReport();
    String reportName = securityTest.getName();
    report.setTestSuiteName( reportName );
    report.setPackage( testCase.getTestSuite().getProject().getName() );
    int errorCount = 0;

    for( TestStep ts : testCase.getTestStepList() )
    {
      SecurityTestStepResult secuTestStepResult = securityTest.getSecurityTestStepResultMap().get( ts );
      if( secuTestStepResult != null )
      {
        for( SecurityScanResult scanResult : secuTestStepResult.getSecurityScanResultList() )
        {
          List<SecurityScanRequestResult> resultList = scanResult.getSecurityRequestResultList();
View Full Code Here


    WsdlTestCase testCase = null;
    WsdlTestSuite testSuite = null;
    WsdlProject project = null;
    WsdlMockService mockService = null;
    WsdlMockResponse mockResponse = null;
    SecurityTest securityTest = null;

    if( modelItem instanceof WsdlTestStep )
    {
      testStep = ( WsdlTestStep )modelItem;
      testCase = testStep.getTestCase();
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlTestCase )
    {
      testCase = ( WsdlTestCase )modelItem;
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlTestSuite )
    {
      testSuite = ( WsdlTestSuite )modelItem;
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlMockService )
    {
      project = ( ( WsdlMockService )modelItem ).getProject();
    }
    else if( modelItem instanceof WsdlMockResponse )
    {
      mockResponse = ( WsdlMockResponse )modelItem;
      mockService = ( mockResponse ).getMockOperation().getMockService();
      project = mockService.getProject();
    }
    else if( modelItem instanceof WsdlProject )
    {
      project = ( WsdlProject )modelItem;
    }
    else if( modelItem instanceof AbstractHttpRequestInterface<?> )
    {
      project = ( ( AbstractHttpRequest<?> )modelItem ).getOperation().getInterface().getProject();
    }
    else if( modelItem instanceof Operation )
    {
      project = ( WsdlProject )( ( Operation )modelItem ).getInterface().getProject();
    }
    else if( modelItem instanceof SecurityTest )
    {
      securityTest = ( SecurityTest )modelItem;
      testCase = securityTest.getTestCase();
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }

    TestPropertyHolder globalProperties = PropertyExpansionUtils.getGlobalProperties();
    if( globalProperties.getProperties().size() > 0 )
      targetMenu.add( createPropertyMenu( "Global", globalProperties ) );

    if( project != null )
      targetMenu.add( createPropertyMenu( "Project: [" + project.getName() + "]", project ) );

    if( testSuite != null )
      targetMenu.add( createPropertyMenu( "TestSuite: [" + testSuite.getName() + "]", testSuite ) );

    if( mockService != null )
      targetMenu.add( createPropertyMenu( "MockService: [" + mockService.getName() + "]", mockService ) );

    if( mockResponse != null )
      targetMenu.add( createPropertyMenu( "MockResponse: [" + mockResponse.getName() + "]", mockResponse ) );

    if( testCase != null )
    {
      targetMenu.add( createPropertyMenu( "TestCase: [" + testCase.getName() + "]", testCase ) );

      for( int c = 0; c < testCase.getTestStepCount(); c++ )
      {
        testStep = testCase.getTestStepAt( c );
        if( testStep.getPropertyNames().length == 0 )
          continue;

        if( targetMenu.getComponentCount() == 3 )
          targetMenu.add( new JSeparator() );

        targetMenu.add( createPropertyMenu( "Step " + ( c + 1 ) + ": [" + testStep.getName() + "]", testStep ) );
      }
    }

    if( securityTest != null )
      targetMenu.add( createPropertyMenu( "SecurityTest: [" + securityTest.getName() + "]", securityTest ) );
  }
View Full Code Here

    TestCase testCase = null;
    TestSuite testSuite = null;
    Project project = null;
    WsdlMockService mockService = null;
    WsdlMockResponse mockResponse = null;
    SecurityTest securityTest = null;

    if( modelItem instanceof WsdlTestStep )
    {
      testStep = ( WsdlTestStep )modelItem;
      testCase = testStep.getTestCase();
View Full Code Here

              .getMockOperation() );
    }

    if( contextModelItem instanceof SecurityTest )
    {
      SecurityTest securityTest = ( ( SecurityTest )contextModelItem );

      return propertyModelItem == contextModelItem
          || ( propertyModelItem instanceof TestSuite && securityTest.getTestCase().getTestSuite() == propertyModelItem )
          || ( propertyModelItem instanceof TestCase && securityTest.getTestCase() == propertyModelItem )
          || ( propertyModelItem instanceof SecurityTest && securityTest.getTestCase() == ( ( SecurityTest )propertyModelItem )
              .getTestCase() );
    }

    System.out
        .println( "property " + property.getName() + " can not be transferred to " + contextModelItem.getName() );
View Full Code Here

    WsdlTestSuite testSuite = null;
    WsdlProject project = null;
    WsdlMockService mockService = null;
    WsdlMockResponse mockResponse = null;
    TestPropertyHolder holder = null;
    SecurityTest securityTest = null;

    if( modelItem instanceof WsdlTestStep )
    {
      testStep = ( WsdlTestStep )modelItem;
      testCase = testStep.getTestCase();
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlTestCase )
    {
      testCase = ( WsdlTestCase )modelItem;
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlTestSuite )
    {
      testSuite = ( WsdlTestSuite )modelItem;
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlInterface )
    {
      project = ( ( WsdlInterface )modelItem ).getProject();
    }
    else if( modelItem instanceof WsdlProject )
    {
      project = ( WsdlProject )modelItem;
    }
    else if( modelItem instanceof WsdlMockService )
    {
      mockService = ( WsdlMockService )modelItem;
      project = mockService.getProject();
    }
    else if( modelItem instanceof AbstractHttpRequestInterface<?> )
    {
      project = ( ( AbstractHttpRequest<?> )modelItem ).getOperation().getInterface().getProject();
    }
    else if( modelItem instanceof WsdlMockOperation )
    {
      mockService = ( ( WsdlMockOperation )modelItem ).getMockService();
      project = mockService.getProject();
    }
    else if( modelItem instanceof WsdlMockResponse )
    {
      mockResponse = ( WsdlMockResponse )modelItem;
      mockService = mockResponse.getMockOperation().getMockService();
      project = mockService.getProject();
    }
    else if( modelItem instanceof SecurityTest )
    {
      securityTest = ( SecurityTest )modelItem;
      testCase = securityTest.getTestCase();
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }

    // explicit item reference?
View Full Code Here

      name = UISupport.prompt( "Specify unique name of SecurityTest", "Rename SecurityTest", name );
      if( StringUtils.isNullOrEmpty( name ) )
        return;
    }

    SecurityTest securityTest = testCase.addNewSecurityTest( name );
    UISupport.selectAndShow( securityTest );
  }
View Full Code Here

      name = UISupport.prompt( "Specify unique name of SecurityTest", "Clone SecurityTest", name );
      if( StringUtils.isNullOrEmpty( name ) )
        return;
    }

    SecurityTest newSecurityTest = securityTest.getTestCase().cloneSecurityTest( securityTest, name );
    UISupport.selectAndShow( newSecurityTest );
  }
View Full Code Here

    }

    Project project = securityScan.getTestStep().getTestCase().getTestSuite().getProject();
    TestSuite targetTestSuite = project.getTestSuiteByName( targetTestSuiteName );
    TestCase targetTestCase = targetTestSuite.getTestCaseByName( targetTestCaseName );
    SecurityTest targetSecurityTest = targetTestCase.getSecurityTestByName( targetSecurityTestName );
    TestStep targetTestStep = targetTestCase.getTestStepByName( targetSecurityTestStepName );

    boolean overwrite = dialog.getBooleanValue( CloneParameterDialog.OVERWRITE );

    for( String scanName : targetSecurityScans )
    {
      AbstractSecurityScanWithProperties targetSecurityScan = ( AbstractSecurityScanWithProperties )targetSecurityTest
          .getTestStepSecurityScanByName( targetTestStep.getId(), scanName );

      for( int i : indexes )
      {
        SecurityCheckedParameter scanParameter = securityScan.getParameterAt( i );
View Full Code Here

            {
              dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
            }

            String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
            SecurityTest securityTest = testCase.getSecurityTestByName( securityTestName );
            String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
            TestStep testStep = testCase.getTestStepByName( testStepName );
            String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
                testStep.getId(), AbstractSecurityScanWithProperties.class ) );
            dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
          }
          else
          {
            dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, new String[0] );
            dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
            dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, new String[0] );
          }
        }
        else
        {
          dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, new String[0] );
          dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
        }
      }
    } );
    dialog.getFormField( CloneParameterDialog.TARGET_TESTCASE ).addFormFieldListener( new XFormFieldListener()
    {
      public void valueChanged( XFormField sourceField, String newValue, String oldValue )
      {
        String testSuiteName = dialog.getValue( CloneParameterDialog.TARGET_TESTSUITE );
        TestSuite testSuite = project.getTestSuiteByName( testSuiteName );
        TestCase testCase = testSuite.getTestCaseByName( newValue );

        String[] testStepNames = new String[0];
        String[] securityTestNames = ModelSupport.getNames( testCase.getSecurityTestList() );
        dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, securityTestNames );
        if( securityTestNames.length > 0 )
        {
          testStepNames = getSecurableTestStepsNames( testCase );
        }
        dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, testStepNames );

        if( securityTestNames.length > 0 )
        {
          dialog.setValue( CloneParameterDialog.TARGET_SECURITYTEST, securityTestNames[0] );
          if( testStepNames.length > 0 )
          {
            dialog.setValue( CloneParameterDialog.TARGET_TESTSTEP, testStepNames[0] );
          }
          else
          {
            dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
          }

          String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
          SecurityTest securityTest = testCase.getSecurityTestByName( securityTestName );
          String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
          TestStep testStep = testCase.getTestStepByName( testStepName );
          String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
              testStep.getId(), AbstractSecurityScanWithProperties.class ) );
          dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
        }
        else
        {
          dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, new String[0] );
          dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
          dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, new String[0] );
        }
      }
    } );
    dialog.getFormField( CloneParameterDialog.TARGET_TESTSTEP ).addFormFieldListener( new XFormFieldListener()
    {
      public void valueChanged( XFormField sourceField, String newValue, String oldValue )
      {
        String testSuiteName = dialog.getValue( CloneParameterDialog.TARGET_TESTSUITE );
        TestSuite testSuite = project.getTestSuiteByName( testSuiteName );
        String testCaseName = dialog.getValue( CloneParameterDialog.TARGET_TESTCASE );
        TestCase testCase = testSuite.getTestCaseByName( testCaseName );
        String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
        SecurityTest securityTest = testCase.getSecurityTestByName( securityTestName );
        TestStep testStep = testCase.getTestStepByName( newValue );

        String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
            testStep.getId(), AbstractSecurityScanWithProperties.class ) );
        dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
      }
    } );
    dialog.getFormField( CloneParameterDialog.TARGET_SECURITYTEST ).addFormFieldListener( new XFormFieldListener()
    {
      public void valueChanged( XFormField sourceField, String newValue, String oldValue )
      {
        String testSuiteName = dialog.getValue( CloneParameterDialog.TARGET_TESTSUITE );
        TestSuite testSuite = project.getTestSuiteByName( testSuiteName );
        String testCaseName = dialog.getValue( CloneParameterDialog.TARGET_TESTCASE );
        TestCase testCase = testSuite.getTestCaseByName( testCaseName );
        SecurityTest securityTest = testCase.getSecurityTestByName( newValue );
        String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
        TestStep testStep = testCase.getTestStepByName( testStepName );

        String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
            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 );

    dialog.setOptions( CloneParameterDialog.PARAMETERS, securityScan.getParameterHolder().getParameterLabels() );
View Full Code Here

    // if( !forLoadTest )
    // {
    List<SecurityTestConfig> securityTestConfigs = config.getSecurityTestList();
    for( SecurityTestConfig tsc : securityTestConfigs )
    {
      SecurityTest securityTest = buildSecurityTest( tsc );
      securityTests.add( securityTest );
    }
    // }

    // init default configs
View Full Code Here

TOP

Related Classes of com.eviware.soapui.security.SecurityTest

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.