From 207816b308b0c3cda78a365764ef3dc9a0878a6b Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Tue, 2 Jan 2007 17:26:32 +0000 Subject: [PATCH] Fix test failures git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@491857 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/store/jpa/JPAMessageStore.java | 6 ++-- .../store/jpa/JPATopicMessageStore.java | 10 +++--- .../src/test/resources/log4j.properties | 35 +++++++++++++++++++ 3 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 activemq-jpa-store/src/test/resources/log4j.properties diff --git a/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPAMessageStore.java b/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPAMessageStore.java index c4226aaf51..705a297d41 100644 --- a/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPAMessageStore.java +++ b/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPAMessageStore.java @@ -92,17 +92,17 @@ public class JPAMessageStore implements MessageStore { } public int getMessageCount() throws IOException { - Integer rc; + Long rc; EntityManager manager = adapter.beginEntityManager(null); try { Query query = manager.createQuery("select count(m) from StoredMessage m"); - rc = (Integer) query.getSingleResult(); + rc = (Long) query.getSingleResult(); } catch (Throwable e) { adapter.rollbackEntityManager(null,manager); throw IOExceptionSupport.create(e); } adapter.commitEntityManager(null,manager); - return rc; + return rc.intValue(); } public String getMessageReference(MessageId identity) throws IOException { diff --git a/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPATopicMessageStore.java b/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPATopicMessageStore.java index 89f9032e23..0633fb7d42 100644 --- a/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPATopicMessageStore.java +++ b/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPATopicMessageStore.java @@ -123,7 +123,7 @@ public class JPATopicMessageStore extends JPAMessageStore implements TopicMessag } public int getMessageCount(String clientId, String subscriptionName) throws IOException { - Integer rc; + Long rc; EntityManager manager = adapter.beginEntityManager(null); try { Query query = manager.createQuery( @@ -131,17 +131,17 @@ public class JPATopicMessageStore extends JPAMessageStore implements TopicMessag "where ss.clientId=?1 " + "and ss.subscriptionName=?2 " + "and ss.destination=?3 " + - "and m.desination=ss.destination and m.id > ss.lastAckedId"); + "and m.destination=ss.destination and m.id > ss.lastAckedId"); query.setParameter(1, clientId); query.setParameter(2, subscriptionName); - query.setParameter(2, destinationName); - rc = (Integer) query.getSingleResult(); + query.setParameter(3, destinationName); + rc = (Long) query.getSingleResult(); } catch (Throwable e) { adapter.rollbackEntityManager(null,manager); throw IOExceptionSupport.create(e); } adapter.commitEntityManager(null,manager); - return rc; + return rc.intValue(); } public SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException { diff --git a/activemq-jpa-store/src/test/resources/log4j.properties b/activemq-jpa-store/src/test/resources/log4j.properties new file mode 100644 index 0000000000..319937a275 --- /dev/null +++ b/activemq-jpa-store/src/test/resources/log4j.properties @@ -0,0 +1,35 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +# +# The logging properties used during tests.. +# +log4j.rootLogger=INFO, out + +log4j.logger.org.apache.activemq.spring=WARN + +# CONSOLE appender not used by default +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n + +# File appender +log4j.appender.out=org.apache.log4j.FileAppender +log4j.appender.out.layout=org.apache.log4j.PatternLayout +log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n +log4j.appender.out.file=target/activemq-test.log +log4j.appender.out.append=true