Toolkit.getDefaultToolkit().beep();
return;
}
String selectedEndpoint = tableModel.getEndpointAt( selectedIndex );
EndpointDefaults defaults = tableModel.getDefaultsAt( selectedIndex );
List<String> list = new ArrayList<String>( Arrays.asList( iface.getEndpoints() ) );
list.add( 0, ALL_REQUESTS );
list.add( 1, ALL_TEST_REQUESTS );
list.add( 2, ALL_REQUESTS_AND_TEST_REQUESTS );
list.add( 3, ALL_REQUESTS_WITH_NO_ENDPOINT );
Object endpoint = UISupport.prompt( "Assign selected endpoint and authorization to..", "Assign Endpoint",
list.toArray(), ALL_REQUESTS_WITH_NO_ENDPOINT );
if( endpoint == null )
return;
if( endpoint.equals( ALL_REQUESTS ) || endpoint.equals( ALL_REQUESTS_WITH_NO_ENDPOINT )
|| endpoint.equals( ALL_REQUESTS_AND_TEST_REQUESTS ) )
{
for( Operation operation : iface.getAllOperations() )
{
for( int i = 0; i < operation.getRequestCount(); i++ )
{
AbstractHttpRequest<?> request = ( AbstractHttpRequest<?> )operation.getRequestAt( i );
String ep = request.getEndpoint();
if( endpoint.equals( ALL_REQUESTS ) || endpoint.equals( ALL_REQUESTS_AND_TEST_REQUESTS )
|| ( endpoint.equals( ALL_REQUESTS_WITH_NO_ENDPOINT ) && ep == null )
|| ( ep.equals( endpoint ) ) )
{
request.setEndpoint( selectedEndpoint );
request.setUsername( defaults.getUsername() );
request.setPassword( defaults.getPassword() );
request.setDomain( defaults.getDomain() );
if( request instanceof WsdlRequest )
{
( ( WsdlRequest )request ).setWssPasswordType( defaults.getWssType() );
( ( WsdlRequest )request ).setWssTimeToLive( defaults.getWssTimeToLive() );
( ( WsdlRequest )request ).setOutgoingWss( defaults.getOutgoingWss() );
( ( WsdlRequest )request ).setIncomingWss( defaults.getIncomingWss() );
}
}
}
}
}
if( endpoint.equals( ALL_REQUESTS_AND_TEST_REQUESTS ) || endpoint.equals( ALL_TEST_REQUESTS ) )
{
for( TestSuite testSuite : iface.getProject().getTestSuiteList() )
{
for( TestCase testCase : testSuite.getTestCaseList() )
{
for( TestStep testStep : testCase.getTestStepList() )
{
if( testStep instanceof HttpRequestTestStep )
{
AbstractHttpRequest<?> httpRequest = ( ( HttpRequestTestStep )testStep ).getHttpRequest();
if( httpRequest.getOperation() != null && httpRequest.getOperation().getInterface() == iface )
{
httpRequest.setEndpoint( selectedEndpoint );
httpRequest.setUsername( defaults.getUsername() );
httpRequest.setPassword( defaults.getPassword() );
httpRequest.setDomain( defaults.getDomain() );
if( httpRequest instanceof WsdlRequest )
{
WsdlTestRequest testRequest = ( WsdlTestRequest )httpRequest;
testRequest.setWssPasswordType( defaults.getWssType() );
testRequest.setWssTimeToLive( defaults.getWssTimeToLive() );
testRequest.setOutgoingWss( defaults.getOutgoingWss() );
testRequest.setIncomingWss( defaults.getIncomingWss() );
}
}
}
}
}