Mercurial > hg > Members > tatsuki > JungleXMLReader
changeset 22:b6b5e3f48988
deepParentOrganizationIdsPlusTest and Method
author | one |
---|---|
date | Mon, 27 Oct 2014 09:41:14 +0900 |
parents | daf0c3c810f9 |
children | a9dc4ffd1f52 |
files | src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/JuGrix.java src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/deepParentOrganizationIdsPlusTest.java src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/deepParentOrganizationIdsTest.java |
diffstat | 3 files changed, 39 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/JuGrix.java Mon Oct 27 09:16:22 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/JuGrix.java Mon Oct 27 09:41:14 2014 +0900 @@ -695,6 +695,7 @@ public Iterator<String> deepParentOrganizationIds(String orgId, LinkedList<String> filterIds) { return _deepParentOrganizationIds(orgId, filterIds).iterator(); } + public LinkedList<String> _deepParentOrganizationIds(String orgId, LinkedList<String> filterIds) { @@ -713,6 +714,14 @@ return parentIdList; } + public Iterator<String> deepParentOrganizationIdsPlus(String id,LinkedList<String> filterIds) { + LinkedList<String> parentIds = new LinkedList<String>(); + if (filter(id, filterIds)) + parentIds.add(id); + parentIds.addAll(_deepParentOrganizationIds(id,filterIds)); + return parentIds.iterator(); + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/deepParentOrganizationIdsPlusTest.java Mon Oct 27 09:41:14 2014 +0900 @@ -0,0 +1,28 @@ +package jp.ac.u_ryukyu.cr.ie.tatsuki.functionTest; + +import java.util.Iterator; +import java.util.LinkedList; + +import jp.ac.u_ryukyu.cr.ie.tatsuki.bbs.JuGrix; +import junit.framework.Assert; + +import org.junit.Test; + +public class deepParentOrganizationIdsPlusTest { + @Test + public void deepParentOrganizationIdsPlus(){ + JuGrix jugrix = new JuGrix(); + LinkedList<String> filterIds = new LinkedList<String>(); + //filterIds.add("r:2"); + Iterator<String> childrenIds = jugrix.deepParentOrganizationIdsPlus("o:2", filterIds); + + Assert.assertEquals(childrenIds.next(),"o:23"); + Assert.assertEquals(childrenIds.next(),"o:22"); + + filterIds.add("r:2"); + childrenIds = jugrix.deepParentOrganizationIds("o:2", filterIds); + + Assert.assertEquals(childrenIds.next(),"o:23"); + + } +}
--- a/src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/deepParentOrganizationIdsTest.java Mon Oct 27 09:16:22 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/deepParentOrganizationIdsTest.java Mon Oct 27 09:41:14 2014 +0900 @@ -14,9 +14,8 @@ public void deepParentOrganizationIds(){ JuGrix jugrix = new JuGrix(); LinkedList<String> filterIds = new LinkedList<String>(); - //filterIds.add("r:2"); - Iterator<String> childrenIds = jugrix.deepParentOrganizationIds("o:2", filterIds); - + Iterator<String> childrenIds = jugrix.deepParentOrganizationIdsPlus("o:2", filterIds); + Assert.assertEquals(childrenIds.next(),"o:2"); Assert.assertEquals(childrenIds.next(),"o:23"); Assert.assertEquals(childrenIds.next(),"o:22");