assertTrue(exceptionThrown);  System.out.println("testModule 8: ========" ); query = "xquery version \"1.0\";\n" + "import module namespace foo1=\"foo\" at \"" + URI + "/test/" + CHILD1_MODULE_NAME + "\";\n" + "import module namespace foo2=\"foo\" at \"" + URI + "/test/" + CHILD1_MODULE_NAME + "\";\n" + "$foo1:bar"; try { exceptionThrown = false; result = service.query(query); printResult(result); } catch (XMLDBException e) {  exceptionThrown = true; message = e.getMessage(); }
	public void testModule() {		Resource doc;		ResourceSet result;		String query;		XMLResource resu;		boolean exceptionThrown;		String message;						try {			doc = testCollection.createResource(MODULE1_NAME, "BinaryResource");			doc.setContent(module1);				((EXistResource) doc).setMimeType("application/xquery");			testCollection.storeResource(doc);						doc = testCollection.createResource(FATHER_MODULE_NAME, "BinaryResource");			doc.setContent(fatherModule);				((EXistResource) doc).setMimeType("application/xquery");			testCollection.storeResource(doc);			doc = testCollection.createResource(CHILD1_MODULE_NAME, "BinaryResource");			doc.setContent(child1Module);				((EXistResource) doc).setMimeType("application/xquery");			testCollection.storeResource(doc);				doc = testCollection.createResource(CHILD2_MODULE_NAME, "BinaryResource");			doc.setContent(child2Module);				((EXistResource) doc).setMimeType("application/xquery");			testCollection.storeResource(doc);									XPathQueryService service =				(XPathQueryService) testCollection.getService(					"XPathQueryService",					"1.0");						System.out.println("testModule 1: ========" );			query = "xquery version \"1.0\";\n" 				+ "import module namespace blah=\"blah\" at \"" + URI + "/test/" + MODULE1_NAME + "\";\n"				+ "$blah:param";						result = service.query(query);				printResult(result);				assertEquals( "XQuery: " + query, 1, result.getSize() );			assertEquals( "XQuery: " + query, "value-1", ((XMLResource)result.getResource(0)).getContent());						System.out.println("testModule 2: ========" );			query = "xquery version \"1.0\";\n" 				+ "import module namespace blah=\"blah\" at \"" + URI + "/test/" + MODULE1_NAME + "\";\n"				+ "(:: redefine variable ::)\n"				+ "declare variable $blah:param  {\"value-2\"};\n"							+ "$blah:param";			try {				exceptionThrown = false;							result = service.query(query);					printResult(result);				} catch (XMLDBException e) {				exceptionThrown = true;				message = e.getMessage();							}						assertTrue(exceptionThrown);						System.out.println("testModule 3: ========" );			query = "xquery version \"1.0\";\n" 				+ "import module namespace blah=\"blah\" at \"" + URI + "/test/" + MODULE1_NAME + "\";\n"				+ "declare namespace blah2=\"blah\";\n"						+ "$blah2:param";			result = service.query(query);			printResult(result);			assertEquals( "XQuery: " + query, 1, result.getSize() );			assertEquals( "XQuery: " + query, "value-1", ((XMLResource)result.getResource(0)).getContent());							System.out.println("testModule 4: ========" );			query = "xquery version \"1.0\";\n" 				+ "import module namespace blah=\"bla\" at \"" + URI + "/test/" + MODULE1_NAME + "\";\n"									+ "$blah:param";			try {				exceptionThrown = false;							result = service.query(query);					printResult(result);				} catch (XMLDBException e) {				exceptionThrown = true;				message = e.getMessage();							}						assertTrue(exceptionThrown);						System.out.println("testModule 5: ========" );			query = "xquery version \"1.0\";\n" 				+ "import module namespace foo=\"foo\" at \"" + URI + "/test/" + FATHER_MODULE_NAME + "\";\n"									+ "$foo:bar, $foo:bar1, $foo:bar2";								result = service.query(query);				printResult(result);				assertEquals( "XQuery: " + query, 3, result.getSize() );			assertEquals( "XQuery: " + query, "bar", ((XMLResource)result.getResource(0)).getContent());					assertEquals( "XQuery: " + query, "bar1", ((XMLResource)result.getResource(1)).getContent());					assertEquals( "XQuery: " + query, "bar2", ((XMLResource)result.getResource(2)).getContent());					//			Non-heritance check			System.out.println("testModule 6: ========" );			query = "xquery version \"1.0\";\n" 				+ "import module namespace foo=\"foo\" at \"" + URI + "/test/" + FATHER_MODULE_NAME + "\";\n"				+ "declare namespace foo1=\"foo1\"; \n"				+ "$foo1:bar";			try {				exceptionThrown = false;							result = service.query(query);					printResult(result);				} catch (XMLDBException e) {				exceptionThrown = true;				message = e.getMessage();							}						assertTrue(exceptionThrown);			//			Non-heritance check			System.out.println("testModule 7: ========" );			query = "xquery version \"1.0\";\n" 				+ "import module namespace foo=\"foo\" at \"" + URI + "/test/" + FATHER_MODULE_NAME + "\";\n"					+ "declare namespace foo2=\"foo2\"; \n"				+ "$foo2:bar";			try {				exceptionThrown = false;							result = service.query(query);					printResult(result);				} catch (XMLDBException e) {				exceptionThrown = true;				message = e.getMessage();							}						assertTrue(exceptionThrown);								} catch (XMLDBException e) {			System.out.println("testModule : XMLDBException: "+e);			fail(e.getMessage());		}	}	