Skip to content

Commit

Permalink
Merge branch 'shabanovd-bugfix/ws_store_bug' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ljo committed Jul 7, 2015
2 parents 09856fc + d2bbbc8 commit a79152f
Show file tree
Hide file tree
Showing 28 changed files with 163 additions and 232 deletions.
312 changes: 121 additions & 191 deletions src/org/exist/Indexer.java

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions test/src/org/exist/collections/CollectionRemovalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private void retrieveDoc(XmldbURI uri) {
private void doQuery(int expected) {
try {
org.xmldb.api.base.Collection testCollection =
DatabaseManager.getCollection("xmldb:exist://" + TestConstants.TEST_COLLECTION_URI.toString(), "admin", null);
DatabaseManager.getCollection("xmldb:exist://" + TestConstants.TEST_COLLECTION_URI.toString(), "admin", "");
if (testCollection == null)
return;
XPathQueryServiceImpl service = (XPathQueryServiceImpl)
Expand All @@ -169,7 +169,7 @@ private void doQuery(int expected) {
public void clearDB() {
try {
org.xmldb.api.base.Collection root =
DatabaseManager.getCollection("xmldb:exist://" + TestConstants.TEST_COLLECTION_URI.toString(), "admin", null);
DatabaseManager.getCollection("xmldb:exist://" + TestConstants.TEST_COLLECTION_URI.toString(), "admin", "");
CollectionManagementService service = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
service.removeCollection(".");
} catch (XMLDBException e) {
Expand Down Expand Up @@ -258,7 +258,7 @@ public static void startDB() {
public static void stopDB() {
try {
org.xmldb.api.base.Collection root = DatabaseManager.getCollection(
"xmldb:exist:///db", "admin", null);
"xmldb:exist:///db", "admin", "");
DatabaseInstanceManager dim = (DatabaseInstanceManager) root.getService("DatabaseInstanceManager", "1.0");
dim.shutdown();
} catch (XMLDBException e) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/org/exist/collections/ConcurrencyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private QueryTask(String query, int start, boolean protect) {

public void run() {
try {
Collection collection = DatabaseManager.getCollection("xmldb:exist:///db/test", "admin", null);
Collection collection = DatabaseManager.getCollection("xmldb:exist:///db/test", "admin", "");
XPathQueryServiceImpl service = (XPathQueryServiceImpl) collection.getService("XQueryService", "1.0");
service.beginProtected();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void saxEventModificationsAtXConf() throws EXistException, XMLDBException

@After
public void cleanDB() throws XMLDBException {
final Collection config = DatabaseManager.getCollection(BASE_URI + "/db/system/config" + testCollection, "admin", null);
final Collection config = DatabaseManager.getCollection(BASE_URI + "/db/system/config" + testCollection, "admin", "");
if (config != null) {
CollectionManagementService mgmt = (CollectionManagementService) config.getService("CollectionManagementService", "1.0");
mgmt.removeCollection(".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void updateTriggers() {
IndexQueryService iqs = (IndexQueryService) root.getService("IndexQueryService", "1.0");
iqs.configureCollection(EMPTY_COLLECTION_CONFIG);

Collection configCol = DatabaseManager.getCollection(BASE_URI + "/db/system/config" + testCollection, "admin", null);
Collection configCol = DatabaseManager.getCollection(BASE_URI + "/db/system/config" + testCollection, "admin", "");
Resource resource = configCol.createResource("collection.xconf", "XMLResource");
resource.setContent(COLLECTION_CONFIG);
configCol.storeResource(resource);
Expand All @@ -173,7 +173,7 @@ public void updateTriggers() {
@After
public void cleanDB() {
try {
Collection config = DatabaseManager.getCollection(BASE_URI + "/db/system/config" + testCollection, "admin", null);
Collection config = DatabaseManager.getCollection(BASE_URI + "/db/system/config" + testCollection, "admin", "");
if (config != null) {
CollectionManagementService mgmt = (CollectionManagementService) config.getService("CollectionManagementService", "1.0");
mgmt.removeCollection(".");
Expand Down
4 changes: 2 additions & 2 deletions test/src/org/exist/storage/lock/DeadlockTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public static void stopDB() {
@After
public void clearDB() {
try {
org.xmldb.api.base.Collection root = DatabaseManager.getCollection("xmldb:exist:///db/test", "admin", null);
org.xmldb.api.base.Collection root = DatabaseManager.getCollection("xmldb:exist:///db/test", "admin", "");
CollectionManagementService service = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
service.removeCollection(".");
} catch (XMLDBException e) {
Expand Down Expand Up @@ -379,7 +379,7 @@ public void run() {
int docId = random.nextInt(documentCount) * collectionId;
String document = "test" + docId + ".xml";
try {
org.xmldb.api.base.Collection testCollection = DatabaseManager.getCollection("xmldb:exist://" + collection, "admin", null);
org.xmldb.api.base.Collection testCollection = DatabaseManager.getCollection("xmldb:exist://" + collection, "admin", "");
Resource resource = testCollection.getResource(document);
if (resource != null) {
testCollection.removeResource(resource);
Expand Down
6 changes: 3 additions & 3 deletions test/src/org/exist/storage/lock/ProtectedModeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class ProtectedModeTest {
@Test
public void queryCollection() {
try {
Collection root = DatabaseManager.getCollection("xmldb:exist:///db/protected", "admin", null);
Collection root = DatabaseManager.getCollection("xmldb:exist:///db/protected", "admin", "");
XPathQueryServiceImpl service = (XPathQueryServiceImpl) root.getService("XQueryService", "1.0");
try {
service.beginProtected();
Expand All @@ -90,7 +90,7 @@ public void queryCollection() {
@Test
public void queryRoot() {
try {
Collection root = DatabaseManager.getCollection("xmldb:exist:///db/protected", "admin", null);
Collection root = DatabaseManager.getCollection("xmldb:exist:///db/protected", "admin", "");
XPathQueryServiceImpl service = (XPathQueryServiceImpl) root.getService("XQueryService", "1.0");
try {
service.beginProtected();
Expand All @@ -108,7 +108,7 @@ public void queryRoot() {
@Test
public void queryDocs() {
try {
Collection root = DatabaseManager.getCollection("xmldb:exist:///db/protected", "admin", null);
Collection root = DatabaseManager.getCollection("xmldb:exist:///db/protected", "admin", "");
XPathQueryServiceImpl service = (XPathQueryServiceImpl) root.getService("XQueryService", "1.0");
Random random = new Random();
for (int i = 0; i < COLLECTION_COUNT; i++) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/org/exist/validation/TestTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static void insertResources(){
Database database = (Database) cl.newInstance();
database.setProperty("create-database", "true");
DatabaseManager.registerDatabase(database);
Collection root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", null);
Collection root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", "");
XPathQueryService service = (XPathQueryService) root.getService("XQueryService", "1.0");
CollectionManagementService cmservice = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void setUp() throws Exception {
database = (Database) cl.newInstance();
database.setProperty("create-database", "true");
DatabaseManager.registerDatabase(database);
root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", null);
root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", "");
service = (XPathQueryService) root.getService( "XQueryService", "1.0" );
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public void noTest() {
// logger.info("shutdownDB");
//
//
// root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", null);
// root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", "");
//
//
// DatabaseManager.deregisterDatabase(database);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void noTest() {
//
// logger.info("stop");
//
// root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", null);
// root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", "");
//
// DatabaseManager.deregisterDatabase(database);
// DatabaseInstanceManager dim =
Expand Down
4 changes: 2 additions & 2 deletions test/src/org/exist/xmldb/CollectionConfigurationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ public void missingRangeIndexes() throws Exception {
exceptionThrown = false;
result = service.query("/test/c[(# exist:force-index-use #) { . = xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") }]");
} catch (Exception e) {
e.printStackTrace();
//e.printStackTrace();
if (e.getMessage().indexOf("XQDYxxxx") != Constants.STRING_NOT_FOUND)
exceptionThrown = true;
else throw e;
Expand Down Expand Up @@ -1438,7 +1438,7 @@ private void checkStoreConf(XmldbURI coll1, XmldbURI confName1, XmldbURI coll2,
private void storeConfiguration(XmldbURI collPath, XmldbURI confName, String confContent) throws XMLDBException {
Collection testCollection = DatabaseManager.getCollection(ROOT_URI + "/" + TEST_COLLECTION);
String fullCollPath = ROOT_URI + collPath.toString();
Collection configColl = DatabaseManager.getCollection(fullCollPath, "admin", null);
Collection configColl = DatabaseManager.getCollection(fullCollPath, "admin", "");
if(configColl == null) {
CollectionManagementService cms = (CollectionManagementService)testCollection.getService("CollectionManagementService", "1.0");
configColl = cms.createCollection(collPath.toString());
Expand Down
2 changes: 1 addition & 1 deletion test/src/org/exist/xmldb/MultiDBTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void tearDown()
long free = rt.freeMemory() / 1024;
long total = rt.totalMemory() / 1024;
for (int i = 0; i < INSTANCE_COUNT; i++) {
Collection root = DatabaseManager.getCollection("xmldb:test" + i + "://" + XmldbURI.ROOT_COLLECTION, "admin", null);
Collection root = DatabaseManager.getCollection("xmldb:test" + i + "://" + XmldbURI.ROOT_COLLECTION, "admin", "");
CollectionManagementService service = (CollectionManagementService)
root.getService("CollectionManagementService", "1.0");
service.removeCollection("test");
Expand Down
4 changes: 2 additions & 2 deletions test/src/org/exist/xmldb/RemoteCollectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ public void parent() throws XMLDBException {

String parentName = c.getName() + "/" + System.currentTimeMillis();
String colName = parentName + "/a";
c = DatabaseManager.getCollection(URI + parentName, "admin", null);
c = DatabaseManager.getCollection(URI + parentName, "admin", "");
assertNull(c);

// following fails for XmlDb 20051203
c = DatabaseManager.getCollection(URI + colName, "admin", null);
c = DatabaseManager.getCollection(URI + colName, "admin", "");
assertNull(c);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public AttributeUpdateAction(String collectionPath, String resourceName, String[
* @see org.exist.xmldb.test.concurrent.Action#execute()
*/
public boolean execute() throws Exception {
Collection col = DatabaseManager.getCollection(collectionPath, "admin", null);
Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
XUpdateQueryService service = (XUpdateQueryService)
col.getService("XUpdateQueryService", "1.0");
int attrSize = rand.nextInt(5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public ComplexUpdateAction(String collectionPath, String resourceName, int repea
* @see org.exist.xmldb.test.concurrent.Action#execute()
*/
public boolean execute() throws Exception {
Collection col = DatabaseManager.getCollection(collectionPath, "admin", null);
Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
for(int i = 0; i < repeat; i++) {
query(col, i);
col.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public CreateCollectionAction(String collectionPath, String resourceName) {
}

public boolean execute() throws Exception {
Collection col = DatabaseManager.getCollection(collectionPath, "admin", null);
Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
Collection target = DBUtils.addCollection(col, "C" + ++collectionCnt);
addFiles(target);
String resources[] = target.listResources();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public MultiResourcesAction(String dirPath, String collectionPath) {
* @see org.exist.xmldb.test.concurrent.Action#execute()
*/
public boolean execute() throws Exception {
Collection col = DatabaseManager.getCollection(collectionPath, "admin", null);
Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
addFiles(col);
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public RemoveAppendAction(String collectionPath, String resourceName, String[] w
* @see org.exist.xmldb.test.concurrent.ConcurrentXUpdateTest.Action#execute()
*/
public boolean execute() throws Exception {
Collection col = DatabaseManager.getCollection(collectionPath, "admin", null);
Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
XUpdateQueryService service = (XUpdateQueryService)
col.getService("XUpdateQueryService", "1.0");
append(service);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public ReplaceResourceAction(String collectionPath, String resourceName) {
* @see org.exist.xmldb.test.concurrent.Action#execute()
*/
public boolean execute() throws Exception {
Collection col = DatabaseManager.getCollection(collectionPath, "admin", null);
Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
String xml =
"<data now=\"" + System.currentTimeMillis() + "\" count=\"" +
++count + "\">" + XML + "</data>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public TextUpdateAction(String collectionPath, String resourceName) {
* @see org.exist.xmldb.test.concurrent.Action#execute()
*/
public boolean execute() throws Exception {
Collection col = DatabaseManager.getCollection(collectionPath, "admin", null);
Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
XUpdateQueryService service = (XUpdateQueryService)
col.getService("XUpdateQueryService", "1.0");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ValueAppendAction(String collectionPath, String resourceName) {
* @see org.exist.xmldb.test.concurrent.Action#execute()
*/
public boolean execute() throws Exception {
Collection col = DatabaseManager.getCollection(collectionPath, "admin", null);
Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
XUpdateQueryService service = (XUpdateQueryService)
col.getService("XUpdateQueryService", "1.0");
XPathQueryService query = (XPathQueryService)
Expand Down
4 changes: 2 additions & 2 deletions test/src/org/exist/xquery/AnnotationsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ public static void tearDown() throws Exception {
// testCollection.removeResource( testCollection .getResource(file_name));
TestUtils.cleanupDB();
DatabaseInstanceManager dim =
(DatabaseInstanceManager) DatabaseManager.getCollection("xmldb:exist:///db", "admin", null).getService("DatabaseInstanceManager", "1.0");
(DatabaseInstanceManager) DatabaseManager.getCollection("xmldb:exist:///db", "admin", "").getService("DatabaseInstanceManager", "1.0");
dim.shutdown();
DatabaseManager.deregisterDatabase(database);
database = null;
}

private Collection getTestCollection() throws XMLDBException {
return DatabaseManager.getCollection("xmldb:exist:///db/test", "admin", null);
return DatabaseManager.getCollection("xmldb:exist:///db/test", "admin", "");
}


Expand Down
4 changes: 2 additions & 2 deletions test/src/org/exist/xquery/DuplicateAttributesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static void initDB() {
database.setProperty("create-database", "true");
DatabaseManager.registerDatabase(database);

Collection root = DatabaseManager.getCollection("xmldb:exist:///db", "admin", null);
Collection root = DatabaseManager.getCollection("xmldb:exist:///db", "admin", "");
CollectionManagementService service = (CollectionManagementService)
root.getService("CollectionManagementService", "1.0");
testCollection = service.createCollection("test");
Expand All @@ -160,7 +160,7 @@ public static void initDB() {
@AfterClass
public static void stopDB() {
try {
Collection root = DatabaseManager.getCollection("xmldb:exist:///db", "admin", null);
Collection root = DatabaseManager.getCollection("xmldb:exist:///db", "admin", "");
CollectionManagementService service = (CollectionManagementService)
root.getService("CollectionManagementService", "1.0");
service.removeCollection("test");
Expand Down
4 changes: 2 additions & 2 deletions test/src/org/exist/xquery/ValueIndexTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void setUp() throws ClassNotFoundException, IllegalAccessException, Insta
database.setProperty("create-database", "true");
DatabaseManager.registerDatabase(database);

Collection root = DatabaseManager.getCollection(URI, "admin", null);
Collection root = DatabaseManager.getCollection(URI, "admin", "");
CollectionManagementService service = (CollectionManagementService) root
.getService("CollectionManagementService", "1.0");
testCollection = service.createCollection("test");
Expand All @@ -115,7 +115,7 @@ public void setUp() throws ClassNotFoundException, IllegalAccessException, Insta
@After
public void tearDown() throws Exception {
try {
Collection root = DatabaseManager.getCollection(URI, "admin", null);
Collection root = DatabaseManager.getCollection(URI, "admin", "");
CollectionManagementService service = (CollectionManagementService) root
.getService("CollectionManagementService", "1.0");
service.removeCollection("test");
Expand Down
7 changes: 4 additions & 3 deletions test/src/org/exist/xquery/XPathQueryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ public void ids() throws XMLDBException {

@Test
public void idsOnEmptyCollection() throws XMLDBException {
final Collection root = DatabaseManager.getCollection(uri, "admin", null);
final Collection root = DatabaseManager.getCollection(uri, "admin", "");
final CollectionManagementService service = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
final Collection emptyCollection = service.createCollection("empty");
final XQueryService queryService = (XQueryService) emptyCollection.getService("XPathQueryService", "1.0");
Expand Down Expand Up @@ -1469,7 +1469,7 @@ public void externalVars() throws XMLDBException {
try {
service.execute(expr);
} catch (XMLDBException e) {
e.printStackTrace();
//e.printStackTrace();
message = e.getMessage();
}
assertTrue(message.indexOf("XPTY0004") > -1);
Expand All @@ -1487,7 +1487,7 @@ public void externalVars() throws XMLDBException {
try {
service.execute(expr);
} catch (XMLDBException e) {
e.printStackTrace();
//e.printStackTrace();
message = e.getMessage();
}
assertTrue(message.indexOf("XPTY0004") > -1);
Expand Down Expand Up @@ -1589,6 +1589,7 @@ public void preserveSpace() throws XMLDBException, IOException, SAXException {
assertEquals(2, result.getSize());

String item = result.getResource(0).getContent().toString();
System.out.println(item);
assertXMLEqual("<text> </text>", item);
item = result.getResource(1).getContent().toString();
assertXMLEqual("<text xml:space=\"default\"/>", item);
Expand Down
Loading

0 comments on commit a79152f

Please sign in to comment.