Details
-
Bug
-
Resolution: Obsolete
-
Major
-
None
-
None
Description
The following test case fails:
A property of type Integer with value 123 is to be changed to a String with value 'newValue'
@Test
public void testUpdatePropertyValueAndType() throws Exception {
// GIVEN
Node node = session.getRootNode();
node.setProperty(propertyName, 123);
JcrPropertyAdapter adapter = new JcrPropertyAdapter(node.getProperty(propertyName));
// WHEN
adapter.getItemProperty(JcrPropertyAdapter.TYPE_PROPERTY).setValue("String");
adapter.getItemProperty(JcrPropertyAdapter.VALUE_PROPERTY).setValue("newValue");
adapter.applyChanges();
// THEN
assertTrue(node.hasProperty(propertyName));
assertEquals(PropertyType.STRING, node.getProperty(propertyName).getType());
assertEquals("newValue", node.getProperty(propertyName).getString());
}
The failure is a ClassCastException in DefaultProperty that was added in MGNLUI-565
com.vaadin.data.util.converter.Converter$ConversionException: Cannot convert class java.lang.String to class java.lang.Long at info.magnolia.ui.vaadin.integration.jcr.DefaultProperty.setValue(DefaultProperty.java:69) at info.magnolia.ui.vaadin.integration.jcr.JcrPropertyAdapterTest.testUpdatePropertyValueAndType(JcrPropertyAdapterTest.java:360) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
There's also an ignored testcase that seems to be related info.magnolia.ui.vaadin.integration.jcr.JcrPropertyAdapterTest#testUpdatePropertyValueKeepsPropertyType
Checklists
Acceptance criteria
Attachments
Issue Links
- caused by
-
MGNLUI-565 DefaultProperty: implement proper exception handling, do not override unnecessary methods
-
- Closed
-