Skip to main content
summaryrefslogtreecommitdiffstats
blob: 20fd0bea5b0db012b451731296492cf2297e8cf0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*******************************************************************************
 * Copyright (c) 2004, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 * yyyymmdd bug      Email and other contact information
 * -------- -------- -----------------------------------------------------------
 * 20060727   144354 kathy@ca.ibm.com - Kathy Chan
 *******************************************************************************/
/*
 * Created on May 4, 2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.eclipse.jst.ws.internal.consumption.ui.widgets.test;

import org.eclipse.jst.ws.internal.context.ScenarioContext;
import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension;
import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry;
import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
import org.eclipse.wst.command.internal.env.core.common.Condition;
import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment;


/**
 * @author gilberta
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class FinishTestFragment extends BooleanFragment{

  private boolean isTestWidget;	
  private boolean generateProxy;  // This actually represent whether client test is requested
  private String launchedServiceTestName;
  private boolean testService;
  private String testID;
  public FinishTestFragment()
  {
    Condition condition = new Condition()
	{
	  public boolean evaluate()
	  {
	    if(!testService) return false;
	  	if(launchedServiceTestName == null) return true;
	    if(launchedServiceTestName != null)
	      if((!launchedServiceTestName.equals("") &&  (!isPreferedAWSDLTest() || (isTestWidget && isClientTestJava())) && generateProxy) || launchedServiceTestName.equals("")) return true;	
	    
	  	return false; 
	  }
	};
	   
	setTrueFragment(new WebServiceTestClientDepartureFragment());
    setCondition(condition);
  }
	    
  public void setLaunchedServiceTestName(String launchedServiceTestName)
  {
	this.launchedServiceTestName = launchedServiceTestName;
  }
	  
  public boolean isPreferedAWSDLTest()
  {
    ScenarioContext scenarioContext = WebServicePlugin.getInstance().getScenarioContext().copy();
	String[] testTypes = scenarioContext.getWebServiceTestTypes();
	WebServiceTestRegistry wsttRegistry = WebServiceTestRegistry.getInstance();
	WebServiceTestExtension wscte = (WebServiceTestExtension)wsttRegistry.getWebServiceExtensionsByName(testTypes[0]);  	
	if(wscte.testWSDL())	
	  return true;
	return false;
  }

  public boolean isClientTestJava()
  {
  	if(testID == null) return false;
  	WebServiceTestRegistry wsttRegistry = WebServiceTestRegistry.getInstance();
	WebServiceTestExtension wscte = (WebServiceTestExtension)wsttRegistry.getWebServiceExtensionsByName(testID);  	
	if(!wscte.testWSDL())	
      return true;
    return false;   	
  }
  
  
  public void setTestService(boolean testService)
  {
    this.testService = testService;	 
  }

  public void setGenerateProxy(boolean generateProxy)
  {
    this.generateProxy = generateProxy;	 
  }

  public void setTestID(String testID)
  {
    this.testID = testID;
  }

  public void setIsTestWidget(boolean isTestWidget)
  {
  	this.isTestWidget = isTestWidget;
  }
}

Back to the top