Package org.apache.wicket.core.util.objects.checker

Examples of org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream


        if (CheckingObjectOutputStream.isAvailable())
        {
          try
          {
            // trigger serialization again, but this time gather some more info
            CheckingObjectOutputStream checkingObjectOutputStream =
              new CheckingObjectOutputStream(outputStream, new ObjectSerializationChecker(nsx));
            checkingObjectOutputStream.writeObject(obj);
          }
          catch (Exception x)
          {
            if (x instanceof CheckingObjectOutputStream.ObjectCheckException)
            {
View Full Code Here


   * @throws IOException
   */
  @Test
  public void valueMap() throws IOException
  {
    CheckingObjectOutputStream checker = new CheckingObjectOutputStream(new ByteArrayOutputStream(),
        new ObjectSerializationChecker(new NotSerializableException()));
    checker.writeObject(new ValueMap());
  }
View Full Code Here

   */
  @Test
  public void checkObjectsByIdentity() throws IOException
  {
    CountingChecker countingChecker = new CountingChecker();
    CheckingObjectOutputStream outputStream = new CheckingObjectOutputStream(new ByteArrayOutputStream(), countingChecker);
    final IdentityTestType type = new IdentityTestType();
    type.member = new SerializableTypeWithMember(type);
    outputStream.writeObject(type);

    assertThat(countingChecker.getCount(), is(2));
  }
View Full Code Here

   * @throws IOException
   */
  @Test
  public void nonSerializableTypeDetection() throws IOException
  {
    CheckingObjectOutputStream checker = new CheckingObjectOutputStream(new ByteArrayOutputStream(),
      new ObjectSerializationChecker(new NotSerializableException()));
    String exceptionMessage = null;
    try
    {
      checker.writeObject(new TestType2());
    }
    catch (CheckingObjectOutputStream.ObjectCheckException e)
    {
      exceptionMessage = e.getMessage();
    }
View Full Code Here

   * @throws IOException
   */
  @Test
  public void valueMap() throws IOException
  {
    CheckingObjectOutputStream checker = new CheckingObjectOutputStream(new ByteArrayOutputStream(),
        new ObjectSerializationChecker(new NotSerializableException()));
    checker.writeObject(new ValueMap());
  }
View Full Code Here

   */
  @Test
  public void checkObjectsByIdentity() throws IOException
  {
    CountingChecker countingChecker = new CountingChecker();
    CheckingObjectOutputStream outputStream = new CheckingObjectOutputStream(new ByteArrayOutputStream(), countingChecker);
    final IdentityTestType type = new IdentityTestType();
    type.member = new SerializableTypeWithMember(type);
    outputStream.writeObject(type);

    assertThat(countingChecker.getCount(), is(2));
  }
View Full Code Here

   * @throws IOException
   */
  @Test
  public void nonSerializableTypeDetection() throws IOException
  {
    CheckingObjectOutputStream checker = new CheckingObjectOutputStream(new ByteArrayOutputStream(),
      new ObjectSerializationChecker(new NotSerializableException()));
    String exceptionMessage = null;
    try
    {
      checker.writeObject(new TestType2());
    }
    catch (CheckingObjectOutputStream.ObjectCheckException e)
    {
      exceptionMessage = e.getMessage();
    }
View Full Code Here

    {
      @Override
      protected ObjectOutputStream newObjectOutputStream(OutputStream out) throws IOException
      {
        IObjectChecker checker = new NotDetachedModelChecker();
        return new CheckingObjectOutputStream(out, checker);
      }
    };

    IModel<String> model = new NotDetachedModel();
    model.getObject();
View Full Code Here

  {
    JavaSerializer serializer = new JavaSerializer("JavaSerializerTest-normal") {
      @Override
      protected ObjectOutputStream newObjectOutputStream(OutputStream out) throws IOException
      {
        return new CheckingObjectOutputStream(out);
      }
    };
    byte[] bytes = serializer.serialize("Something to serialize");
    assertEquals(57, bytes.length);
  }
View Full Code Here

   */
  @Test
  public void checkObjectsByIdentity() throws IOException
  {
    CountingChecker countingChecker = new CountingChecker();
    CheckingObjectOutputStream outputStream = new CheckingObjectOutputStream(new ByteArrayOutputStream(), countingChecker);
    final IdentityTestType type = new IdentityTestType();
    type.member = new SerializableTypeWithMember(type);
    outputStream.writeObject(type);

    assertThat(countingChecker.getCount(), is(2));
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.