[ 
https://issues.apache.org/jira/browse/JAMES-2167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16540274#comment-16540274
 ] 

ASF GitHub Bot commented on JAMES-2167:
---------------------------------------

Github user nstdio commented on a diff in the pull request:

    https://github.com/apache/james-project/pull/126#discussion_r201745573
  
    --- Diff: 
server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSSerializationUtilsTest.java
 ---
    @@ -0,0 +1,119 @@
    +/****************************************************************
    + * Licensed to the Apache Software Foundation (ASF) under one   *
    + * or more contributor license agreements.  See the NOTICE file *
    + * distributed with this work for additional information        *
    + * regarding copyright ownership.  The ASF licenses this file   *
    + * to you under the Apache License, Version 2.0 (the            *
    + * "License"); you may not use this file except in compliance   *
    + * with the License.  You may obtain a copy of the License at   *
    + *                                                              *
    + *   http://www.apache.org/licenses/LICENSE-2.0                 *
    + *                                                              *
    + * Unless required by applicable law or agreed to in writing,   *
    + * software distributed under the License is distributed on an  *
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
    + * KIND, either express or implied.  See the License for the    *
    + * specific language governing permissions and limitations      *
    + * under the License.                                           *
    + ****************************************************************/
    +package org.apache.james.queue.jms;
    +
    +import static org.apache.james.queue.jms.JMSSerializationUtils.deserialize;
    +import static 
org.apache.james.queue.jms.JMSSerializationUtils.hasJMSNativeSupport;
    +import static org.apache.james.queue.jms.JMSSerializationUtils.roundtrip;
    +import static 
org.apache.james.queue.jms.JMSSerializationUtils.trySerialize;
    +import static org.assertj.core.api.Assertions.assertThat;
    +import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
    +
    +import java.io.Serializable;
    +import java.util.Objects;
    +
    +import org.apache.commons.codec.binary.Base64;
    +import org.apache.commons.lang3.SerializationException;
    +import org.assertj.core.api.SoftAssertions;
    +import org.junit.jupiter.api.Test;
    +
    +class JMSSerializationUtilsTest {
    +    @Test
    +    @SuppressWarnings("ConstantConditions")
    +    void hasJMSNativeSupportSpec() {
    +        SoftAssertions softly = new SoftAssertions();
    +
    +        softly.assertThat(hasJMSNativeSupport(null)).as("null 
support").isTrue();
    +        softly.assertThat(hasJMSNativeSupport("")).as("String 
support").isTrue();
    +        softly.assertThat(hasJMSNativeSupport((byte) 0)).as("Byte 
support").isTrue();
    +        softly.assertThat(hasJMSNativeSupport((long) 0)).as("Long 
support").isTrue();
    +        softly.assertThat(hasJMSNativeSupport((double) 0)).as("Double 
support").isTrue();
    +        softly.assertThat(hasJMSNativeSupport(0)).as("Integer 
support").isTrue();
    +        softly.assertThat(hasJMSNativeSupport((short) 0)).as("Short 
support").isTrue();
    +        softly.assertThat(hasJMSNativeSupport((float) 0)).as("Float 
support").isTrue();
    +        softly.assertThat(hasJMSNativeSupport(true)).as("Boolean 
support").isTrue();
    +
    +        softly.assertAll();
    +    }
    +
    +    @Test
    +    void trySerializeShouldReturnItselfWhenJMSSupported() {
    +        Integer expected = 41;
    +
    +        Object actual = trySerialize(expected);
    +
    +        assertThat(actual).isSameAs(expected);
    +    }
    +
    +    @Test
    +    void trySerializeShouldReturnString() {
    +        SerializableStringHolder value = new 
SerializableStringHolder("value");
    +
    +        Object actual = trySerialize(value);
    +
    +        assertThat(actual)
    +                .isInstanceOf(String.class);
    +    }
    +
    +    @Test
    +    void roundTripShouldReturnEqualObject() {
    --- End diff --
    
    In respect that we remove `JMSSerializationUtils::hasJMSNativeSupport` Is 
this still relevant for us?


> Serializable attributes are not preserved by enqueue/dequeue on a JMS queue
> ---------------------------------------------------------------------------
>
>                 Key: JAMES-2167
>                 URL: https://issues.apache.org/jira/browse/JAMES-2167
>             Project: James Server
>          Issue Type: Bug
>          Components: Queue
>    Affects Versions: master
>            Reporter: Tellier Benoit
>            Priority: Major
>
> A call to toString breaks convertion for generic serializable attributes. 
> The dequeued email will have only a toString version of it. We are expecting 
> the exact same value, just deserialized.
> We should ensure the value of Serializable attributes gets preserved by 
> enqueue/dequeue operations. We should add a unit test for this, and fix it.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to