Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.wst.ws.service.policy.test')
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/.classpath7
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/.project28
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/META-INF/MANIFEST.MF18
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/about.html34
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/build.properties11
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/plugin.properties19
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/plugin.xml224
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/MainTester.java401
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/MainUITester.java333
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/ServicePolicytTestActivator.java77
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/TestEnabledClass.java29
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/TestLaunchClass.java28
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action1.java27
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action2.java27
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action3.java27
-rw-r--r--tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/internal/properties/FOOFilePropertyTester.java55
16 files changed, 0 insertions, 1345 deletions
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/.classpath b/tests/org.eclipse.wst.ws.service.policy.test/.classpath
deleted file mode 100644
index 472ee29b1..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/.project b/tests/org.eclipse.wst.ws.service.policy.test/.project
deleted file mode 100644
index bb3e1a438..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.ws.service.policy.test</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.ws.service.policy.test/META-INF/MANIFEST.MF
deleted file mode 100644
index 2156a3a71..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,18 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %PLUGIN_NAME
-Bundle-SymbolicName: org.eclipse.wst.ws.service.policy.test;singleton:=true
-Bundle-Version: 1.0.0
-Bundle-Activator: org.eclipse.wst.ws.service.policy.test.ServicePolicytTestActivator
-Bundle-Vendor: %PLUGIN_PROVIDER
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.runtime,
- org.junit4,
- org.eclipse.wst.ws.service.policy,
- org.eclipse.wst.ws.service.policy.ui,
- org.eclipse.core.resources,
- org.eclipse.wst.ws,
- org.eclipse.core.expressions,
- org.eclipse.ui
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/about.html b/tests/org.eclipse.wst.ws.service.policy.test/about.html
deleted file mode 100644
index 6eafb63b8..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 2, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor’s license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/build.properties b/tests/org.eclipse.wst.ws.service.policy.test/build.properties
deleted file mode 100644
index 68f43c7f9..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/build.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.properties,\
- plugin.xml,\
- about.html
-src.includes = META-INF/,\
- plugin.properties,\
- plugin.xml,\
- src/
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/plugin.properties b/tests/org.eclipse.wst.ws.service.policy.test/plugin.properties
deleted file mode 100644
index c6f290e8f..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/plugin.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2007 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
-# -------- -------- -----------------------------------------------------------
-# 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk
-###############################################################################
-
-#
-# Messages in plugin.xml.
-#
-PLUGIN_NAME=Service policy
-PLUGIN_PROVIDER=Eclipse.org
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/plugin.xml b/tests/org.eclipse.wst.ws.service.policy.test/plugin.xml
deleted file mode 100644
index 352183a75..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/plugin.xml
+++ /dev/null
@@ -1,224 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-
-<plugin>
-
- <!-- We need this plugin to be loaded at startup time so that the
- ServicePolicyPropertyTester class will always be loaded. If this is
- not done then the Service Policy project property page will appear
- on all project property pages until the plugin has been loaded.
- -->
- <extension point="org.eclipse.ui.startup"/>
-
- <extension point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- id="org.eclipse.wst.ws.service.policy.test.service.ws.service.policy.foo"
- type="org.eclipse.core.resources.IProject"
- namespace="org.eclipse.wst.ws.service.policy.test.service.ws.service.policy.foo"
- properties="projectHasFOOfiles"
- class="org.eclipse.wst.ws.service.policy.test.internal.properties.FOOFilePropertyTester">
- </propertyTester>
- </extension>
- <extension point="org.eclipse.wst.ws.service.policy.servicepolicy">
- <servicePolicy>
- <enablement>
- <test property="org.eclipse.wst.ws.service.policy.test.service.ws.service.policy.foo.projectHasFOOfiles"/>
- </enablement>
- <policy parentPolicyId="someparent" id="id1" enumListId="org.eclipse.wst.service.policy.errorWarnEnum" mutable="true">
- <descriptor shortName="id1 shortName" description="id1 description"/>
- <relationship enumList="org.eclipse.wst.warn org.eclipse.wst.error">
- <targetPolicy id="id2"
- itemList="org.eclipse.wst.warn org.eclipse.wst.error"/>
- <targetPolicy id="id3"
- itemList="org.eclipse.wst.warn"/>
- <targetPolicy id="id4"
- itemList="org.eclipse.wst.error"/>
- <targetPolicy id="id22"
- itemList="org.eclipse.wst.warn2 org.eclipse.wst.error2"/>
- <targetPolicy id="id_boolean2"
- itemList="org.eclipse.wst.false"/>
- </relationship>
-
- <relationship enumList="org.eclipse.wst.ignore">
- <targetPolicy id="id3"
- itemList="org.eclipse.wst.warn org.eclipse.wst.error"/>
- </relationship>
- </policy>
-
- <policy id="someparent">
- <descriptor longName="parent longname" />
- </policy>
-
- <policy id="id2" parentPolicyId="someparent"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum"
- defaultEnumId="org.eclipse.wst.warn"
- mutable="true">
- <descriptor shortName="id2 shortname" contextHelpId="somecontextid.A001"/>
- <state key="id2_key" value="id2_value" />
- </policy>
-
- <policy id="id3" parentPolicyId="id2"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum"
- defaultEnumId="org.eclipse.wst.error">
- <descriptor shortName="id3 short name"/>
- </policy>
- <policy id="id5" parentPolicyId="id3"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum"
- defaultEnumId="org.eclipse.wst.error">
- <descriptor shortName="id5 short name"/>
- <relationship enumList="org.eclipse.wst.warn">
- <targetPolicy id="id2"
- itemList="org.eclipse.wst.ignore"/>
- </relationship>
- </policy>
- <policy id="id6" parentPolicyId="id5"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum"
- defaultEnumId="org.eclipse.wst.error">
- <descriptor shortName="id6 short name"/>
- </policy>
-
- <policy id="id10" parentPolicyId="id22"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum"
- defaultEnumId="org.eclipse.wst.error">
- <descriptor shortName="id10 short name"/>
- </policy>
- <policy id="id11" parentPolicyId="id10"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum"
- defaultEnumId="org.eclipse.wst.error">
- <descriptor shortName="id11 short name"/>
- <relationship enumList="org.eclipse.wst.warn">
- <targetPolicy id="id2"
- itemList="org.eclipse.wst.ignore"/>
- </relationship>
- </policy>
- <policy id="id12" parentPolicyId="id11"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum"
- defaultEnumId="org.eclipse.wst.error">
- <descriptor shortName="id12 short name"/>
- </policy>
-
- <policy id="id7" parentPolicyId="id2"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum"
- defaultEnumId="org.eclipse.wst.error">
- <descriptor shortName="id7 short name"/>
- </policy>
- <policy id="id8" parentPolicyId="id7"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum"
- defaultEnumId="org.eclipse.wst.error">
- <descriptor shortName="id8 short name"/>
- </policy>
- <policy id="id9" parentPolicyId="id8"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum"
- defaultEnumId="org.eclipse.wst.error">
- <descriptor shortName="id9 short name"/>
- <relationship enumList="org.eclipse.wst.warn">
- <targetPolicy id="id2"
- itemList="org.eclipse.wst.ignore"/>
- </relationship>
- </policy>
-
- <policy id="id4" enumListId="org.eclipse.wst.service.policy.errorWarnEnum">
- <descriptor shortName="id4 short name" longName="id4 long name" />
- </policy>
-
- <policy id="id22" parentPolicyId="someparent"
- enumListId="org.eclipse.wst.service.policy.errorWarnEnum2"
- defaultEnumId="org.eclipse.wst.warn2">
- <descriptor shortName="id22 shortname" contextHelpId="somecontextid.A001"/>
- </policy>
-
- <policy id="id_boolean1" enumListId="org.eclipse.wst.service.policy.booleanEnum"
- defaultEnumId="org.eclipse.wst.true">
- <descriptor shortName="boolean1 short name" longName="boolean1 long name" />
- </policy>
-
- <policy id="id_boolean2" enumListId="org.eclipse.wst.service.policy.booleanEnum"
- defaultEnumId="org.eclipse.wst.true">
- <descriptor shortName="boolean2 short name" longName="boolean2 long name" />
- </policy>
- <enumeration id="org.eclipse.wst.service.policy.errorWarnEnum2"
- default="org.eclipse.wst.ignore2">
- <item id="org.eclipse.wst.ignore2"
- shortName="IGNORE SHORTNAME2" longName="IGNORE LONGNAME2" />
- <item id="org.eclipse.wst.warn2"
- shortName="WARN SHORTNAME2" longName="WARN LONGNAME2" />
- <item id="org.eclipse.wst.error2"
- shortName="ERROR SHORTNAME2" longName="ERROR LONGNAME2" />
- </enumeration>
-
- </servicePolicy>
- </extension>
-
- <extension point="org.eclipse.wst.ws.service.policy.ui.servicepolicyui">
- <servicePolicyUI>
- <operation id="service.ui.operation1" defaultdata="true"
- policyPattern="id3|id2" >
- <descriptor shortName="UI policy1 short name" longName="UI policy1 long name" />
- <enumeration id="org.eclipse.wst.service.policy.errorWarnEnum"/>
- <enabled multiselect="true"/>
- </operation>
-
- <operation id="service.ui.operation2" defaultdata="true"
- policyPattern="id\d.*" >
- <descriptor shortName="UI policy2 short name" longName="UI policy2 long name" />
- <enumeration id="org.eclipse.wst.service.policy.errorWarnEnum"/>
- <enabled multiselect="false"/>
- </operation>
-
- <operation id="service.ui.operation3" defaultdata="false"
- policyPattern="id4" >
- <descriptor shortName="UI policy3 short name" longName="UI policy3 long name" />
- <enumeration id="org.eclipse.wst.service.policy.errorWarnEnum"/>
- </operation>
-
- <operation id="service.ui.operation4" defaultdata="true"
- policyPattern="id1|id2|id3" >
- <descriptor shortName="UI policy4 short name" longName="UI policy4 long name" />
- <enumeration id="org.eclipse.wst.service.policy.errorWarnEnum"/>
- </operation>
-
- <operation id="service.ui.operation5" defaultdata="false"
- policyPattern="id22" workspaceOnly="true">
- <descriptor shortName="UI policy5 short name" longName="UI policy5 long name" />
- <enumeration id="org.eclipse.wst.service.policy.errorWarnEnum2"/>
- </operation>
- <operation id="service.ui.boolean.operation1" defaultdata="false"
- policyPattern="id_bool.*" workspaceOnly="true">
- <descriptor shortName="UI policy2b bool short name" longName="UI policy2b bool long name" />
- <selection/>
- </operation>
-
- <operation id="service.ui.boolean.operation2" defaultdata="true"
- policyPattern="id_boolean2" >
- <descriptor shortName="UI policy3 bool short name" longName="UI policy3 bool long name" />
- <selection icon="true"/>
- </operation>
-
- <operation id="service.ui.complex.operation1" defaultdata="false"
- policyPattern="someparent| id4" >
- <descriptor shortName="UI policy4 short name" longName="UI policy4 long name" />
- <complex launchClass="org.eclipse.wst.ws.service.policy.test.TestLaunchClass"/>
- <enabled multiselect="true"
- enabledClass="org.eclipse.wst.ws.service.policy.test.TestEnabledClass"/>
- </operation>
-
- <quickFix pluginId="org.eclipse.wst.ws.service.policy.test"
- code="1">
- <action class="org.eclipse.wst.ws.service.policy.test.action1">
- <descriptor shortName="quick fix 1 for code 1"/>
- </action>
- <action class="org.eclipse.wst.ws.service.policy.test.action2">
- <descriptor shortName="quick fix 2 for code 1"/>
- </action>
- </quickFix>
-
- <quickFix pluginId="org.eclipse.wst.ws.service.policy.test"
- code="2">
- <action class="org.eclipse.wst.ws.service.policy.test.action3">
- <descriptor shortName="quick fix 1 for code 2"/>
- </action>
- </quickFix>
- </servicePolicyUI>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/MainTester.java b/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/MainTester.java
deleted file mode 100644
index 4bb903b20..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/MainTester.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.test;
-
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.wst.ws.internal.preferences.PersistentWSIAPContext;
-import org.eclipse.wst.ws.internal.preferences.PersistentWSIContext;
-import org.eclipse.wst.ws.internal.preferences.PersistentWSISSBPContext;
-import org.eclipse.wst.ws.service.policy.IDescriptor;
-import org.eclipse.wst.ws.service.policy.IPolicyEnumerationList;
-import org.eclipse.wst.ws.service.policy.IPolicyRelationship;
-import org.eclipse.wst.ws.service.policy.IPolicyStateEnum;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.IStateEnumerationItem;
-import org.eclipse.wst.ws.service.policy.ServicePolicyActivator;
-import org.eclipse.wst.ws.service.policy.ServicePolicyPlatform;
-import org.eclipse.wst.ws.service.policy.listeners.IPolicyChildChangeListener;
-
-@SuppressWarnings("restriction") //$NON-NLS-1$
-public class MainTester extends TestCase
-{
-
- public void testExtensions()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- List<IServicePolicy> policyList = platform.getRootServicePolicies( null );
-
- for( IServicePolicy policy : policyList )
- {
- displayPolicyNode( policy );
- }
-
- System.out.println( "" ); //$NON-NLS-1$
- System.out.println("=========== Enumerations:" ); //$NON-NLS-1$
-
- List<IStateEnumerationItem> errorWarnEnum = platform.getStateEnumeration( "org.eclipse.wst.service.policy.errorWarnEnum" ); //$NON-NLS-1$
-
- System.out.println( "Enum id: " + "org.eclipse.wst.service.policy.errorWarnEnum" ); //$NON-NLS-1$ //$NON-NLS-2$
-
- for( IStateEnumerationItem item : errorWarnEnum )
- {
- System.out.println( " id: " + item.getId() ); //$NON-NLS-1$
- System.out.println( " shortname: " + item.getShortName() ); //$NON-NLS-1$
- System.out.println( " longname: " + item.getLongName() ); //$NON-NLS-1$
- System.out.println( " isDefault: " + item.isDefault() ); //$NON-NLS-1$
- System.out.println( "" ); //$NON-NLS-1$
- }
- }
-
- private void displayPolicyNode( IServicePolicy policy )
- {
- IServicePolicy parentPolicy = policy.getParentPolicy();
- IDescriptor descriptor = policy.getDescriptor();
-
- System.out.println( "Found policy: " + policy.getId() + " parentid:" + (parentPolicy == null ? "null" : parentPolicy.getId()) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- for( IServicePolicy child : policy.getChildren() )
- {
- System.out.println( " child id: " + child.getId() ); //$NON-NLS-1$
- }
-
- List<IPolicyRelationship> relationships = policy.getRelationships();
-
- System.out.println( " relationships:" ); //$NON-NLS-1$
-
- for( IPolicyRelationship relationship : relationships )
- {
- IPolicyEnumerationList sourceList = relationship.getPolicyEnumerationList();
- List<IPolicyEnumerationList> targetList = relationship.getRelatedPolicies();
- List<IStateEnumerationItem> sourceEnumList = sourceList.getEnumerationList();
-
- for( IStateEnumerationItem item : sourceEnumList )
- {
- System.out.println( " " + item.getId() ); //$NON-NLS-1$
- }
-
- for( IPolicyEnumerationList policyEnumList : targetList )
- {
- String policyId = policyEnumList.getPolicy().getId();
- List<IStateEnumerationItem> targetEnumList = policyEnumList.getEnumerationList();
-
- System.out.println( " policy id: " + policyId ); //$NON-NLS-1$
-
- for( IStateEnumerationItem targetItem : targetEnumList )
- {
- System.out.println( " target enum id: " + targetItem.getId() ); //$NON-NLS-1$
- }
- }
- }
-
- System.out.println( "Descriptor:" ); //$NON-NLS-1$
- System.out.println( " short name: " + descriptor.getShortName() ); //$NON-NLS-1$
- System.out.println( " long name: " + descriptor.getLongName() ); //$NON-NLS-1$
- System.out.println( " description: " + descriptor.getDescription() ); //$NON-NLS-1$
- System.out.println( " context help: " + descriptor.getContextHelpId() ); //$NON-NLS-1$
- System.out.println( " icon path: " + descriptor.getIconPath() ); //$NON-NLS-1$
- System.out.println( " icon path bundle id: " + descriptor.getIconBundleId() ); //$NON-NLS-1$
- System.out.println( "===" ); //$NON-NLS-1$
- System.out.println( "" ); //$NON-NLS-1$
-
- for( IServicePolicy child : policy.getChildren() )
- {
- displayPolicyNode( child );
- }
- }
-
- public void testEnumerations()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- IServicePolicy id1 = platform.getServicePolicy( "id1" ); //$NON-NLS-1$
- IServicePolicy id2 = platform.getServicePolicy( "id2" ); //$NON-NLS-1$
- IServicePolicy id3 = platform.getServicePolicy( "id3" ); //$NON-NLS-1$
- IPolicyStateEnum state1 = id1.getPolicyStateEnum();
- IPolicyStateEnum state2 = id2.getPolicyStateEnum();
- IPolicyStateEnum state3 = id3.getPolicyStateEnum();
- IStateEnumerationItem item1 = state1.getCurrentItem();
- IStateEnumerationItem item2 = state2.getCurrentItem();
- IStateEnumerationItem item3 = state3.getCurrentItem();
-
- assertTrue( "Unexpected shortname:" + item1.getShortName(), item1.getShortName().equals( "ignore") ); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue( "Unexpected shortname:" + item2.getShortName(), item2.getShortName().equals( "warn") ); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue( "Unexpected shortname:" + item3.getShortName(), item3.getShortName().equals( "error") ); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println( "id1 value:" + item1.getShortName() ); //$NON-NLS-1$
- System.out.println( "id2 value:" + item2.getShortName() ); //$NON-NLS-1$
- }
-
- public void testPolicyState()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- IServicePolicy id1 = platform.getServicePolicy( "id1" ); //$NON-NLS-1$
- IPolicyStateEnum enumState = id1.getPolicyStateEnum();
- IStateEnumerationItem enumItem = enumState.getCurrentItem();
- String ignoreId = "org.eclipse.wst.ignore"; //$NON-NLS-1$
- String warnId = "org.eclipse.wst.warn"; //$NON-NLS-1$
- String errorId = "org.eclipse.wst.error"; //$NON-NLS-1$
-
- assertTrue( "Default enum not:" + ignoreId, enumItem.getId().equals( ignoreId ) ); //$NON-NLS-1$
-
- enumState.setCurrentItem( warnId );
- enumItem = enumState.getCurrentItem();
-
- assertTrue( "Updated enum not:" + warnId, enumItem.getId().equals( warnId ) ); //$NON-NLS-1$
-
- platform.discardChanges();
- enumItem = enumState.getCurrentItem();
-
- assertTrue( "Discard enum not:" + ignoreId, enumItem.getId().equals( ignoreId ) ); //$NON-NLS-1$
-
- enumState.setCurrentItem( errorId );
- enumItem = enumState.getCurrentItem();
- assertTrue( "Error enum not:" + errorId, enumItem.getId().equals( errorId ) ); //$NON-NLS-1$
-
- platform.commitChanges();
- enumItem = enumState.getCurrentItem();
- assertTrue( "Error enum not:" + errorId, enumItem.getId().equals( errorId ) ); //$NON-NLS-1$
-
- IEclipsePreferences projectPreferences = new InstanceScope().getNode( ServicePolicyActivator.PLUGIN_ID );
-
- try
- {
- String[] keys = projectPreferences.keys();
-
- for( String key : keys )
- {
- System.out.println( "Key=" + key + " value=" + projectPreferences.get( key, "" )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- catch( Exception exc )
- {
- assertTrue( "Exception thrown" + exc.getMessage(), false ); //$NON-NLS-1$
- }
- }
-
- public void testUniqueIds()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- IServicePolicy policy = platform.createServicePolicy( null, "someid", null, null ); //$NON-NLS-1$
-
- assertTrue( policy.getId().equals( "someid" ) ); //$NON-NLS-1$
-
- policy = platform.createServicePolicy( null, "someid", null, null ); //$NON-NLS-1$
- assertTrue( policy.getId().equals( "someid1" ) ); //$NON-NLS-1$
-
- policy = platform.createServicePolicy( null, "someid", null, null ); //$NON-NLS-1$
- assertTrue( policy.getId().equals( "someid2" ) ); //$NON-NLS-1$
-
- policy = platform.createServicePolicy( null, "someid1", null, null ); //$NON-NLS-1$
- assertTrue( policy.getId().equals( "someid3" ) ); //$NON-NLS-1$
-
- policy = platform.createServicePolicy( null, "some55id5", null, null ); //$NON-NLS-1$
- assertTrue( policy.getId().equals( "some55id5" ) ); //$NON-NLS-1$
-
- policy = platform.createServicePolicy( null, "some55id5", null, null ); //$NON-NLS-1$
- assertTrue( policy.getId().equals( "some55id1" ) ); //$NON-NLS-1$
- }
-
-
- @SuppressWarnings("restriction") //$NON-NLS-1$
- public void testOldWSIContext()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- IServicePolicy apPolicy = platform.getServicePolicy( "org.eclipse.wst.ws.service.policy.ui.servicepols.wsiprofilecomp.wsiap" ); //$NON-NLS-1$
- IPolicyStateEnum apState = apPolicy.getPolicyStateEnum();
- IServicePolicy ssbpPolicy = platform.getServicePolicy( "org.eclipse.wst.ws.service.policy.ui.servicepols.wsiprofilecomp.wsissbp" ); //$NON-NLS-1$
- PersistentWSIAPContext apContext = new PersistentWSIAPContext();
- PersistentWSISSBPContext ssbpContext = new PersistentWSISSBPContext();
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IProject project = root.getProject("TestProject"); //$NON-NLS-1$
- String item = null;
-
- try
- {
- project.create(new NullProgressMonitor());
- }
- catch( CoreException exc )
- {
- assertTrue( "Core exception:" + exc.getMessage(), false ); //$NON-NLS-1$
- }
-
- IPolicyStateEnum apProjState = apPolicy.getPolicyStateEnum( project );
- IPolicyStateEnum ssbpProjState = ssbpPolicy.getPolicyStateEnum( project );
-
- // Ensure that project preferences are gotten from the workspace
- apState.setCurrentItem( "org.eclipse.wst.sug.ignore" ); //$NON-NLS-1$
- platform.commitChanges();
- apProjState.setCurrentItem( "org.eclipse.wst.sug.suggest" ); //$NON-NLS-1$
- item = apProjState.getCurrentItem().getId();
- assertTrue( "Ap value not ignore, but got " + item, item.equals("org.eclipse.wst.sug.ignore")); //$NON-NLS-1$ //$NON-NLS-2$
-
- apState.setCurrentItem( "org.eclipse.wst.sug.require" ); //$NON-NLS-1$
- platform.commitChanges();
- apProjState.setCurrentItem( "org.eclipse.wst.sug.ignore" ); //$NON-NLS-1$
- item = apProjState.getCurrentItem().getId();
- assertTrue( "Ap value not require, but got " + item, item.equals("org.eclipse.wst.sug.require")); //$NON-NLS-1$ //$NON-NLS-2$
-
- platform.setProjectPreferencesEnabled( project , true );
- item = apProjState.getCurrentItem().getId();
- assertTrue( "Ap value not ingore, but got " + item, item.equals("org.eclipse.wst.sug.ignore")); //$NON-NLS-1$ //$NON-NLS-2$
-
- platform.commitChanges( project );
- item = apProjState.getCurrentItem().getId();
- assertTrue( "Ap value not ingore, but got " + item, item.equals("org.eclipse.wst.sug.ignore")); //$NON-NLS-1$ //$NON-NLS-2$
-
- String apContextValue = apContext.getProjectWSICompliance( project );
- assertTrue( "Ap context not ignore, but " + apContextValue, apContextValue.equals( PersistentWSIContext.IGNORE_NON_WSI ) ); //$NON-NLS-1$
-
- apState.setCurrentItem( "org.eclipse.wst.sug.suggest" ); //$NON-NLS-1$
- platform.commitChanges();
- apContextValue = apContext.getProjectWSICompliance( project );
- assertTrue( "Ap context not ignore, but " + apContextValue, apContextValue.equals( PersistentWSIContext.IGNORE_NON_WSI ) ); //$NON-NLS-1$
-
- platform.setProjectPreferencesEnabled( project, false );
- apContextValue = apContext.getProjectWSICompliance( project );
- assertTrue( "Ap context not ignore, but " + apContextValue, apContextValue.equals( PersistentWSIContext.WARN_NON_WSI ) ); //$NON-NLS-1$
-
- apProjState.setCurrentItem( "org.eclipse.wst.sug.require" ); //$NON-NLS-1$
- platform.commitChanges( project );
- apContextValue = apContext.getProjectWSICompliance( project );
- assertTrue( "Ap context not suggest, but " + apContextValue, apContextValue.equals( PersistentWSIContext.WARN_NON_WSI ) ); //$NON-NLS-1$
-
- platform.setProjectPreferencesEnabled( project, true );
- apContextValue = apContext.getProjectWSICompliance( project );
- assertTrue( "Ap context not require, but " + apContextValue, apContextValue.equals( PersistentWSIContext.STOP_NON_WSI ) ); //$NON-NLS-1$
-
- ssbpProjState.setCurrentItem( "org.eclipse.wst.sug.suggest" ); //$NON-NLS-1$
-
- String ssbpContextValue = ssbpContext.getProjectWSICompliance( project );
-
- assertTrue( "Ap context not require, but " + apContextValue, apContextValue.equals( PersistentWSIContext.STOP_NON_WSI ) ); //$NON-NLS-1$
- assertTrue( "SSBP context not suggest, but " + ssbpContextValue, ssbpContextValue.equals( PersistentWSIContext.WARN_NON_WSI ) ); //$NON-NLS-1$
-
- ssbpProjState.setCurrentItem( "org.eclipse.wst.sug.require" ); //$NON-NLS-1$
-
- ssbpContextValue = ssbpContext.getProjectWSICompliance( project );
- assertTrue( "Ap context not require, but " + apContextValue, apContextValue.equals( PersistentWSIContext.STOP_NON_WSI ) ); //$NON-NLS-1$
- assertTrue( "SSBP context not require, but " + ssbpContextValue, ssbpContextValue.equals( PersistentWSIContext.STOP_NON_WSI ) ); //$NON-NLS-1$
-
- }
-
- public void testMutable()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- IServicePolicy apPolicy = platform.getServicePolicy( "org.eclipse.wst.ws.service.policy.ui.servicepols.wsiprofilecomp.wsiap" ); //$NON-NLS-1$
- IServicePolicy ssbpPolicy = platform.getServicePolicy( "org.eclipse.wst.ws.service.policy.ui.servicepols.wsiprofilecomp.wsissbp" ); //$NON-NLS-1$
- IServicePolicy wsiPolicy = platform.getServicePolicy( "org.eclipse.wst.ws.service.policy.ui.servicepols.wsiprofilecomp" ); //$NON-NLS-1$
-
- assertTrue( "Root wsi policy is mutable", !wsiPolicy.getPolicyState().isMutable() ); //$NON-NLS-1$
- assertTrue( "Ap policy is not mutable", apPolicy.getPolicyState().isMutable() ); //$NON-NLS-1$
- assertTrue( "SSBP policy is not mutable", ssbpPolicy.getPolicyState().isMutable() ); //$NON-NLS-1$
- }
-
- public void testChildChangeListeners()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- ChildChangeListener listener = new ChildChangeListener();
-
- platform.addChildChangeListener(listener, false );
- listener.childEventOccured = false;
- listener.isAdded = false;
-
- IServicePolicy parent = platform.createServicePolicy( null, "parent_id1", null, null );
-
- assertTrue( "Listener not called", listener.childEventOccured );
- assertTrue( "Listener not added", listener.isAdded );
-
- listener.childEventOccured = false;
- listener.isAdded = false;
- IServicePolicy child1 = platform.createServicePolicy( parent, "parent_id1", null, null );
-
- assertTrue( "Listener not called", listener.childEventOccured );
- assertTrue( "Listener not added", listener.isAdded );
-
- listener.childEventOccured = false;
- listener.isAdded = false;
- listener.count = 0;
- IServicePolicy child2 = platform.createServicePolicy( child1, "parent_id1", null, null );
- IServicePolicy child3 = platform.createServicePolicy( child2, "parent_id1", null, null );
-
- assertTrue( "Listener not called", listener.childEventOccured );
- assertTrue( "Listener not added", listener.isAdded );
- assertTrue( "Listener count not 2", listener.count == 2 );
-
- listener.childEventOccured = false;
- listener.isAdded = true;
- listener.count = 0;
-
- child2.removeChild( child3 );
-
- assertTrue( "Listener not called", listener.childEventOccured );
- assertTrue( "Listener not removed", !listener.isAdded );
- assertTrue( "Listener count not 1", listener.count == 1 );
-
- listener.childEventOccured = false;
- listener.isAdded = true;
- listener.count = 0;
-
- // Should remove parent, child1, and child2
- platform.removeServicePolicy( parent );
-
- assertTrue( "Listener not called", listener.childEventOccured );
- assertTrue( "Listener not removed", !listener.isAdded );
- assertTrue( "Listener count not 3", listener.count == 3 );
-
- platform.removeChildChangeListener( listener, false );
-
- listener.childEventOccured = false;
- listener.isAdded = true;
- listener.count = 0;
-
- parent = platform.createServicePolicy( null, "parent_id1", null, null );
- child1 = platform.createServicePolicy( parent, "parent_id1", null, null );
-
- assertTrue( "Listener called", !listener.childEventOccured );
- assertTrue( "Listener isadded changed", listener.isAdded );
- assertTrue( "Listener count not 0", listener.count == 0 );
- }
-
- public void testState()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- IServicePolicy id2 = platform.getServicePolicy( "id2" );
- String value = id2.getPolicyState().getValue( "id2_key" );
-
- assertTrue( "Expected state value to be id2_value.", value.equals( "id2_value" ) );
- }
-
- private class ChildChangeListener implements IPolicyChildChangeListener
- {
- public boolean childEventOccured = false;
- public boolean isAdded = false;
- public int count = 0;;
-
- public void childChange(List<IServicePolicy> childList, List<Boolean> addedList)
- {
- childEventOccured = true;
- isAdded = addedList.get(0);
- count++;
- }
- }
-}
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/MainUITester.java b/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/MainUITester.java
deleted file mode 100644
index 7bae55943..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/MainUITester.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.test;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Vector;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.ws.service.policy.IDescriptor;
-import org.eclipse.wst.ws.service.policy.IFilter;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.ServicePolicyPlatform;
-import org.eclipse.wst.ws.service.policy.ui.IPolicyOperation;
-import org.eclipse.wst.ws.service.policy.ui.IQuickFixAction;
-import org.eclipse.wst.ws.service.policy.ui.IQuickFixActionInfo;
-import org.eclipse.wst.ws.service.policy.ui.ServicePolicyPlatformUI;
-import org.eclipse.wst.ws.service.policy.ui.utils.ActivityUtils;
-
-public class MainUITester extends TestCase
-{
-
- public void testExtensions()
- {
- ServicePolicyPlatformUI platformUI = ServicePolicyPlatformUI.getInstance();
- List<IPolicyOperation> operations = platformUI.getAllOperations();
-
- for( IPolicyOperation operation : operations )
- {
- displayOperation( operation );
- }
- }
-
- public void testOperationCache()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- ServicePolicyPlatformUI platformUI = ServicePolicyPlatformUI.getInstance();
- IServicePolicy id1 = platform.getServicePolicy( "id1" ); //$NON-NLS-1$
- IServicePolicy id2 = platform.getServicePolicy( "id2" ); //$NON-NLS-1$
- IServicePolicy id3 = platform.getServicePolicy( "id3" ); //$NON-NLS-1$
- IServicePolicy id4 = platform.getServicePolicy( "id4" ); //$NON-NLS-1$
- IPolicyOperation op1_id2 = platformUI.getOperation( id2, "service.ui.operation1" ); //$NON-NLS-1$
- IPolicyOperation op1_id3 = platformUI.getOperation( id3, "service.ui.operation1" ); //$NON-NLS-1$
- IPolicyOperation op2_id1 = platformUI.getOperation( id1, "service.ui.operation2" ); //$NON-NLS-1$
- IPolicyOperation op2_id2 = platformUI.getOperation( id2, "service.ui.operation2" ); //$NON-NLS-1$
- IPolicyOperation op2_id3 = platformUI.getOperation( id3, "service.ui.operation2" ); //$NON-NLS-1$
- IPolicyOperation op2_id4 = platformUI.getOperation( id4, "service.ui.operation2" ); //$NON-NLS-1$
- IPolicyOperation op3_id4 = platformUI.getOperation( id4, "service.ui.operation3" ); //$NON-NLS-1$
- IPolicyOperation op4_id1 = platformUI.getOperation( id1, "service.ui.operation4" ); //$NON-NLS-1$
- IPolicyOperation op4_id2 = platformUI.getOperation( id2, "service.ui.operation4" ); //$NON-NLS-1$
- IPolicyOperation op4_id3 = platformUI.getOperation( id3, "service.ui.operation4" ); //$NON-NLS-1$
-
- List<IPolicyOperation> list1 = platformUI.getOperations( id1, true );
- List<IPolicyOperation> list2 = platformUI.getOperations( id2, true );
- List<IPolicyOperation> list3 = platformUI.getOperations( id3, true );
- List<IPolicyOperation> list4 = platformUI.getOperations( id4, true );
-
- System.out.println( "\nDisplay lists" ); //$NON-NLS-1$
- displayList( "List1", list1 ); //$NON-NLS-1$
- displayList( "List2", list2 ); //$NON-NLS-1$
- displayList( "List3", list3 ); //$NON-NLS-1$
- displayList( "List4", list4 ); //$NON-NLS-1$
-
- checkContents( "List1", list1, new IPolicyOperation[]{ op2_id1, op4_id1 } ); //$NON-NLS-1$
- checkContents( "List2", list2, new IPolicyOperation[]{ op1_id2, op2_id2, op4_id2 } ); //$NON-NLS-1$
- checkContents( "List3", list3, new IPolicyOperation[]{ op1_id3, op2_id3, op4_id3 } ); //$NON-NLS-1$
- checkContents( "List4", list4, new IPolicyOperation[]{ op2_id4, op3_id4 } ); //$NON-NLS-1$
- }
-
- public void testEnabledOperations()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- ServicePolicyPlatformUI platformUI = ServicePolicyPlatformUI.getInstance();
- IServicePolicy id1 = platform.getServicePolicy( "id1" ); //$NON-NLS-1$
- IServicePolicy id2 = platform.getServicePolicy( "id2" ); //$NON-NLS-1$
- IServicePolicy id3 = platform.getServicePolicy( "id3" ); //$NON-NLS-1$
- IServicePolicy id4 = platform.getServicePolicy( "id4" ); //$NON-NLS-1$
- List<IServicePolicy> policyList1 = new Vector<IServicePolicy>();
- List<IServicePolicy> policyList2 = new Vector<IServicePolicy>();
- IPolicyOperation op1 = platformUI.getOperation( id4, "service.ui.operation3" ); //$NON-NLS-1$
-
- policyList1.add( id1 );
- policyList1.add( id2 );
- policyList1.add( id3 );
- policyList1.add( id4 );
- policyList2.add( id4 );
-
- assertTrue( "Expected operation to not be enabled", !op1.isEnabled( policyList1 ) ); //$NON-NLS-1$
- assertTrue( "Expected operation to be enabled", op1.isEnabled( policyList2 ) ); //$NON-NLS-1$
- }
-
- public void testQuickFixActions()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- ServicePolicyPlatformUI platformUI = ServicePolicyPlatformUI.getInstance();
- IServicePolicy id1 = platform.getServicePolicy( "id1" ); //$NON-NLS-1$
- IStatus status1 = new Status( IStatus.ERROR, "org.eclipse.wst.ws.service.policy.test", 1, "some error", null ); //$NON-NLS-1$ //$NON-NLS-2$
- IStatus status2 = new Status( IStatus.ERROR, "org.eclipse.wst.ws.service.policy.test", 2, "some error", null ); //$NON-NLS-1$ //$NON-NLS-2$
- List<IQuickFixActionInfo> fixList1 = platformUI.getQuickFixes( status1 );
- List<IQuickFixActionInfo> fixList2 = platformUI.getQuickFixes( status2 );
-
- assertTrue( "Expecting two quick fixes", fixList1.size() == 2 ); //$NON-NLS-1$
- assertTrue( "Expection one quick fix", fixList2.size() == 1 ); //$NON-NLS-1$
-
- for( IQuickFixActionInfo actionInfo : fixList1 )
- {
- IQuickFixAction action = actionInfo.getAction();
- id1.setStatus( status1 );
-
- assertTrue( "Status is not OK", !id1.getStatus().isOK() ); //$NON-NLS-1$
- action.action( id1 );
- assertTrue( "Status is Ok ", id1.getStatus().isOK() ); //$NON-NLS-1$
- }
-
- for( IQuickFixActionInfo actionInfo : fixList2 )
- {
- IQuickFixAction action = actionInfo.getAction();
- id1.setStatus( status2 );
-
- assertTrue( "Status is not OK", !id1.getStatus().isOK() ); //$NON-NLS-1$
- action.action( id1 );
- assertTrue( "Status is Ok ", id1.getStatus().isOK() ); //$NON-NLS-1$
- }
- }
-
- public void testActivitiesFilter()
- {
- IFilter activitiesFilter = ActivityUtils.getCurrentActivitiesFilter();
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- List<IServicePolicy> policyList = platform.getRootServicePolicies( activitiesFilter );
-
- displayPolicies( policyList );
- }
-
- @SuppressWarnings("unchecked")
- public void testGetOperationsList()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- ServicePolicyPlatformUI platformUI = ServicePolicyPlatformUI.getInstance();
- IServicePolicy id1 = platform.getServicePolicy( "id1" ); //$NON-NLS-1$
- IServicePolicy id2 = platform.getServicePolicy( "id2" ); //$NON-NLS-1$
- IServicePolicy id3 = platform.getServicePolicy( "id3" ); //$NON-NLS-1$
- IServicePolicy id4 = platform.getServicePolicy( "id4" ); //$NON-NLS-1$
- IPolicyOperation op1_id2 = platformUI.getOperation( id2, "service.ui.operation1" ); //$NON-NLS-1$
- IPolicyOperation op1_id3 = platformUI.getOperation( id3, "service.ui.operation1" ); //$NON-NLS-1$
- IPolicyOperation op2_id1 = platformUI.getOperation( id1, "service.ui.operation2" ); //$NON-NLS-1$
- IPolicyOperation op2_id2 = platformUI.getOperation( id2, "service.ui.operation2" ); //$NON-NLS-1$
- IPolicyOperation op2_id3 = platformUI.getOperation( id3, "service.ui.operation2" ); //$NON-NLS-1$
- IPolicyOperation op2_id4 = platformUI.getOperation( id4, "service.ui.operation2" ); //$NON-NLS-1$
- IPolicyOperation op3_id4 = platformUI.getOperation( id4, "service.ui.operation3" ); //$NON-NLS-1$
- IPolicyOperation op4_id1 = platformUI.getOperation( id1, "service.ui.operation4" ); //$NON-NLS-1$
- IPolicyOperation op4_id2 = platformUI.getOperation( id2, "service.ui.operation4" ); //$NON-NLS-1$
- IPolicyOperation op4_id3 = platformUI.getOperation( id3, "service.ui.operation4" ); //$NON-NLS-1$
- List<IServicePolicy> idList1 = null;
- List<IServicePolicy> idList2 = null;
- List<IServicePolicy> idList3 = null;
- List<IServicePolicy> idList4 = null;
-
- List<List<IPolicyOperation>> checkList1 = null;
- List<List<IPolicyOperation>> checkList2 = null;
- List<List<IPolicyOperation>> checkList3 = null;
- List<List<IPolicyOperation>> checkList4 = null;
-
- checkList1 = ll( l(op2_id1), l(op4_id1) );
- checkList2 = ll( l(op1_id2), l(op2_id1, op2_id2), l(op4_id1, op4_id2) );
- checkList3 = ll( l(op1_id2, op1_id3), l(op2_id1, op2_id2, op2_id3), l(op4_id1, op4_id2, op4_id3) );
- checkList4 = ll( l(op1_id2, op1_id3), l(op2_id1, op2_id2, op2_id3, op2_id4), l(op3_id4), l(op4_id1, op4_id2, op4_id3) );
-
- idList1 = Arrays.asList( new IServicePolicy[]{ id1 } );
- idList2 = Arrays.asList( new IServicePolicy[]{ id1, id2 } );
- idList3 = Arrays.asList( new IServicePolicy[]{ id1, id2, id3 } );
- idList4 = Arrays.asList( new IServicePolicy[]{ id1, id2, id3, id4 } );
-
- List<List<IPolicyOperation>> opList1 = platformUI.getOperationsList( idList1, true );
- List<List<IPolicyOperation>> opList2 = platformUI.getOperationsList( idList2, true );
- List<List<IPolicyOperation>> opList3 = platformUI.getOperationsList( idList3, true );
- List<List<IPolicyOperation>> opList4 = platformUI.getOperationsList( idList4, true );
-
- verifyLists( "List1", opList1, checkList1 );
- verifyLists( "List2", opList2, checkList2 );
- verifyLists( "List3", opList3, checkList3 );
- verifyLists( "List4", opList4, checkList4 );
- }
-
- private List<List<IPolicyOperation>> ll( List<IPolicyOperation>... opList )
- {
- return Arrays.asList( opList );
- }
-
- private List<IPolicyOperation> l( IPolicyOperation... opList )
- {
- return Arrays.asList( opList );
- }
-
- private void verifyLists( String listName, List<List<IPolicyOperation>> list1, List<List<IPolicyOperation>> list2 )
- {
- assertTrue( listName + " does not have the same size.", list1.size() == list2.size() );
-
- for( int listIndex = 0 ; listIndex < list1.size(); listIndex++ )
- {
- List<IPolicyOperation> policyList1 = list1.get( listIndex );
- List<IPolicyOperation> policyList2 = findList( policyList1.get(0).getId(), list2 );
-
- assertTrue( listName + " nested list at index " + listIndex + " is not the same size.", policyList1.size() == policyList2.size() );
-
- for( int index = 0; index < policyList1.size(); index++ )
- {
- IPolicyOperation op1 = policyList1.get( index );
-
- assertTrue( listName + " operation not found", findOp( op1, policyList2 ) );
- }
- }
- }
-
- private boolean findOp( IPolicyOperation op, List<IPolicyOperation> list )
- {
- boolean result = false;
-
- for( IPolicyOperation foundOp : list )
- {
- if( op == foundOp )
- {
- result = true;
- break;
- }
- }
-
- return result;
- }
-
- private List<IPolicyOperation> findList( String id, List<List<IPolicyOperation>> searchList )
- {
- for( List<IPolicyOperation> policyList : searchList )
- {
- if( policyList.get(0).getId().equals( id ) )
- {
- return policyList;
- }
- }
-
- assertTrue( "List not found for id" + id, false );
- return null;
- }
-
- private void displayPolicies( List<IServicePolicy> policyList )
- {
- System.out.println( "Listing service policies:" );
- for( IServicePolicy policy : policyList )
- {
- System.out.println( " " + policy.getId() );
- }
- }
-
- private void displayList( String setName, List<IPolicyOperation> operationList )
- {
- System.out.print( setName + ": " ); //$NON-NLS-1$
-
- for( IPolicyOperation operation : operationList )
- {
- System.out.print( operation.getId() + "," ); //$NON-NLS-1$
- }
-
- System.out.println( "" ); //$NON-NLS-1$
- }
-
- private void checkContents( String setName, List<IPolicyOperation> operationSet, IPolicyOperation[] operationArray )
- {
- assertTrue( "Set and array sizes don't match for " + setName + ".", operationSet.size() == operationArray.length ); //$NON-NLS-1$ //$NON-NLS-2$
-
- for( IPolicyOperation operation : operationArray )
- {
- assertTrue( setName + " does not contain operation " + operation.getId() + ".", operationSet.contains( operation ) ); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private void displayOperation( IPolicyOperation operation )
- {
- List<IServicePolicy> zeroPolicies = new Vector<IServicePolicy>();
- List<IServicePolicy> manyPolicies = ServicePolicyPlatform.getInstance().getRootServicePolicies( null );
- IDescriptor descriptor = operation.getDescriptor();
- String shortName = descriptor.getShortName();
- String longName = descriptor.getLongName();
-
- System.out.println( "Operation id: " + operation.getId() ); //$NON-NLS-1$
- System.out.println( " short name: " + shortName ); //$NON-NLS-1$
- System.out.println( " long name: " + longName ); //$NON-NLS-1$
- System.out.println( " pattern: " + operation.getPolicyIdPattern() ); //$NON-NLS-1$
- System.out.println( " isEnabled zero: " + operation.isEnabled( zeroPolicies ) ); //$NON-NLS-1$
- System.out.println( " isEnabled many: " + operation.isEnabled( manyPolicies ) ); //$NON-NLS-1$
-
- switch( operation.getOperationKind() )
- {
- case selection:
- {
- System.out.println( " selection: true" ); //$NON-NLS-1$
- break;
- }
-
- case iconSelection:
- {
- System.out.println( " selection icon: true" ); //$NON-NLS-1$
- break;
- }
-
- case enumeration:
- {
- System.out.println( " enumeration id: " + operation.getEnumerationId() ); //$NON-NLS-1$
- break;
- }
-
- case complex:
- {
- System.out.println( " complex: true" ); //$NON-NLS-1$
- operation.launchOperation( zeroPolicies );
- break;
- }
- }
- }
-}
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/ServicePolicytTestActivator.java b/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/ServicePolicytTestActivator.java
deleted file mode 100644
index c6afcd081..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/ServicePolicytTestActivator.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.test;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.IStartup;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class ServicePolicytTestActivator extends Plugin implements IStartup {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.wst.service.policy.test"; //$NON-NLS-1$
-
- // The shared instance
- private static ServicePolicytTestActivator plugin;
-
- /**
- * The constructor
- */
- public ServicePolicytTestActivator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static ServicePolicytTestActivator getDefault() {
- return plugin;
- }
-
- public static void logError( String message, Throwable exc )
- {
- IStatus status = new Status( IStatus.ERROR, PLUGIN_ID, 0, message, exc );
-
- getDefault().getLog().log(status);
- }
-
- public void earlyStartup()
- {
- // DO nothing. All we want to do is get the plugin loaded at UI start time.
- }
-}
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/TestEnabledClass.java b/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/TestEnabledClass.java
deleted file mode 100644
index 4bb8d3329..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/TestEnabledClass.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.test;
-
-import java.util.List;
-
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.ui.IEnableOperation;
-
-public class TestEnabledClass implements IEnableOperation
-{
-
- public boolean isEnabled(List<IServicePolicy> selectedPolicies)
- {
- System.out.println( " Is enabled operation called." ); //$NON-NLS-1$
- return true;
- }
-}
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/TestLaunchClass.java b/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/TestLaunchClass.java
deleted file mode 100644
index 77945b013..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/TestLaunchClass.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.test;
-
-import java.util.List;
-
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.ui.ILaunchOperation;
-
-public class TestLaunchClass implements ILaunchOperation
-{
-
- public void launch(List<IServicePolicy> selectedPolicies)
- {
- System.out.println( " Launch class called." ); //$NON-NLS-1$
- }
-}
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action1.java b/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action1.java
deleted file mode 100644
index d4c34ad74..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action1.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * -------- -------- -----------------------------------------------------------
- * 20071120 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.test;
-
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.ui.IQuickFixAction;
-
-public class action1 implements IQuickFixAction
-{
-
- public void action(IServicePolicy policy)
- {
- policy.setStatus( Status.OK_STATUS );
- }
-}
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action2.java b/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action2.java
deleted file mode 100644
index f93e85888..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action2.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * -------- -------- -----------------------------------------------------------
- * 20071120 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.test;
-
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.ui.IQuickFixAction;
-
-public class action2 implements IQuickFixAction
-{
-
- public void action(IServicePolicy policy)
- {
- policy.setStatus( Status.OK_STATUS );
- }
-}
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action3.java b/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action3.java
deleted file mode 100644
index 84d977d9b..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/action3.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * -------- -------- -----------------------------------------------------------
- * 20071120 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.test;
-
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.ui.IQuickFixAction;
-
-public class action3 implements IQuickFixAction
-{
-
- public void action(IServicePolicy policy)
- {
- policy.setStatus( Status.OK_STATUS );
- }
-}
diff --git a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/internal/properties/FOOFilePropertyTester.java b/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/internal/properties/FOOFilePropertyTester.java
deleted file mode 100644
index b983ea726..000000000
--- a/tests/org.eclipse.wst.ws.service.policy.test/src/org/eclipse/wst/ws/service/policy/test/internal/properties/FOOFilePropertyTester.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.wst.ws.service.policy.test.internal.properties;
-
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-public class FOOFilePropertyTester extends PropertyTester
-{
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue)
- {
- boolean result = false;
-
- if( receiver instanceof IContainer)
- {
- result = hasFOOfile( (IContainer) receiver );
- }
-
- return result;
- }
-
- private boolean hasFOOfile( IContainer container )
- {
- boolean result = false;
-
- try
- {
- IResource[] children = container.members();
-
- for( IResource child : children )
- {
- if( child instanceof IContainer )
- {
- result = hasFOOfile( (IContainer) child );
-
- }
- else if( child instanceof IFile )
- {
- result = child.getFileExtension().equalsIgnoreCase( "foo" );
- }
-
- // If we found a single foo file we will break out of the loop.
- if( result ) break;
- }
- }
- catch( CoreException exc )
- {
- // Ignore exception and return false.
- }
-
- return result;
- }
-}

Back to the top