Fix test failures

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@491857 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2007-01-02 17:26:32 +00:00
parent 61d56b290a
commit 207816b308
3 changed files with 43 additions and 8 deletions

View File

@ -92,17 +92,17 @@ public class JPAMessageStore implements MessageStore {
} }
public int getMessageCount() throws IOException { public int getMessageCount() throws IOException {
Integer rc; Long rc;
EntityManager manager = adapter.beginEntityManager(null); EntityManager manager = adapter.beginEntityManager(null);
try { try {
Query query = manager.createQuery("select count(m) from StoredMessage m"); Query query = manager.createQuery("select count(m) from StoredMessage m");
rc = (Integer) query.getSingleResult(); rc = (Long) query.getSingleResult();
} catch (Throwable e) { } catch (Throwable e) {
adapter.rollbackEntityManager(null,manager); adapter.rollbackEntityManager(null,manager);
throw IOExceptionSupport.create(e); throw IOExceptionSupport.create(e);
} }
adapter.commitEntityManager(null,manager); adapter.commitEntityManager(null,manager);
return rc; return rc.intValue();
} }
public String getMessageReference(MessageId identity) throws IOException { public String getMessageReference(MessageId identity) throws IOException {

View File

@ -123,7 +123,7 @@ public class JPATopicMessageStore extends JPAMessageStore implements TopicMessag
} }
public int getMessageCount(String clientId, String subscriptionName) throws IOException { public int getMessageCount(String clientId, String subscriptionName) throws IOException {
Integer rc; Long rc;
EntityManager manager = adapter.beginEntityManager(null); EntityManager manager = adapter.beginEntityManager(null);
try { try {
Query query = manager.createQuery( Query query = manager.createQuery(
@ -131,17 +131,17 @@ public class JPATopicMessageStore extends JPAMessageStore implements TopicMessag
"where ss.clientId=?1 " + "where ss.clientId=?1 " +
"and ss.subscriptionName=?2 " + "and ss.subscriptionName=?2 " +
"and ss.destination=?3 " + "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(1, clientId);
query.setParameter(2, subscriptionName); query.setParameter(2, subscriptionName);
query.setParameter(2, destinationName); query.setParameter(3, destinationName);
rc = (Integer) query.getSingleResult(); rc = (Long) query.getSingleResult();
} catch (Throwable e) { } catch (Throwable e) {
adapter.rollbackEntityManager(null,manager); adapter.rollbackEntityManager(null,manager);
throw IOExceptionSupport.create(e); throw IOExceptionSupport.create(e);
} }
adapter.commitEntityManager(null,manager); adapter.commitEntityManager(null,manager);
return rc; return rc.intValue();
} }
public SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException { public SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException {

View File

@ -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