You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Martin Ritchie <ri...@apache.org> on 2008/10/27 12:01:36 UTC

Re: svn commit: r706894 - in /incubator/qpid/trunk/qpid/java: ./ client/src/main/java/org/apache/qpid/client/ systests/src/main/java/org/apache/qpid/test/unit/message/ systests/src/main/java/org/apache/qpid/test/utils/

Hi Arnaud,

This change causes a rather large amount of output during the build
phase. Would it be possible to set the correct BOM(byte order mark) on
the UTF8Test and set the java compiler to use that encoding. IIUC,
this should fixe the compiler errors we are seeing.

This thread might help:
http://forums.sun.com/thread.jspa?threadID=560900

Regards

Martin

2008/10/22  <ar...@apache.org>:
> Author: arnaudsimon
> Date: Wed Oct 22 01:17:06 2008
> New Revision: 706894
>
> URL: http://svn.apache.org/viewvc?rev=706894&view=rev
> Log:
> QPID-1384: updated AMQDestination + added test for 0.10 code path
>
> Added:
>    incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/UTF8Test.java
> Modified:
>    incubator/qpid/trunk/qpid/java/08ExcludeList
>    incubator/qpid/trunk/qpid/java/08ExcludeList-nonvm
>    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
>    incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
>
> Modified: incubator/qpid/trunk/qpid/java/08ExcludeList
> URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/08ExcludeList?rev=706894&r1=706893&r2=706894&view=diff
> ==============================================================================
> --- incubator/qpid/trunk/qpid/java/08ExcludeList (original)
> +++ incubator/qpid/trunk/qpid/java/08ExcludeList Wed Oct 22 01:17:06 2008
> @@ -9,3 +9,5 @@
>  org.apache.qpid.test.client.failover.FailoverTest#test4MinuteFailover
>  // QPID-1225 : Temporary remove this test until the problem has been addressed
>  org.apache.qpid.server.security.acl.SimpleACLTest#testClientPublishInvalidQueueSuccess
> +// Those tests are written against the 0.10 path
> +org.apache.qpid.test.unit.message.UTF8Test#*
> \ No newline at end of file
>
> Modified: incubator/qpid/trunk/qpid/java/08ExcludeList-nonvm
> URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/08ExcludeList-nonvm?rev=706894&r1=706893&r2=706894&view=diff
> ==============================================================================
> --- incubator/qpid/trunk/qpid/java/08ExcludeList-nonvm (original)
> +++ incubator/qpid/trunk/qpid/java/08ExcludeList-nonvm Wed Oct 22 01:17:06 2008
> @@ -30,3 +30,6 @@
>
>  // QPID-1262, QPID-1119 : This test fails occasionally due to potential protocol issue.
>  org.apache.qpid.test.client.timeouts.SyncWaitTimeoutDelayTest#*
> +
> +// Those tests are written against the 0.10 path
> +org.apache.qpid.test.unit.message.UTF8Test#*
> \ No newline at end of file
>
> Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
> URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java?rev=706894&r1=706893&r2=706894&view=diff
> ==============================================================================
> --- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java (original)
> +++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java Wed Oct 22 01:17:06 2008
> @@ -82,8 +82,8 @@
>         _isExclusive = Boolean.parseBoolean(binding.getOption(BindingURL.OPTION_EXCLUSIVE));
>         _isAutoDelete = Boolean.parseBoolean(binding.getOption(BindingURL.OPTION_AUTODELETE));
>         _isDurable = Boolean.parseBoolean(binding.getOption(BindingURL.OPTION_DURABLE));
> -        _queueName = binding.getQueueName() == null ? null : new AMQShortString(binding.getQueueName());
> -        _routingKey = binding.getRoutingKey() == null ? null : new AMQShortString(binding.getRoutingKey());
> +        _queueName = binding.getQueueName() == null ? null : binding.getQueueName();
> +        _routingKey = binding.getRoutingKey() == null ? null : binding.getRoutingKey();
>         _bindingKeys = binding.getBindingKeys() == null || binding.getBindingKeys().length == 0 ? new AMQShortString[0] : binding.getBindingKeys();
>     }
>
>
> Added: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/UTF8Test.java
> URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/UTF8Test.java?rev=706894&view=auto
> ==============================================================================
> --- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/UTF8Test.java (added)
> +++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/UTF8Test.java Wed Oct 22 01:17:06 2008
> @@ -0,0 +1,113 @@
> +/*
> + *
> + * 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.qpid.test.unit.message;
> +
> +import org.apache.qpid.test.utils.QpidTestCase;
> +import org.apache.qpid.transport.Connection;
> +import org.apache.qpid.transport.Session;
> +
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +import javax.naming.InitialContext;
> +import javax.jms.*;
> +import java.util.Properties;
> +
> +
> +/**
> + * @author Apache Software Foundation
> + *         This test makes sure that utf8 characters can be used for
> + *         specifying exchange, queue name and routing key.
> + *
> + * those tests are related to qpid-1384
> + */
> +public class UTF8Test extends QpidTestCase
> +{
> +    private static final Logger _logger = LoggerFactory.getLogger(UTF8Test.class);
> +
> +
> +    public void testPlainEn() throws Exception
> +    {
> +        runTest("exhangeName", "queueName", "routingkey", "data");
> +    }
> +
> +
> +    public void testUTF8Jp() throws Exception
> +    {
> +        runTest("設å(R)šã Œã  ã (R)ã‚ˆã †ã «æ§‹æˆ ã •ã‚Œã ¦ã „ã ªã 'れ㠰㠪", "çš„æŸ äº›æ›´æ–°æ²¡æœ‰å‡ºçŽ°åœ¨è¿™ä¸ª README ä¸­ã€‚ä½ å ¯ä»¥è(R)¿é—(R)ä¸‹é ¢çš„", "çš„å 'è¡Œç‰ˆæœ¬åŒ…æ‹¬å¤šå¼ å…‰ç›˜ï¼Œå…¶ä¸­åŒ…æ‹¬å(R)‰è£…光盘å'Œæº ç  å…‰ç›˜", "ç›(R)ã (R)インストール CD 㠯〠㠻㠨ã‚"ã (c)ã (R)最è¿'ã (R)シス");
> +    }
> +
> +    private void runTest(String exchangeName, String queueName, String routingKey, String data) throws Exception
> +    {
> +        _logger.info("Running test for exchange: " + exchangeName
> +                + " queue Name: " + queueName
> +                + " routing key: " + routingKey);
> +        declareQueue(exchangeName, routingKey, queueName);
> +
> +        javax.jms.Connection con =  getConnection();
> +        javax.jms.Session sess = con.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
> +        Destination dest = getDestination(exchangeName, routingKey, queueName);
> +        // Send data
> +        MessageProducer msgProd = sess.createProducer(dest);
> +        TextMessage message = sess.createTextMessage(data);
> +        msgProd.send(message);
> +        // consume data
> +        MessageConsumer msgCons = sess.createConsumer(dest);
> +        con.start();
> +        TextMessage m = (TextMessage) msgCons.receive(RECEIVE_TIMEOUT);
> +        assertNotNull(m);
> +        assertEquals(m.getText(), data);
> +    }
> +
> +    private void declareQueue(String exch, String routkey, String qname) throws Exception
> +    {
> +            Connection conn = new Connection();
> +            if (!_broker.equals(QpidTestCase.EXTERNAL) && !isBroker08())
> +            {
> +                conn.connect("localhost", 5672, "test", "guest", "guest");
> +            }
> +            else
> +            {
> +                throw new Exception("unsupported test " +
> +                        "configuration. broker: " + _broker + " version > 0.10 "+ !isBroker08() + " This test must be run on a local broker using protocol 0.10 or higher.");
> +            }
> +            Session sess = conn.createSession(0);
> +            sess.exchangeDeclare(exch, "direct", null, null);
> +            sess.queueDeclare(qname, null, null);
> +            sess.exchangeBind(qname, exch, routkey, null);
> +            sess.sync();
> +
> +            conn.close();
> +    }
> +
> +    private Destination getDestination(String exch, String routkey, String qname)
> +            throws Exception
> +    {
> +        Properties props = new Properties();
> +        props.setProperty("destination.directUTF8Queue",
> +                "direct://" + exch + "//" + qname + "?autodelete='false'&durable='false'"
> +                        + "&routingkey='" + routkey + "'");
> +
> +        // Get our connection context
> +        InitialContext ctx = new InitialContext(props);
> +        return (Destination) ctx.lookup("directUTF8Queue");
> +    }
> +}
>
> Modified: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
> URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java?rev=706894&r1=706893&r2=706894&view=diff
> ==============================================================================
> --- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java (original)
> +++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java Wed Oct 22 01:17:06 2008
> @@ -129,7 +129,7 @@
>
>     // values
>     protected static final String VM = "vm";
> -    private static final String EXTERNAL = "external";
> +    protected static final String EXTERNAL = "external";
>     private static final String VERSION_08 = "0-8";
>     private static final String VERSION_010 = "0-10";
>
>
>
>



-- 
Martin Ritchie