package test;

import java.io.*;

import junit.framework.*;
import aQute.bnd.build.*;
import aQute.bnd.osgi.*;
import aQute.bnd.service.phases.*;

public class WorkspaceTest extends TestCase {

	public static void testWorkspace() throws Exception {
		Workspace ws = Workspace.getWorkspace(new File("testresources/w o r k s p a c e"));

		assertEquals("parent", ws.getProperty("override"));
		assertEquals("ExtPlugin,ParentPlugin", ws.getProperty("-plugin"));
		assertEquals("true", ws.getProperty("ext"));
		assertEquals("abcdef", ws.getProperty("test"));
	}

	public static void testNestedWorkspace() throws Exception {
		Workspace ws = Workspace.getWorkspace(new File("testresources/redirectws/wss/ws"));

		assertEquals("true", ws.getProperty("testcnf"));
		assertEquals("true", ws.getProperty("ext"));
	}
	
	public static void testPropertyDefaulting() throws Exception {
		Workspace ws = Workspace.getWorkspace(new File("testresources/ws-defaulting"));
		
		Project p = ws.getProject("p1");
		assertEquals("defaults", p.getProperty("myprop1"));
		assertEquals("workspace", p.getProperty("myprop2"));
		assertEquals("project", p.getProperty("myprop3"));
	}

	public void testPhases() throws Exception {
		Workspace ws = Workspace.getWorkspace(new File(".."));
		Project p = ws.getProject("biz.aQute.bnd");

		Processor processor = new Processor();
		processor.setTrace(true);
		Phases phases = ws.getPhases(processor,null);
		phases.build(p,false);
		assertTrue(processor.check());
	}

}

@@ -1158,334 +1158,6 @@
 %09%7D%0A%0A
-%09public void testPhases() throws Exception %7B%0A%09%09Workspace ws = Workspace.getWorkspace(new File(%22..%22));%0A%09%09Project p = ws.getProject(%22biz.aQute.bnd%22);%0A%0A%09%09Processor processor = new Processor();%0A%09%09processor.setTrace(true);%0A%09%09Phases phases = ws.getPhases(processor,null);%0A%09%09phases.build(p,false);%0A%09%09assertTrue(processor.check());%0A%09%7D%0A%0A
 %7D%0A

test removed