Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 47247200BAE for ; Fri, 28 Oct 2016 19:32:30 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4581A160AE4; Fri, 28 Oct 2016 17:32:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 65904160ACA for ; Fri, 28 Oct 2016 19:32:29 +0200 (CEST) Received: (qmail 18117 invoked by uid 500); 28 Oct 2016 17:32:28 -0000 Mailing-List: contact jdo-commits-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-commits@db.apache.org Received: (qmail 18108 invoked by uid 99); 28 Oct 2016 17:32:28 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Oct 2016 17:32:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 2873EC13A4 for ; Fri, 28 Oct 2016 17:32:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.199 X-Spam-Level: X-Spam-Status: No, score=-1.199 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ZztcvQJFrjle for ; Fri, 28 Oct 2016 17:32:26 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 638AA5F23D for ; Fri, 28 Oct 2016 17:32:25 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 42061E0425 for ; Fri, 28 Oct 2016 17:32:23 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 4B67C3A0230 for ; Fri, 28 Oct 2016 17:32:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1767044 - in /db/jdo/trunk/tck/src: conf/query.conf java/org/apache/jdo/tck/pc/query/NamedQueriesSample.java java/org/apache/jdo/tck/query/api/NamedQueryRepeatableAnnotations.java Date: Fri, 28 Oct 2016 17:32:21 -0000 To: jdo-commits@db.apache.org From: andyj@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161028173222.4B67C3A0230@svn01-us-west.apache.org> archived-at: Fri, 28 Oct 2016 17:32:30 -0000 Author: andyj Date: Fri Oct 28 17:32:21 2016 New Revision: 1767044 URL: http://svn.apache.org/viewvc?rev=1767044&view=rev Log: JDO-757 apply test for use of @Repeatable annotations Added: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/NamedQueriesSample.java db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/api/NamedQueryRepeatableAnnotations.java Modified: db/jdo/trunk/tck/src/conf/query.conf Modified: db/jdo/trunk/tck/src/conf/query.conf URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/conf/query.conf?rev=1767044&r1=1767043&r2=1767044&view=diff ============================================================================== --- db/jdo/trunk/tck/src/conf/query.conf (original) +++ db/jdo/trunk/tck/src/conf/query.conf Fri Oct 28 17:32:21 2016 @@ -37,6 +37,7 @@ org.apache.jdo.tck.query.api.GetPersiste org.apache.jdo.tck.query.api.InvalidNamedQuery \ org.apache.jdo.tck.query.api.MetadataSearchOrder \ org.apache.jdo.tck.query.api.NamedQueryNotFound \ +org.apache.jdo.tck.query.api.NamedQueryRepeatableAnnotations \ org.apache.jdo.tck.query.api.NewNamedQuery \ org.apache.jdo.tck.query.api.NewQueryFromExistingQueryBoundToPMFromSameVendor \ org.apache.jdo.tck.query.api.NewQueryFromRestoredSerializedQuery \ Added: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/NamedQueriesSample.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/NamedQueriesSample.java?rev=1767044&view=auto ============================================================================== --- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/NamedQueriesSample.java (added) +++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/NamedQueriesSample.java Fri Oct 28 17:32:21 2016 @@ -0,0 +1,53 @@ +/* + * 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.jdo.tck.pc.query; + +import javax.jdo.annotations.Query; +import javax.jdo.annotations.PersistenceCapable; +import javax.jdo.annotations.PrimaryKey; + +import java.io.Serializable; + +/** + * Test for use of annotations, where we are relying on the Repeatable + * nature of the @Query annotation (java 8). + */ +@PersistenceCapable +@Query(name="NameIsJohn", value="SELECT FROM org.apache.jdo.tck.pc.query.NamedQueriesSample WHERE name == 'John'") +@Query(name="NameIsFred", value="SELECT FROM org.apache.jdo.tck.pc.query.NamedQueriesSample WHERE name == 'Fred'") +public class NamedQueriesSample implements Serializable { + @PrimaryKey + long id; + + String name; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} Added: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/api/NamedQueryRepeatableAnnotations.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/api/NamedQueryRepeatableAnnotations.java?rev=1767044&view=auto ============================================================================== --- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/api/NamedQueryRepeatableAnnotations.java (added) +++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/api/NamedQueryRepeatableAnnotations.java Fri Oct 28 17:32:21 2016 @@ -0,0 +1,64 @@ +/* + * 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.jdo.tck.query.api; + +import javax.jdo.Query; +import javax.jdo.JDOUserException; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.query.NamedQueriesSample; +import org.apache.jdo.tck.query.QueryTest; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: NamedQueryRepeatableAnnotations + *
+ *Keywords: query + *
+ *Assertion ID: Unknown + *
+ *Assertion Description: + * We test use of @Query where multiple have been defined in a class, so reliant on Java 8 @Repeatable. + */ +public class NamedQueryRepeatableAnnotations extends QueryTest { + + private static final String ASSERTION_FAILED = + "Assertion A19.?? (NamedQueryRepeatableAnnotations) failed: "; + + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(NamedQueryRepeatableAnnotations.class); + } + + /** */ + public void testPositive() { + try { + Query query = getPM().newNamedQuery(NamedQueriesSample.class, "NameIsJohn"); + } catch (JDOUserException e) { + fail(ASSERTION_FAILED + "Lookup of query failed but should have been found"); + } + try { + Query query = getPM().newNamedQuery(NamedQueriesSample.class, "NameIsFred"); + } catch (JDOUserException e) { + fail(ASSERTION_FAILED + "Lookup of query failed but should have been found"); + } + } +}