use of com.xpn.xwiki.objects.BaseObject in project xwiki-platform by xwiki.
the class PropertyChangedRuleTest method testVerifyNoObjectOfClass.
public void testVerifyNoObjectOfClass() 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.otherClassName, this.context);
BaseObject newObj = newDoc.newObject(this.otherClassName, this.context);
newObj.setStringValue(this.testPropertyName, "value1");
oldObj.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 testVerifyMultipleObjectsOtherObjectDeleted.
public void testVerifyMultipleObjectsOtherObjectDeleted() 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");
BaseObject oldObjOtherClass = oldDoc.newObject(this.otherClassName, this.context);
oldObjOtherClass.setStringValue(this.testPropertyName, "value2");
BaseObject oldObj2 = oldDoc.newObject(this.testClassName, this.context);
oldObj2.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 testVerifyMultipleObjectsOtherObjectAdded.
public void testVerifyMultipleObjectsOtherObjectAdded() 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 newObjOtherClass = newDoc.newObject(this.otherClassName, this.context);
newObjOtherClass.setStringValue(this.testPropertyName, "value2");
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");
BaseObject oldObj2 = oldDoc.newObject(this.testClassName, this.context);
oldObj2.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 testVerifyMultipleObjectsClassChanged.
public void testVerifyMultipleObjectsClassChanged() 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 newObjOtherClass = newDoc.newObject(this.otherClassName, this.context);
newObjOtherClass.setStringValue(this.testPropertyName, "value2");
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 testVerifyMultipleObjectsXWikiClassNotChanged.
public void testVerifyMultipleObjectsXWikiClassNotChanged() 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, "value");
otherNewObject.setStringValue(this.testPropertyName, "value1");
newObj.setStringValue(this.testPropertyName, "value");
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);
}
Aggregations