buildframework/helium/sf/java/antdata/tests/src/com/nokia/helium/ant/data/tests/TestMeta.java
--- a/buildframework/helium/sf/java/antdata/tests/src/com/nokia/helium/ant/data/tests/TestMeta.java Wed Jun 16 16:51:40 2010 +0300
+++ b/buildframework/helium/sf/java/antdata/tests/src/com/nokia/helium/ant/data/tests/TestMeta.java Fri Aug 13 14:59:05 2010 +0300
@@ -17,6 +17,8 @@
package com.nokia.helium.ant.data.tests;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
@@ -28,7 +30,6 @@
import org.dom4j.DocumentHelper;
import org.dom4j.Node;
import org.junit.Test;
-import static org.junit.Assert.*;
import com.nokia.helium.ant.data.Database;
@@ -82,4 +83,32 @@
assertTrue(macro.valueOf("scope").equals("public"));
assertTrue(macro.valueOf("deprecated").equals(""));
}
+
+ @Test
+ public void testProjectMetaScope() throws IOException, DocumentException {
+ readPropertyTotal("public", 3);
+ readPropertyTotal("private", 7);
+ }
+
+ private void readPropertyTotal(String scope, int total) throws IOException, DocumentException {
+ Database db = new Database(null, scope);
+ List<String> paths = new ArrayList<String>();
+ File testAntFile = new File(System.getProperty("testdir"), "tests/data/test_project_scopes.ant.xml");
+ paths.add(testAntFile.getCanonicalPath());
+ db.setScopeFilter(scope);
+ db.addAntFilePaths(paths);
+ StringWriter out = new StringWriter();
+ db.toXML(out);
+
+ Document doc = DocumentHelper.parseText(out.toString());
+ System.out.println(doc.asXML());
+
+ Node database = doc.selectSingleNode("//antDatabase");
+
+ Node project = database.selectSingleNode("project");
+
+ List properties = project.selectNodes("property");
+ System.out.println(properties.size());
+ assertTrue(properties.size() == total);
+ }
}