/* * Copyright 2013 Future Systems * * Licensed 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.araqne.logdb.query.parser; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import java.io.File; import org.araqne.logdb.QueryParseException; import org.araqne.logdb.QueryParserService; import org.araqne.logdb.impl.FunctionRegistryImpl; import org.araqne.logdb.query.engine.QueryParserServiceImpl; import org.junit.Before; import org.junit.Test; public class TextFileParserTest { private QueryParserService queryParserService; @Before public void setup() { QueryParserServiceImpl p = new QueryParserServiceImpl(); p.setFunctionRegistry(new FunctionRegistryImpl()); queryParserService = p; } @Test public void testError10700() { TextFileParser p = new TextFileParser(null); p.setQueryParserService(queryParserService); String query = "textfile " + File.separatorChar + "a" + File.separatorChar + "TextFile.txt"; try { p.parse(null, query); fail(); } catch (QueryParseException e) { if (e.isDebugMode()) { System.out.println("query " + query); System.out.println(e.getMessage()); } assertEquals("10700", e.getType()); assertEquals(9, e.getStartOffset()); assertEquals(23, e.getEndOffset()); } } }