use of com.xpn.xwiki.objects.BaseObject in project xwiki-platform by xwiki.
the class PropertyChangedRuleTest method testVerifyMultipleObjectsObjectDeleted.
public void testVerifyMultipleObjectsObjectDeleted() throws XWikiException {
XWikiDocument newDoc = new XWikiDocument(new DocumentReference("Test", "Test", "TestDoc"));
XWikiDocument oldDoc = new XWikiDocument(new DocumentReference("Test", "Test", "TestDoc"));
BaseObject newObj1 = newDoc.newObject(this.testClassName, this.context);
newObj1.setStringValue(this.testPropertyName, "value1");
BaseObject oldObj1 = oldDoc.newObject(this.testClassName, this.context);
oldObj1.setStringValue(this.testPropertyName, "value1");
BaseObject oldObj2 = oldDoc.newObject(this.testClassName, this.context);
oldObj2.setStringValue(this.testPropertyName, "value2");
this.passed = false;
this.rule.verify(newDoc, oldDoc, this.context);
assertTrue("My notification should have been called", this.passed);
// The rule should be symmetric. Do the inverse test too.
this.passed = false;
this.rule.verify(oldDoc, newDoc, this.context);
assertTrue("My notification should have been called", this.passed);
}
use of com.xpn.xwiki.objects.BaseObject in project xwiki-platform by xwiki.
the class PropertyChangedRuleTest method testVerifyMultipleObjectsMultipleXWikiClassNotChanged.
public void testVerifyMultipleObjectsMultipleXWikiClassNotChanged() throws XWikiException {
XWikiDocument newDoc = this.classDoc.clone();
XWikiDocument oldDoc = this.classDoc.clone();
BaseObject otherOldObject = oldDoc.newObject(this.otherClassName, this.context);
BaseObject oldObj = oldDoc.newObject(this.testClassName, this.context);
BaseObject oldObj2 = oldDoc.newObject(this.testClassName, this.context);
BaseObject otherNewObject = newDoc.newObject(this.otherClassName, this.context);
BaseObject newObj = newDoc.newObject(this.testClassName, this.context);
BaseObject newObj2 = newDoc.newObject(this.testClassName, this.context);
otherOldObject.setStringValue(this.testPropertyName, "value1");
oldObj.setStringValue(this.testPropertyName, "value1");
oldObj2.setStringValue(this.testPropertyName, "value2");
otherNewObject.setStringValue(this.testPropertyName, "value1");
newObj.setStringValue(this.testPropertyName, "value1");
newObj2.setStringValue(this.testPropertyName, "value2");
this.passed = false;
this.rule.verify(newDoc, oldDoc, this.context);
assertFalse("My notification should not have been called", this.passed);
// The rule should be symmetric. Do the inverse test too.
this.passed = false;
this.rule.verify(oldDoc, newDoc, this.context);
assertFalse("My notification should not have been called", this.passed);
}
use of com.xpn.xwiki.objects.BaseObject in project xwiki-platform by xwiki.
the class PropertyChangedRuleTest method testVerifyObjectDeleted.
public void testVerifyObjectDeleted() throws XWikiException {
XWikiDocument newDoc = new XWikiDocument(new DocumentReference("Test", "Test", "TestDoc"));
XWikiDocument oldDoc = new XWikiDocument(new DocumentReference("Test", "Test", "TestDoc"));
BaseObject oldObj = oldDoc.newObject(this.testClassName, this.context);
oldObj.setStringValue(this.testPropertyName, "value2");
this.passed = false;
this.rule.verify(newDoc, oldDoc, this.context);
assertTrue("My notification should have been called", this.passed);
// The rule should be symmetric. Do the inverse test too.
this.passed = false;
this.rule.verify(oldDoc, newDoc, this.context);
assertTrue("My notification should have been called", this.passed);
}
use of com.xpn.xwiki.objects.BaseObject in project xwiki-platform by xwiki.
the class PropertyChangedRuleTest method testVerifyMultipleObjectsObjectAdded.
public void testVerifyMultipleObjectsObjectAdded() throws XWikiException {
XWikiDocument newDoc = new XWikiDocument(new DocumentReference("Test", "Test", "TestDoc"));
XWikiDocument oldDoc = new XWikiDocument(new DocumentReference("Test", "Test", "TestDoc"));
BaseObject newObj1 = newDoc.newObject(this.testClassName, this.context);
newObj1.setStringValue(this.testPropertyName, "value1");
BaseObject newObj2 = newDoc.newObject(this.testClassName, this.context);
newObj2.setStringValue(this.testPropertyName, "value2");
BaseObject oldObj1 = oldDoc.newObject(this.testClassName, this.context);
oldObj1.setStringValue(this.testPropertyName, "value1");
this.passed = false;
this.rule.verify(newDoc, oldDoc, this.context);
assertTrue("My notification should have been called", this.passed);
// The rule should be symmetric. Do the inverse test too.
this.passed = false;
this.rule.verify(oldDoc, newDoc, this.context);
assertTrue("My notification should have been called", this.passed);
}
use of com.xpn.xwiki.objects.BaseObject in project xwiki-platform by xwiki.
the class PropertyChangedRuleTest method testVerifyMultipleObjectsXWikiClassChanged.
public void testVerifyMultipleObjectsXWikiClassChanged() throws XWikiException {
XWikiDocument newDoc = this.classDoc.clone();
XWikiDocument oldDoc = this.classDoc.clone();
BaseObject otherOldObject = oldDoc.newObject(this.otherClassName, this.context);
BaseObject oldObj = oldDoc.newObject(this.testClassName, this.context);
BaseObject otherNewObject = newDoc.newObject(this.otherClassName, this.context);
BaseObject newObj = newDoc.newObject(this.testClassName, this.context);
otherOldObject.setStringValue(this.testPropertyName, "value1");
oldObj.setStringValue(this.testPropertyName, "value1");
otherNewObject.setStringValue(this.testPropertyName, "value1");
newObj.setStringValue(this.testPropertyName, "value2");
this.passed = false;
this.rule.verify(newDoc, oldDoc, this.context);
assertTrue("My notification should have been called", this.passed);
// The rule should be symmetric. Do the inverse test too.
this.passed = false;
this.rule.verify(oldDoc, newDoc, this.context);
assertTrue("My notification should have been called", this.passed);
}
Aggregations