01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.solr.core;
17:
18: import org.apache.solr.util.AbstractSolrTestCase;
19: import org.apache.solr.util.TestHarness;
20: import org.w3c.dom.Node;
21: import org.w3c.dom.NodeList;
22:
23: import javax.xml.xpath.XPathConstants;
24: import java.io.File;
25:
26: public class TestBadConfig extends AbstractSolrTestCase {
27:
28: public String getSchemaFile() {
29: return "schema.xml";
30: }
31:
32: public String getSolrConfigFile() {
33: return "bad_solrconfig.xml";
34: }
35:
36: public void setUp() throws Exception {
37:
38: dataDir = new File(System.getProperty("java.io.tmpdir")
39: + System.getProperty("file.separator")
40: + getClass().getName() + "-" + getName() + "-"
41: + System.currentTimeMillis());
42: dataDir.mkdirs();
43: try {
44: h = new TestHarness(dataDir.getAbsolutePath(),
45: getSolrConfigFile(), getSchemaFile());
46: fail("Exception should have been thrown");
47: } catch (Exception e) {
48: assertTrue(e.getMessage().contains("unset.sys.property"));
49: }
50: }
51:
52: public void testNothing() {
53: // Empty test case as the real test is that the initialization of the TestHarness fails
54: assertTrue(true);
55: }
56: }
|