@@ -0,0 +1,3107 @@
+/*%0A * eXist Open Source Native XML Database%0A * Copyright (C) 2001-2017 The eXist Project%0A * http://exist-db.org%0A *%0A * This program is free software; you can redistribute it and/or%0A * modify it under the terms of the GNU Lesser General Public License%0A * as published by the Free Software Foundation; either version 2%0A * of the License, or (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Lesser General Public License for more details.%0A *%0A * You should have received a copy of the GNU Lesser General Public%0A * License along with this library; if not, write to the Free Software%0A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA%0A */%0A%0Apackage org.exist.xquery;%0A%0Aimport org.exist.dom.QName;%0Aimport org.exist.xquery.value.FunctionReturnSequenceType;%0Aimport org.exist.xquery.value.Sequence;%0Aimport org.exist.xquery.value.SequenceType;%0Aimport org.exist.xquery.value.Type;%0A%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A/**%0A * Used by %7B@link CleanupTest%7D.%0A */%0Apublic class TestModule extends AbstractInternalModule %7B%0A%0A    private final static String MODULE_NS = %22http://exist-db.org/test%22;%0A%0A    private final static FunctionDef%5B%5D functions = %7B%0A            new FunctionDef(TestFunction.signature, TestFunction.class)%0A    %7D;%0A%0A    public TestModule(Map%3CString, List%3C?%3E%3E parameters) throws XPathException %7B%0A        super(functions, parameters);%0A    %7D%0A%0A    @Override%0A    public String getNamespaceURI() %7B%0A        return MODULE_NS;%0A    %7D%0A%0A    @Override%0A    public String getDefaultPrefix() %7B%0A        return %22t%22;%0A    %7D%0A%0A    @Override%0A    public String getDescription() %7B%0A        return null;%0A    %7D%0A%0A    @Override%0A    public String getReleaseVersion() %7B%0A        return null;%0A    %7D%0A%0A    public static class TestFunction extends BasicFunction %7B%0A%0A        public final static FunctionSignature signature =%0A                new FunctionSignature(%0A                        new QName(%22test%22, MODULE_NS),%0A                        %22Test function%22,%0A                        new SequenceType%5B%5D %7B%0A                        %7D,%0A                        new FunctionReturnSequenceType(Type.ITEM, Cardinality.ZERO_OR_ONE,%0A                                %22return value%22)%0A                );%0A%0A        // used to check if resetState is called on the function%0A        public boolean dummyProperty = false;%0A%0A        public TestFunction(XQueryContext context) %7B%0A            super(context, signature);%0A        %7D%0A%0A        @Override%0A        public Sequence eval(Sequence%5B%5D args, Sequence contextSequence) throws XPathException %7B%0A            dummyProperty = true;%0A            final Variable var = context.resolveVariable(new QName(%22VAR%22, MODULE_NS, %22t%22));%0A            return var.getValue();%0A        %7D%0A%0A        @Override%0A        public void resetState(boolean postOptimization) %7B%0A            super.resetState(postOptimization);%0A            if (!postOptimization) %7B%0A                dummyProperty = false;%0A            %7D%0A        %7D%0A    %7D%0A%7D

Add TestModule required by test