TUSCANY-3174 - Fix test to use new workspace manager module

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@798818 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
slaws 2009-07-29 09:13:08 +00:00
parent 23534329cd
commit 7ac2e7223e
2 changed files with 6 additions and 19 deletions

View file

@ -31,7 +31,7 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-workspace-impl</artifactId>
<artifactId>tuscany-workspace-manager</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>

View file

@ -38,15 +38,13 @@ import org.apache.tuscany.sca.monitor.Problem;
import org.apache.tuscany.sca.monitor.Problem.Severity;
import org.apache.tuscany.sca.workspace.Workspace;
import org.apache.tuscany.sca.workspace.manager.WorkspaceManager;
import org.apache.tuscany.sca.workspace.manager.WorkspaceManagerFactory;
import org.osoa.sca.ServiceRuntimeException;
public class TestLauncher {
public final static void main(String[] args) {
WorkspaceManagerFactory workspaceManagerFactory = WorkspaceManagerFactory.newInstance();
WorkspaceManager workspaceManager = workspaceManagerFactory.createWorkspaceManager();
WorkspaceManager workspaceManager = WorkspaceManager.newInstance();
addExtensions(workspaceManager);
workspaceManager.start();
@ -56,7 +54,7 @@ public class TestLauncher {
private static void addExtensions(WorkspaceManager workspaceManager) {
try {
System.out.println("Adding extensions");
System.out.println("Add extensions");
ExtensionPointRegistry registry = workspaceManager.getRegistry();
// get monitor
@ -93,25 +91,14 @@ public class TestLauncher {
private static void processContributions(WorkspaceManager workspaceManager){
try {
System.out.println("Process contribution");
ExtensionPointRegistry registry = workspaceManager.getRegistry();
ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
Workspace workspace = workspaceManager.createWorkspace();
Contribution contribution = contributionFactory.createContribution();
contribution.setURI("contrib1");
contribution.setLocation("./target/classes/contrib1");
contribution.setUnresolved(true);
contribution = workspaceManager.addContributionToWorkspace(workspace, contribution);
Contribution contribution = workspaceManager.readContribution("contrib1", "./target/classes/contrib1");
workspaceManager.addContributionToWorkspace(workspace, contribution);
workspaceManager.resolveWorkspace(workspace);
// do whatever you need to do with workspace and its resolved contributions
workspaceManager.removeContributionFromWorkspace(workspace, contribution);
} catch (Exception ex) {
ex.printStackTrace();
}