Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A07C410745 for ; Fri, 17 Jan 2014 15:21:08 +0000 (UTC) Received: (qmail 27049 invoked by uid 500); 17 Jan 2014 15:21:07 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 27008 invoked by uid 500); 17 Jan 2014 15:21:06 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 27001 invoked by uid 99); 17 Jan 2014 15:21:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jan 2014 15:21:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jan 2014 15:21:03 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F1A9723888FE; Fri, 17 Jan 2014 15:20:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1559141 - in /commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy: StaticMethodTest.java static-method.xml Date: Fri, 17 Jan 2014 15:20:41 -0000 To: commits@commons.apache.org From: ate@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140117152041.F1A9723888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ate Date: Fri Jan 17 15:20:41 2014 New Revision: 1559141 URL: http://svn.apache.org/r1559141 Log: SCXML-186: Groovy Expression evaluator support - adding simple static method test for Groovy (copied from jexl) Added: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/StaticMethodTest.java (with props) commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/static-method.xml (with props) Added: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/StaticMethodTest.java URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/StaticMethodTest.java?rev=1559141&view=auto ============================================================================== --- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/StaticMethodTest.java (added) +++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/StaticMethodTest.java Fri Jan 17 15:20:41 2014 @@ -0,0 +1,63 @@ +/* + * 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.commons.scxml2.env.groovy; + +import java.net.URL; +import java.util.Set; + +import org.apache.commons.scxml2.Context; +import org.apache.commons.scxml2.SCXMLExecutor; +import org.apache.commons.scxml2.SCXMLTestHelper; +import org.apache.commons.scxml2.model.TransitionTarget; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class StaticMethodTest { + + private URL staticmethod; + + /** + * Set up instance variables required by this test case. + */ + @Before + public void setUp() { + staticmethod = this.getClass().getClassLoader(). + getResource("org/apache/commons/scxml2/env/groovy/static-method.xml"); + } + + /** + * Tear down instance variables required by this test case. + */ + @After + public void tearDown() { + staticmethod = null; + } + + @Test + public void testGroovyStaticMethodInvocation() throws Exception { + Context jc = new GroovyContext(); + jc.set("System", System.class); + SCXMLExecutor exec = SCXMLTestHelper.getExecutor(staticmethod, + jc, new GroovyEvaluator()); + Set currentStates = exec.getCurrentStatus().getStates(); + Assert.assertEquals(1, currentStates.size()); + Assert.assertEquals("static", currentStates.iterator().next().getId()); + } + +} Propchange: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/StaticMethodTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/StaticMethodTest.java ------------------------------------------------------------------------------ svn:keywords = Id Added: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/static-method.xml URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/static-method.xml?rev=1559141&view=auto ============================================================================== --- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/static-method.xml (added) +++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/static-method.xml Fri Jan 17 15:20:41 2014 @@ -0,0 +1,32 @@ + + + + + + + + + + + + + Propchange: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/static-method.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/static-method.xml ------------------------------------------------------------------------------ svn:keywords = Id Propchange: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/static-method.xml ------------------------------------------------------------------------------ svn:mime-type = text/plain