01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.compass.core.test.analyzer;
18:
19: import junit.framework.TestCase;
20:
21: import org.compass.core.config.CompassConfiguration;
22: import org.compass.core.config.CompassSettings;
23: import org.compass.core.lucene.LuceneEnvironment;
24: import org.compass.core.mapping.InvalidMappingException;
25: import org.compass.core.test.AbstractTestCase;
26:
27: /**
28: *
29: * @author shayb
30: *
31: */
32: public class InvalidAnalyzerTests extends TestCase {
33:
34: private void addSettings(CompassSettings settings) {
35: settings
36: .setGroupSettings(
37: LuceneEnvironment.Analyzer.PREFIX,
38: "simple",
39: new String[] { LuceneEnvironment.Analyzer.TYPE },
40: new String[] { LuceneEnvironment.Analyzer.CoreTypes.SIMPLE });
41: settings
42: .setGroupSettings(
43: LuceneEnvironment.Analyzer.PREFIX,
44: LuceneEnvironment.Analyzer.SEARCH_GROUP,
45: new String[] { LuceneEnvironment.Analyzer.TYPE },
46: new String[] { LuceneEnvironment.Analyzer.CoreTypes.SIMPLE });
47: }
48:
49: public void testInvalidResourceAnalyzer() {
50: CompassConfiguration conf = new CompassConfiguration()
51: .configure("/org/compass/core/test/compass.cfg.xml");
52: addSettings(conf.getSettings());
53: conf.addResource(
54: "org/compass/core/test/analyzer/invalid-osem.cpm.xml",
55: AbstractTestCase.class.getClassLoader());
56: try {
57: conf.buildCompass();
58: fail();
59: } catch (InvalidMappingException e) {
60:
61: }
62: }
63:
64: }
|