1 10 11 package org.mmbase.bridge; 12 13 import org.mmbase.tests.*; 14 15 21 public class NodeManagerTest extends BridgeTest { 22 Cloud cloud; 23 NodeList nodes; 24 int nrOfTestNodes; 25 public final static String TEST_STRING_VALUE = "C05353E04zz HAVO, Cultuur/Maatschappij, Z'zee, 04-05"; 26 27 public NodeManagerTest(String name) { 28 super(name); 29 } 30 31 public void setUp() { 32 cloud = getCloud(); 34 nodes = cloud.createNodeList(); 35 Node node = cloud.getNodeManager("aa").createNode(); 36 node.setByteValue("bytefield", "100".getBytes()); 37 node.setDoubleValue("doublefield", 200); 38 node.setFloatValue("floatfield", 300); 39 node.setIntValue("intfield", 400); 40 node.setLongValue("longfield", 500); 41 node.setStringValue("stringfield", "600"); 42 node.commit(); 43 nodes.add(node); 44 45 node = cloud.getNodeManager("aa").createNode(); 46 node.setByteValue("bytefield", "100".getBytes()); 47 node.setDoubleValue("doublefield", 200); 48 node.setFloatValue("floatfield", 300); 49 node.setIntValue("intfield", 400); 50 node.setLongValue("longfield", 500); 51 node.setStringValue("stringfield", TEST_STRING_VALUE ); 52 node.commit(); 53 54 nodes.add(node); 55 56 } 57 58 public void tearDown() { 59 61 for (NodeIterator i = nodes.nodeIterator() ; i.hasNext() ; ){ 62 i.nextNode().delete(); 63 } 64 } 65 66 public void testGetList() { 67 NodeManager nodeManager = cloud.getNodeManager("aa"); 68 NodeList nodeList; 69 nodeList = nodeManager.getList(null, null, null); 70 assertTrue(nodeList.size() == nodes.size()); 71 nodeList = nodeManager.getList("", "", ""); 72 assertTrue(nodeList.size() == nodes.size()); 73 } 74 75 78 public void testGetListWithQuotes() { 79 NodeManager nodeManager = cloud.getNodeManager("aa"); 80 NodeList nodeList = nodeManager.getList("stringfield ='"+ org.mmbase.util.Encode.encode("ESCAPE_SINGLE_QUOTE", TEST_STRING_VALUE) + "'", "", ""); 81 assertTrue("Size of result list with constraint on string field is not 1 but " + nodeList.size() + " : " + nodeList, nodeList.size() == 1); 82 } 83 85 87 } 88 | Popular Tags |