Source Code Cross Referenced for SchemaSimpleTests.java in  » Search-Engine » compass-2.0 » org » compass » core » test » schema » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Search Engine » compass 2.0 » org.compass.core.test.schema 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.compass.core.test.schema;
002:
003:        import java.util.Map;
004:
005:        import junit.framework.TestCase;
006:        import org.compass.core.accessor.DirectPropertyAccessor;
007:        import org.compass.core.config.CompassConfiguration;
008:        import org.compass.core.config.CompassEnvironment;
009:        import org.compass.core.config.CompassSettings;
010:        import org.compass.core.engine.naming.DynamicPropertyNamingStrategy;
011:        import org.compass.core.lucene.LuceneEnvironment;
012:        import org.compass.core.lucene.engine.optimizer.NullOptimizer;
013:        import org.compass.core.lucene.engine.store.jdbc.C3P0DataSourceProvider;
014:        import org.compass.core.lucene.engine.store.jdbc.DbcpDataSourceProvider;
015:        import org.compass.core.lucene.engine.store.jdbc.DriverManagerDataSourceProvider;
016:        import org.compass.core.lucene.engine.store.jdbc.ExternalDataSourceProvider;
017:        import org.compass.core.lucene.engine.store.jdbc.JndiDataSourceProvider;
018:        import org.compass.core.transaction.JTASyncTransactionFactory;
019:        import org.compass.core.transaction.manager.JBoss;
020:
021:        /**
022:         * @author kimchy
023:         */
024:        public class SchemaSimpleTests extends TestCase {
025:
026:            public void testSimpleSchema() throws Exception {
027:                CompassConfiguration conf = new CompassConfiguration()
028:                        .configure("/org/compass/core/test/schema/simple.cfg.xml");
029:
030:                CompassSettings settings = conf.getSettings();
031:
032:                assertEquals("default", settings
033:                        .getSetting(CompassEnvironment.NAME));
034:                assertEquals("file://target/test-index", settings
035:                        .getSetting(CompassEnvironment.CONNECTION));
036:            }
037:
038:            public void testLocalCacheSettings() {
039:                CompassConfiguration conf = new CompassConfiguration()
040:                        .configure("/org/compass/core/test/schema/localcache.cfg.xml");
041:
042:                CompassSettings settings = conf.getSettings();
043:                assertEquals(
044:                        "ram://",
045:                        settings
046:                                .getSetting(LuceneEnvironment.LocalCache.PREFIX
047:                                        + "."
048:                                        + LuceneEnvironment.LocalCache.DEFAULT_NAME
049:                                        + "."
050:                                        + LuceneEnvironment.LocalCache.CONNECTION));
051:                assertEquals("file://", settings
052:                        .getSetting(LuceneEnvironment.LocalCache.PREFIX + ".a."
053:                                + LuceneEnvironment.LocalCache.CONNECTION));
054:            }
055:
056:            public void testIndexDeletionPolicyKeepLastCommit() {
057:                CompassConfiguration conf = new CompassConfiguration()
058:                        .configure("/org/compass/core/test/schema/idp-keeplastcommit.cfg.xml");
059:
060:                CompassSettings settings = conf.getSettings();
061:                assertEquals(
062:                        LuceneEnvironment.IndexDeletionPolicy.KeepLastCommit.NAME,
063:                        settings
064:                                .getSetting(LuceneEnvironment.IndexDeletionPolicy.TYPE));
065:            }
066:
067:            public void testIndexDeletionPolicyKeepAll() {
068:                CompassConfiguration conf = new CompassConfiguration()
069:                        .configure("/org/compass/core/test/schema/idp-keepall.cfg.xml");
070:
071:                CompassSettings settings = conf.getSettings();
072:                assertEquals(
073:                        LuceneEnvironment.IndexDeletionPolicy.KeepAll.NAME,
074:                        settings
075:                                .getSetting(LuceneEnvironment.IndexDeletionPolicy.TYPE));
076:            }
077:
078:            public void testIndexDeletionPolicyKeepNoneOnInit() {
079:                CompassConfiguration conf = new CompassConfiguration()
080:                        .configure("/org/compass/core/test/schema/idp-keepnoneoninit.cfg.xml");
081:
082:                CompassSettings settings = conf.getSettings();
083:                assertEquals(
084:                        LuceneEnvironment.IndexDeletionPolicy.KeepNoneOnInit.NAME,
085:                        settings
086:                                .getSetting(LuceneEnvironment.IndexDeletionPolicy.TYPE));
087:            }
088:
089:            public void testIndexDeletionPolicyExpirationTime() {
090:                CompassConfiguration conf = new CompassConfiguration()
091:                        .configure("/org/compass/core/test/schema/idp-expirationtime.cfg.xml");
092:
093:                CompassSettings settings = conf.getSettings();
094:                assertEquals(
095:                        LuceneEnvironment.IndexDeletionPolicy.ExpirationTime.NAME,
096:                        settings
097:                                .getSetting(LuceneEnvironment.IndexDeletionPolicy.TYPE));
098:                assertEquals(
099:                        "10",
100:                        settings
101:                                .getSetting(LuceneEnvironment.IndexDeletionPolicy.ExpirationTime.EXPIRATION_TIME_IN_SECONDS));
102:            }
103:
104:            public void testIndexDeletionPolicyKeepLastN() {
105:                CompassConfiguration conf = new CompassConfiguration()
106:                        .configure("/org/compass/core/test/schema/idp-keeplastn.cfg.xml");
107:
108:                CompassSettings settings = conf.getSettings();
109:                assertEquals(
110:                        LuceneEnvironment.IndexDeletionPolicy.KeepLastN.NAME,
111:                        settings
112:                                .getSetting(LuceneEnvironment.IndexDeletionPolicy.TYPE));
113:                assertEquals(
114:                        "10",
115:                        settings
116:                                .getSetting(LuceneEnvironment.IndexDeletionPolicy.KeepLastN.NUM_TO_KEEP));
117:            }
118:
119:            public void testLockFactory() throws Exception {
120:                CompassConfiguration conf = new CompassConfiguration()
121:                        .configure("/org/compass/core/test/schema/lockfactory.cfg.xml");
122:
123:                CompassSettings settings = conf.getSettings();
124:
125:                assertEquals("nativefs", settings
126:                        .getSetting(LuceneEnvironment.LockFactory.TYPE));
127:                assertEquals("test/#subindex#", settings
128:                        .getSetting(LuceneEnvironment.LockFactory.PATH));
129:            }
130:
131:            public void testRamTransLog() throws Exception {
132:                CompassConfiguration conf = new CompassConfiguration()
133:                        .configure("/org/compass/core/test/schema/ramtranslog.cfg.xml");
134:
135:                CompassSettings settings = conf.getSettings();
136:
137:                assertEquals(
138:                        "ram://",
139:                        settings
140:                                .getSetting(LuceneEnvironment.Transaction.ReadCommittedTransLog.CONNECTION));
141:                assertEquals(
142:                        "true",
143:                        settings
144:                                .getSetting(LuceneEnvironment.Transaction.ReadCommittedTransLog.OPTIMIZE_TRANS_LOG));
145:            }
146:
147:            public void testFsTransLog() throws Exception {
148:                CompassConfiguration conf = new CompassConfiguration()
149:                        .configure("/org/compass/core/test/schema/fstranslog.cfg.xml");
150:
151:                CompassSettings settings = conf.getSettings();
152:
153:                assertEquals(
154:                        "file://",
155:                        settings
156:                                .getSetting(LuceneEnvironment.Transaction.ReadCommittedTransLog.CONNECTION));
157:                assertEquals(
158:                        "false",
159:                        settings
160:                                .getSetting(LuceneEnvironment.Transaction.ReadCommittedTransLog.OPTIMIZE_TRANS_LOG));
161:            }
162:
163:            public void testQueryParser() throws Exception {
164:                CompassConfiguration conf = new CompassConfiguration()
165:                        .configure("/org/compass/core/test/schema/queryParser.cfg.xml");
166:
167:                CompassSettings settings = conf.getSettings();
168:
169:                Map groupSettings = settings
170:                        .getSettingGroups(LuceneEnvironment.QueryParser.PREFIX);
171:                assertEquals(1, groupSettings.size());
172:                settings = (CompassSettings) groupSettings.get("test");
173:                assertNotNull(settings);
174:                assertEquals("eg.QueryParser", settings
175:                        .getSetting(LuceneEnvironment.QueryParser.TYPE));
176:                assertEquals("value1", settings.getSetting("param1"));
177:            }
178:
179:            public void testOsem() throws Exception {
180:                CompassConfiguration conf = new CompassConfiguration()
181:                        .configure("/org/compass/core/test/schema/osem.cfg.xml");
182:
183:                CompassSettings settings = conf.getSettings();
184:
185:                assertEquals("false", settings
186:                        .getSetting(CompassEnvironment.Osem.SUPPORT_UNMARSHALL));
187:                assertEquals("tokenized", settings
188:                        .getSetting(CompassEnvironment.Osem.MANAGED_ID_INDEX));
189:            }
190:
191:            public void testLocking() throws Exception {
192:                CompassConfiguration conf = new CompassConfiguration()
193:                        .configure("/org/compass/core/test/schema/locking.cfg.xml");
194:
195:                CompassSettings settings = conf.getSettings();
196:
197:                assertEquals("15", settings
198:                        .getSetting(LuceneEnvironment.Transaction.LOCK_TIMEOUT));
199:                assertEquals(
200:                        "200",
201:                        settings
202:                                .getSetting(LuceneEnvironment.Transaction.LOCK_POLL_INTERVAL));
203:            }
204:
205:            public void testOptimizer() throws Exception {
206:                CompassConfiguration conf = new CompassConfiguration()
207:                        .configure("/org/compass/core/test/schema/optimizer.cfg.xml");
208:
209:                CompassSettings settings = conf.getSettings();
210:
211:                assertEquals(NullOptimizer.class.getName(), settings
212:                        .getSetting(LuceneEnvironment.Optimizer.TYPE));
213:                assertEquals("true", settings
214:                        .getSetting(LuceneEnvironment.Optimizer.SCHEDULE));
215:                assertEquals(
216:                        "90",
217:                        settings
218:                                .getSetting(LuceneEnvironment.Optimizer.SCHEDULE_PERIOD));
219:            }
220:
221:            public void testDirectoryWrapperProvider() throws Exception {
222:                CompassConfiguration conf = new CompassConfiguration()
223:                        .configure("/org/compass/core/test/schema/wrapper-connection.cfg.xml");
224:
225:                CompassSettings settings = conf.getSettings();
226:                assertEquals("eg.DWPImpl", settings
227:                        .getSetting(LuceneEnvironment.DirectoryWrapper.PREFIX
228:                                + ".test."
229:                                + LuceneEnvironment.DirectoryWrapper.TYPE));
230:                assertEquals("value1", settings
231:                        .getSetting(LuceneEnvironment.DirectoryWrapper.PREFIX
232:                                + ".test.setting1"));
233:            }
234:
235:            public void testRamConnectionSchema() throws Exception {
236:                CompassConfiguration conf = new CompassConfiguration()
237:                        .configure("/org/compass/core/test/schema/ram-connection.cfg.xml");
238:
239:                CompassSettings settings = conf.getSettings();
240:
241:                assertEquals("default", settings
242:                        .getSetting(CompassEnvironment.NAME));
243:                assertEquals("ram://target/test-index", settings
244:                        .getSetting(CompassEnvironment.CONNECTION));
245:            }
246:
247:            public void testMmapConnectionSchema() throws Exception {
248:                CompassConfiguration conf = new CompassConfiguration()
249:                        .configure("/org/compass/core/test/schema/mmap-connection.cfg.xml");
250:
251:                CompassSettings settings = conf.getSettings();
252:
253:                assertEquals("default", settings
254:                        .getSetting(CompassEnvironment.NAME));
255:                assertEquals("mmap://target/test-index", settings
256:                        .getSetting(CompassEnvironment.CONNECTION));
257:            }
258:
259:            public void testPropertiesSchema() throws Exception {
260:                CompassConfiguration conf = new CompassConfiguration()
261:                        .configure("/org/compass/core/test/schema/properties.cfg.xml");
262:
263:                CompassSettings settings = conf.getSettings();
264:                assertEquals("alias1", settings
265:                        .getSetting(CompassEnvironment.Alias.NAME));
266:                assertEquals("all1", settings
267:                        .getSetting(CompassEnvironment.All.NAME));
268:                assertEquals("yes", settings
269:                        .getSetting(CompassEnvironment.All.TERM_VECTOR));
270:            }
271:
272:            public void testPropertyNamingStrategySchema() throws Exception {
273:                CompassConfiguration conf = new CompassConfiguration()
274:                        .configure("/org/compass/core/test/schema/propertyNamingStrategy.cfg.xml");
275:
276:                CompassSettings settings = conf.getSettings();
277:                assertEquals(
278:                        DynamicPropertyNamingStrategy.class.getName(),
279:                        settings
280:                                .getSetting(CompassEnvironment.NamingStrategy.TYPE));
281:            }
282:
283:            public void testJtaSchema() throws Exception {
284:                CompassConfiguration conf = new CompassConfiguration()
285:                        .configure("/org/compass/core/test/schema/jta.cfg.xml");
286:
287:                CompassSettings settings = conf.getSettings();
288:                assertEquals(
289:                        JTASyncTransactionFactory.class.getName(),
290:                        settings
291:                                .getSetting(CompassEnvironment.Transaction.FACTORY));
292:                assertEquals(
293:                        "true",
294:                        settings
295:                                .getSetting(CompassEnvironment.Transaction.COMMIT_BEFORE_COMPLETION));
296:                assertEquals(
297:                        JBoss.class.getName(),
298:                        settings
299:                                .getSetting(CompassEnvironment.Transaction.MANAGER_LOOKUP));
300:            }
301:
302:            public void testJdbcDriverManagerSchema() throws Exception {
303:                CompassConfiguration conf = new CompassConfiguration()
304:                        .configure("/org/compass/core/test/schema/jdbc-drivermanager.cfg.xml");
305:
306:                CompassSettings settings = conf.getSettings();
307:                assertEquals("true", settings
308:                        .getSetting(LuceneEnvironment.JdbcStore.MANAGED));
309:                assertEquals(
310:                        DriverManagerDataSourceProvider.class.getName(),
311:                        settings
312:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.CLASS));
313:                assertEquals(
314:                        "testusername",
315:                        settings
316:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.USERNAME));
317:                assertEquals(
318:                        "testpassword",
319:                        settings
320:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.PASSWORD));
321:                assertEquals(
322:                        "testDriverClass",
323:                        settings
324:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.DRIVER_CLASS));
325:                assertEquals("jdbc://testurl", settings
326:                        .getSetting(CompassEnvironment.CONNECTION));
327:            }
328:
329:            public void testJdbcDbcp() throws Exception {
330:                CompassConfiguration conf = new CompassConfiguration()
331:                        .configure("/org/compass/core/test/schema/jdbc-dbcp.cfg.xml");
332:
333:                CompassSettings settings = conf.getSettings();
334:                assertEquals("true", settings
335:                        .getSetting(LuceneEnvironment.JdbcStore.MANAGED));
336:                assertEquals(
337:                        "true",
338:                        settings
339:                                .getSetting(LuceneEnvironment.JdbcStore.DISABLE_SCHEMA_OPERATIONS));
340:                assertEquals(
341:                        DbcpDataSourceProvider.class.getName(),
342:                        settings
343:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.CLASS));
344:                assertEquals(
345:                        "testusername",
346:                        settings
347:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.USERNAME));
348:                assertEquals(
349:                        "testpassword",
350:                        settings
351:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.PASSWORD));
352:                assertEquals(
353:                        "testDriverClass",
354:                        settings
355:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.DRIVER_CLASS));
356:                assertEquals("jdbc://testurl", settings
357:                        .getSetting(CompassEnvironment.CONNECTION));
358:                assertEquals(
359:                        "10",
360:                        settings
361:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_ACTIVE));
362:                assertEquals(
363:                        "5",
364:                        settings
365:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_WAIT));
366:                assertEquals(
367:                        "2",
368:                        settings
369:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_IDLE));
370:                assertEquals(
371:                        "3",
372:                        settings
373:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.INITIAL_SIZE));
374:                assertEquals(
375:                        "4",
376:                        settings
377:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MIN_IDLE));
378:                assertEquals(
379:                        "true",
380:                        settings
381:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.POOL_PREPARED_STATEMENTS));
382:                assertEquals(
383:                        "2",
384:                        settings
385:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.DEFAULT_TRANSACTION_ISOLATION));
386:            }
387:
388:            public void testJdbcC3p0() throws Exception {
389:                CompassConfiguration conf = new CompassConfiguration()
390:                        .configure("/org/compass/core/test/schema/jdbc-c3p0.cfg.xml");
391:
392:                CompassSettings settings = conf.getSettings();
393:                assertEquals("true", settings
394:                        .getSetting(LuceneEnvironment.JdbcStore.MANAGED));
395:                assertEquals(
396:                        "true",
397:                        settings
398:                                .getSetting(LuceneEnvironment.JdbcStore.DISABLE_SCHEMA_OPERATIONS));
399:                assertEquals(
400:                        C3P0DataSourceProvider.class.getName(),
401:                        settings
402:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.CLASS));
403:                assertEquals(
404:                        "testusername",
405:                        settings
406:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.USERNAME));
407:                assertEquals(
408:                        "testpassword",
409:                        settings
410:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.PASSWORD));
411:                assertEquals(
412:                        "testDriverClass",
413:                        settings
414:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.DRIVER_CLASS));
415:                assertEquals("jdbc://testurl", settings
416:                        .getSetting(CompassEnvironment.CONNECTION));
417:            }
418:
419:            public void testJdbcJndiSchema() throws Exception {
420:                CompassConfiguration conf = new CompassConfiguration()
421:                        .configure("/org/compass/core/test/schema/jdbc-jndi.cfg.xml");
422:
423:                CompassSettings settings = conf.getSettings();
424:                assertEquals("false", settings
425:                        .getSetting(LuceneEnvironment.JdbcStore.MANAGED));
426:                assertEquals(
427:                        JndiDataSourceProvider.class.getName(),
428:                        settings
429:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.CLASS));
430:                assertEquals(
431:                        "testusername",
432:                        settings
433:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.USERNAME));
434:                assertEquals(
435:                        "testpassword",
436:                        settings
437:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.PASSWORD));
438:                assertEquals("jdbc://testds", settings
439:                        .getSetting(CompassEnvironment.CONNECTION));
440:            }
441:
442:            public void testJdbcExternalSchema() throws Exception {
443:                CompassConfiguration conf = new CompassConfiguration()
444:                        .configure("/org/compass/core/test/schema/jdbc-external.cfg.xml");
445:
446:                CompassSettings settings = conf.getSettings();
447:                assertEquals("false", settings
448:                        .getSetting(LuceneEnvironment.JdbcStore.MANAGED));
449:                assertEquals(
450:                        ExternalDataSourceProvider.class.getName(),
451:                        settings
452:                                .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.CLASS));
453:                assertEquals(
454:                        "testusername",
455:                        settings
456:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.USERNAME));
457:                assertEquals(
458:                        "testpassword",
459:                        settings
460:                                .getSetting(LuceneEnvironment.JdbcStore.Connection.PASSWORD));
461:                assertEquals("jdbc://", settings
462:                        .getSetting(CompassEnvironment.CONNECTION));
463:            }
464:
465:            public void testJdbcFESchema() throws Exception {
466:                CompassConfiguration conf = new CompassConfiguration()
467:                        .configure("/org/compass/core/test/schema/jdbc-fe.cfg.xml");
468:
469:                CompassSettings settings = conf.getSettings();
470:                String defaultPrefix = LuceneEnvironment.JdbcStore.FileEntry.PREFIX
471:                        + ".__default__.";
472:                assertEquals(
473:                        "4096",
474:                        settings
475:                                .getSetting(defaultPrefix
476:                                        + LuceneEnvironment.JdbcStore.FileEntry.INDEX_INPUT_BUFFER_SIZE));
477:                assertEquals(
478:                        "4096",
479:                        settings
480:                                .getSetting(defaultPrefix
481:                                        + LuceneEnvironment.JdbcStore.FileEntry.INDEX_OUTPUT_BUFFER_SIZE));
482:            }
483:
484:            public void testJdbcDDLSchema() throws Exception {
485:                CompassConfiguration conf = new CompassConfiguration()
486:                        .configure("/org/compass/core/test/schema/jdbc-ddl.cfg.xml");
487:
488:                CompassSettings settings = conf.getSettings();
489:                assertEquals("myname", settings
490:                        .getSetting(LuceneEnvironment.JdbcStore.DDL.NAME_NAME));
491:                assertEquals(
492:                        "70",
493:                        settings
494:                                .getSetting(LuceneEnvironment.JdbcStore.DDL.NAME_LENGTH));
495:                assertEquals("mysize", settings
496:                        .getSetting(LuceneEnvironment.JdbcStore.DDL.SIZE_NAME));
497:            }
498:
499:            public void testConvertersSchema() throws Exception {
500:                CompassConfiguration conf = new CompassConfiguration()
501:                        .configure("/org/compass/core/test/schema/converters.cfg.xml");
502:
503:                CompassSettings settings = conf.getSettings();
504:                Map groupSettings = settings
505:                        .getSettingGroups(CompassEnvironment.Converter.PREFIX);
506:                assertEquals(2, groupSettings.size());
507:                settings = (CompassSettings) groupSettings.get("date");
508:                assertNotNull(settings);
509:                assertEquals("yyyy-MM-dd", settings.getSetting("format"));
510:                settings = (CompassSettings) groupSettings.get("myConverter");
511:                assertNotNull(settings);
512:            }
513:
514:            public void testPropertyAcessorsSchema() throws Exception {
515:                CompassConfiguration conf = new CompassConfiguration()
516:                        .configure("/org/compass/core/test/schema/property-accessors.cfg.xml");
517:
518:                CompassSettings settings = conf.getSettings();
519:                Map groupSettings = settings
520:                        .getSettingGroups(CompassEnvironment.PropertyAccessor.PREFIX);
521:                assertEquals(1, groupSettings.size());
522:                settings = (CompassSettings) groupSettings.get("myType");
523:                assertNotNull(settings);
524:                assertEquals(DirectPropertyAccessor.class.getName(), settings
525:                        .getSetting("type"));
526:                assertEquals("value", settings.getSetting("test"));
527:            }
528:
529:            public void testAnalyzersSchema() throws Exception {
530:                CompassConfiguration conf = new CompassConfiguration()
531:                        .configure("/org/compass/core/test/schema/analyzers.cfg.xml");
532:
533:                CompassSettings settings = conf.getSettings();
534:                Map groupSettings = settings
535:                        .getSettingGroups(LuceneEnvironment.Analyzer.PREFIX);
536:                assertEquals(1, groupSettings.size());
537:                settings = (CompassSettings) groupSettings.get("test");
538:                assertNotNull(settings);
539:                assertEquals("Snowball", settings
540:                        .getSetting(LuceneEnvironment.Analyzer.TYPE));
541:                assertEquals(
542:                        "Lovins",
543:                        settings
544:                                .getSetting(LuceneEnvironment.Analyzer.Snowball.NAME_TYPE));
545:                assertEquals("+test,", settings
546:                        .getSetting(LuceneEnvironment.Analyzer.STOPWORDS));
547:
548:                settings = conf.getSettings();
549:                groupSettings = settings
550:                        .getSettingGroups(LuceneEnvironment.AnalyzerFilter.PREFIX);
551:                assertEquals(1, groupSettings.size());
552:                settings = (CompassSettings) groupSettings.get("test");
553:                assertNotNull(settings);
554:                assertEquals("org.compass.test.Test", settings
555:                        .getSetting(LuceneEnvironment.AnalyzerFilter.TYPE));
556:                assertEquals("setValue", settings.getSetting("setName"));
557:            }
558:
559:            public void testHighlightersSchema() throws Exception {
560:                CompassConfiguration conf = new CompassConfiguration()
561:                        .configure("/org/compass/core/test/schema/highlighters.cfg.xml");
562:
563:                CompassSettings settings = conf.getSettings();
564:                Map groupSettings = settings
565:                        .getSettingGroups(LuceneEnvironment.Highlighter.PREFIX);
566:                assertEquals(1, groupSettings.size());
567:                settings = (CompassSettings) groupSettings.get("test1");
568:                assertNotNull(settings);
569:                assertEquals(
570:                        LuceneEnvironment.Highlighter.Fragmenter.TYPE_SIMPLE,
571:                        settings
572:                                .getSetting(LuceneEnvironment.Highlighter.Fragmenter.TYPE));
573:                assertEquals(
574:                        90,
575:                        settings
576:                                .getSettingAsInt(
577:                                        LuceneEnvironment.Highlighter.Fragmenter.SIMPLE_SIZE,
578:                                        0));
579:                assertEquals(
580:                        LuceneEnvironment.Highlighter.Encoder.HTML,
581:                        settings
582:                                .getSetting(LuceneEnvironment.Highlighter.Encoder.TYPE));
583:                assertEquals(
584:                        LuceneEnvironment.Highlighter.Formatter.SIMPLE,
585:                        settings
586:                                .getSetting(LuceneEnvironment.Highlighter.Formatter.TYPE));
587:                assertEquals(
588:                        "<tag>",
589:                        settings
590:                                .getSetting(LuceneEnvironment.Highlighter.Formatter.SIMPLE_PRE_HIGHLIGHT));
591:                assertEquals(
592:                        "</tag>",
593:                        settings
594:                                .getSetting(LuceneEnvironment.Highlighter.Formatter.SIMPLE_POST_HIGHLIGHT));
595:            }
596:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.