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

Examples of org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.writeObject()


          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


  @Test
  public void valueMap() throws IOException
  {
    CheckingObjectOutputStream checker = new CheckingObjectOutputStream(new ByteArrayOutputStream(),
        new ObjectSerializationChecker(new NotSerializableException()));
    checker.writeObject(new ValueMap());
  }

  /**
   * Asserts that {@link org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream}
   * will check an instance just once, despite it occurs more than once in the object tree
View Full Code Here

  {
    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));
  }

  private static class CountingChecker extends AbstractObjectChecker
View Full Code Here

    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

  @Test
  public void valueMap() throws IOException
  {
    CheckingObjectOutputStream checker = new CheckingObjectOutputStream(new ByteArrayOutputStream(),
        new ObjectSerializationChecker(new NotSerializableException()));
    checker.writeObject(new ValueMap());
  }

  /**
   * Asserts that {@link org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream}
   * will check an instance just once, despite it occurs more than once in the object tree
View Full Code Here

  {
    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));
  }

  private static class CountingChecker extends AbstractObjectChecker
View Full Code Here

    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

  {
    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));
  }

  private static class CountingChecker extends AbstractObjectChecker
View Full Code Here

  @Test
  public void valueMap() throws IOException
  {
    CheckingObjectOutputStream checker = new CheckingObjectOutputStream(new ByteArrayOutputStream(),
        new ObjectSerializationChecker(new NotSerializableException()));
    checker.writeObject(new ValueMap());
  }

  /**
   * Asserting an meaningful message get logged on console when serializable checker is testing
   * problematic {@link Object#equals(Object)} method implementations.
View Full Code Here

    logger.addAppender(logHistory);
    CheckingObjectOutputStream checker = new CheckingObjectOutputStream(new ByteArrayOutputStream(),
        new ObjectSerializationChecker(new NotSerializableException()));
    try
    {
      checker.writeObject(new TestType1());
      String expectedMessage = "Wasn't possible to check the object 'class org.apache.wicket.util.io.SerializableCheckerTest$ProblematicType' possible due an problematic implementation of equals method";
      assertTrue(logHistory.contains(Level.WARN, expectedMessage));
    }
    catch (TestException notMeaningfulException)
    {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.