01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jboss.test.cmp2.jbas1665;
23:
24: import javax.naming.InitialContext;
25: import javax.naming.NamingException;
26: import org.jboss.test.JBossTestCase;
27: import org.jboss.test.util.ejb.EJBTestCase;
28: import junit.framework.Test;
29:
30: /**
31: * @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
32: * @version <tt>$Revision: 57211 $</tt>
33: */
34: public class JBAS1665UnitTestCase extends EJBTestCase {
35: public static Test suite() throws Exception {
36: return JBossTestCase.getDeploySetup(JBAS1665UnitTestCase.class,
37: "cmp2-jbas1665.jar");
38: }
39:
40: public JBAS1665UnitTestCase(String methodName) {
41: super (methodName);
42: }
43:
44: protected void setUp() throws Exception {
45: getOrderLocalHome().create(new Integer(1), "order");
46: }
47:
48: protected void tearDown() throws Exception {
49: getOrderLocalHome().remove(new Integer(1));
50: }
51:
52: // Tests
53:
54: public void testJBAS1665() throws Throwable {
55: java.util.Collection all = getOrderLocalHome().findAll();
56: assertEquals(1, all.size());
57: }
58:
59: public void testJBAS3095() throws Exception {
60: OrderLocalHome oh = getOrderLocalHome();
61: oh
62: .select(
63: "select object(o) from Order o where o.id > 0 order \t\n by o.id",
64: null);
65: oh.select("select object(o) from Order o order \n by o.id",
66: null);
67: oh.select(
68: "select object(byy) from Order byy order \n by byy.id",
69: null);
70: }
71:
72: // Private
73:
74: private OrderLocalHome getOrderLocalHome() throws NamingException {
75: return (OrderLocalHome) lookup(OrderLocalHome.JNDI_NAME);
76: }
77:
78: private Object lookup(String name) throws NamingException {
79: InitialContext ic = new InitialContext();
80: return ic.lookup(name);
81: }
82: }
|