Hello Sven,

This error is thrown in my test case. I think my basic understanding about
the way wicket works is wrong.

In my CustomerWicketTester class(which inherits from WicketTester), I have
overridden the method as follows:

@Override
public void executeAjaxEvent(final Component component, final String event)
{
        serializationChecker();
        super.executeAjaxEvent(component, event);
}

So from my test case while calling 'wicketTester.clickTreeNode("Users");'
which intern calls executeAjaxEvent throws the above error.

Following is my custom JavaSerializer class and the method which uses it:

public void serializationChecker(){
        javaSerializer.serialize(getLastRenderedPage());
}

private class CustomJavaSerializer extends JavaSerializer {

        private final String appKey;
        public CustomJavaSerializer(String applicationKey) {
                super(applicationKey);
                this.appKey = applicationKey;
        }
                
        @Override
        protected ObjectOutputStream newObjectOutputStream(OutputStream out) 
throws
IOException {
                IObjectChecker checker = new NotDetachedModelChecker();
                IObjectChecker checker2 = new
SerializableChecker.ObjectSerializationChecker();
                return new CheckingObjectOutputStream(out, checker, checker2);
         }

        @Override
        public byte[] serialize(Object object) throws WicketRuntimeException {
        try
        {
                final ByteArrayOutputStream out = new ByteArrayOutputStream();
                ObjectOutputStream oos = null;
                try
                {
                        oos = newObjectOutputStream(out);
                        oos.writeObject(appKey);
                        oos.writeObject(object);
                }
                finally
                {
                        try
                        {
                                IOUtils.close(oos);
                        }
                        finally
                        {
                                out.close();
                        }
                }
                return out.toByteArray();
        }
        catch (Exception e)
        {
                throw new WicketRuntimeException("Error serializing object " +
object.getClass() + " [object=" + object + "]", e);
        }
    }
}


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Error-Not-detached-model-found-tp4672624p4672632.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to