Source Code Cross Referenced for AbstractEngineTests.java in  » Search-Engine » compass-2.0 » org » compass » core » engine » 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.engine 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004-2006 the original author or authors.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.compass.core.engine;
018:
019:        import junit.framework.TestCase;
020:        import org.compass.core.Property;
021:        import org.compass.core.Resource;
022:        import org.compass.core.ResourceFactory;
023:        import org.compass.core.config.CompassSettings;
024:        import org.compass.core.engine.naming.StaticPropertyPath;
025:        import org.compass.core.mapping.CompassMapping;
026:        import org.compass.core.mapping.ResourceMapping;
027:        import org.compass.core.mapping.ResourcePropertyMapping;
028:        import org.compass.core.spi.InternalResource;
029:
030:        /**
031:         * @author kimchy
032:         */
033:        public abstract class AbstractEngineTests extends TestCase {
034:
035:            public static final String PROPERTY_ID1 = "id1";
036:
037:            public static final String PROPERTY_ID2 = "id2";
038:
039:            public static final String PROPERTY_ID3 = "id3";
040:
041:            public static final String VALUE_ID1 = "id1value";
042:
043:            public static final String VALUE_ID2 = "id2value";
044:
045:            public static final String VALUE_ID3 = "id3value";
046:
047:            public static final String VALUE_ID1_2 = "id1value_2";
048:
049:            public static final String VALUE_ID2_2 = "id2value_2";
050:
051:            public static final String VALUE_ID3_2 = "id3value_2";
052:
053:            public static final String PROPERTY_VAL1 = "val1";
054:
055:            public static final String PROPERTY_VAL2 = "val2";
056:
057:            public static final String PROPERTY_VAL3 = "val3";
058:
059:            public static final String PROPERTY_VAL4 = "val4";
060:
061:            public static final String VALUE_VAL1 = "val1value";
062:
063:            public static final String VALUE_VAL2 = "val2value";
064:
065:            public static final String VALUE_VAL3 = "val3value";
066:
067:            public static final String VALUE_VAL4 = "val4value";
068:
069:            public static final String ALIAS_SINGLE = "singleid";
070:
071:            public static final String ALIAS_MUTLI = "multiid";
072:
073:            private CompassSettings settings;
074:
075:            private CompassMapping mapping;
076:
077:            public CompassSettings getSettings() {
078:                return settings;
079:            }
080:
081:            public CompassMapping getMapping() {
082:                return this .mapping;
083:            }
084:
085:            protected CompassMapping buildCompassMapping() {
086:                ResourcePropertyMapping id1 = new MockPropertyMapping(
087:                        PROPERTY_ID1, new StaticPropertyPath(PROPERTY_ID1));
088:                ResourcePropertyMapping id2 = new MockPropertyMapping(
089:                        PROPERTY_ID2, new StaticPropertyPath(PROPERTY_ID2));
090:                ResourcePropertyMapping id3 = new MockPropertyMapping(
091:                        PROPERTY_ID3, new StaticPropertyPath(PROPERTY_ID3));
092:
093:                //        PropertyMapping val1 = new MockPropertyMapping(PROPERTY_VAL1, PROPERTY_VAL1);
094:                //        PropertyMapping val2 = new MockPropertyMapping(PROPERTY_VAL2, PROPERTY_VAL2);
095:                //        PropertyMapping val3 = new MockPropertyMapping(PROPERTY_VAL3, PROPERTY_VAL3);
096:                //        PropertyMapping val4 = new MockPropertyMapping(PROPERTY_VAL4, PROPERTY_VAL4);
097:
098:                ResourceMapping singleIdMapping = new MockResourceMapping(
099:                        ALIAS_SINGLE);
100:                ((MockResourceMapping) singleIdMapping).addId(id1);
101:
102:                ResourceMapping multipleIdMapping = new MockResourceMapping(
103:                        ALIAS_MUTLI);
104:                ((MockResourceMapping) multipleIdMapping).addId(id2);
105:                ((MockResourceMapping) multipleIdMapping).addId(id3);
106:
107:                CompassMapping mapping = new CompassMapping();
108:                mapping.addMapping(singleIdMapping);
109:                mapping.addMapping(multipleIdMapping);
110:
111:                return mapping;
112:            }
113:
114:            protected void setUp() throws Exception {
115:                super .setUp();
116:                buildCompassSettings();
117:                mapping = buildCompassMapping();
118:            }
119:
120:            protected void tearDown() throws Exception {
121:                super .tearDown();
122:            }
123:
124:            protected CompassSettings buildCompassSettings() {
125:                settings = new CompassSettings();
126:                return settings;
127:            }
128:
129:            protected Resource getSingleIdResource(SearchEngine searchEngine) {
130:                return searchEngine.get(createSingleIdResource(searchEngine));
131:            }
132:
133:            protected void assertSingleIdResourceExists(
134:                    SearchEngine searchEngine) {
135:                Resource r = getSingleIdResource(searchEngine);
136:                assertNotNull("single resource id don't exists", r);
137:            }
138:
139:            protected Resource getSingleId2Resource(SearchEngine searchEngine) {
140:                return searchEngine.get(createSingleIdResource2(searchEngine));
141:            }
142:
143:            protected void assertSingleId2ResourceExists(
144:                    SearchEngine searchEngine) {
145:                Resource r = getSingleId2Resource(searchEngine);
146:                assertNotNull("single resource id exists", r);
147:            }
148:
149:            protected Resource getMulitIdResource(SearchEngine searchEngine) {
150:                return searchEngine.get(createMultiIdResource(searchEngine));
151:            }
152:
153:            protected void assertMulitIdResourceExists(SearchEngine searchEngine) {
154:                Resource r = getMulitIdResource(searchEngine);
155:                assertNotNull("multi resource id exists", r);
156:            }
157:
158:            protected Resource getMulitId2Resource(SearchEngine searchEngine) {
159:                return searchEngine.get(createMultiIdResource2(searchEngine));
160:            }
161:
162:            protected void assertMulitId2ResourceExists(
163:                    SearchEngine searchEngine) {
164:                Resource r = getMulitId2Resource(searchEngine);
165:                assertNotNull("multi resource 2 id exists", r);
166:            }
167:
168:            protected void assertSingleIdResourceNotExists(
169:                    SearchEngine searchEngine) {
170:                Resource r = getSingleIdResource(searchEngine);
171:                assertNull("single resource id don't exists", r);
172:            }
173:
174:            protected void assertSingleId2ResourceNotExists(
175:                    SearchEngine searchEngine) {
176:                Resource r = getSingleId2Resource(searchEngine);
177:                assertNull("single resource id don't exists", r);
178:            }
179:
180:            protected void assertMulitIdResourceNotExists(
181:                    SearchEngine searchEngine) {
182:                Resource r = getMulitIdResource(searchEngine);
183:                assertNull("multi resource id don't exists", r);
184:            }
185:
186:            protected void assertMulitId2ResourceNotExists(
187:                    SearchEngine searchEngine) {
188:                Resource r = getMulitId2Resource(searchEngine);
189:                assertNull("multi resource id don't exists", r);
190:            }
191:
192:            protected Resource createSingleIdResource(SearchEngine searchEngine) {
193:                ResourceFactory resourceFactory = searchEngine
194:                        .getSearchEngineFactory().getResourceFactory();
195:                Resource singleId = resourceFactory
196:                        .createResource(ALIAS_SINGLE);
197:                singleId.addProperty(resourceFactory.createProperty(
198:                        PROPERTY_ID1, VALUE_ID1, Property.Store.YES,
199:                        Property.Index.UN_TOKENIZED));
200:                singleId.addProperty(resourceFactory.createProperty(
201:                        PROPERTY_VAL1, VALUE_VAL1, Property.Store.YES,
202:                        Property.Index.TOKENIZED));
203:                singleId.addProperty(resourceFactory.createProperty(
204:                        PROPERTY_VAL4, VALUE_VAL4, Property.Store.YES,
205:                        Property.Index.TOKENIZED));
206:                ((InternalResource) singleId).addUID();
207:                return singleId;
208:            }
209:
210:            protected Resource createSingleIdResource2(SearchEngine searchEngine) {
211:                ResourceFactory resourceFactory = searchEngine
212:                        .getSearchEngineFactory().getResourceFactory();
213:                Resource singleId = resourceFactory
214:                        .createResource(ALIAS_SINGLE);
215:                singleId.addProperty(resourceFactory.createProperty(
216:                        PROPERTY_ID1, VALUE_ID1_2, Property.Store.YES,
217:                        Property.Index.UN_TOKENIZED));
218:                singleId.addProperty(resourceFactory.createProperty(
219:                        PROPERTY_VAL1, VALUE_VAL1, Property.Store.YES,
220:                        Property.Index.TOKENIZED));
221:                singleId.addProperty(resourceFactory.createProperty(
222:                        PROPERTY_VAL4, VALUE_VAL4, Property.Store.YES,
223:                        Property.Index.TOKENIZED));
224:                ((InternalResource) singleId).addUID();
225:                return singleId;
226:            }
227:
228:            protected Resource createMultiIdResource(SearchEngine searchEngine) {
229:                ResourceFactory resourceFactory = searchEngine
230:                        .getSearchEngineFactory().getResourceFactory();
231:                Resource multiId = resourceFactory.createResource(ALIAS_MUTLI);
232:                multiId.addProperty(resourceFactory.createProperty(
233:                        PROPERTY_ID2, VALUE_ID2, Property.Store.YES,
234:                        Property.Index.UN_TOKENIZED));
235:                multiId.addProperty(resourceFactory.createProperty(
236:                        PROPERTY_ID3, VALUE_ID3, Property.Store.YES,
237:                        Property.Index.UN_TOKENIZED));
238:                multiId.addProperty(resourceFactory.createProperty(
239:                        PROPERTY_VAL2, VALUE_VAL2, Property.Store.YES,
240:                        Property.Index.TOKENIZED));
241:                multiId.addProperty(resourceFactory.createProperty(
242:                        PROPERTY_VAL3, VALUE_VAL3, Property.Store.YES,
243:                        Property.Index.TOKENIZED));
244:                multiId.addProperty(resourceFactory.createProperty(
245:                        PROPERTY_VAL4, VALUE_VAL4, Property.Store.YES,
246:                        Property.Index.TOKENIZED));
247:                ((InternalResource) multiId).addUID();
248:                return multiId;
249:            }
250:
251:            protected Resource createMultiIdResource2(SearchEngine searchEngine) {
252:                ResourceFactory resourceFactory = searchEngine
253:                        .getSearchEngineFactory().getResourceFactory();
254:                Resource multiId = resourceFactory.createResource(ALIAS_MUTLI);
255:                multiId.addProperty(resourceFactory.createProperty(
256:                        PROPERTY_ID2, VALUE_ID2_2, Property.Store.YES,
257:                        Property.Index.UN_TOKENIZED));
258:                multiId.addProperty(resourceFactory.createProperty(
259:                        PROPERTY_ID3, VALUE_ID3_2, Property.Store.YES,
260:                        Property.Index.UN_TOKENIZED));
261:                multiId.addProperty(resourceFactory.createProperty(
262:                        PROPERTY_VAL2, VALUE_VAL2, Property.Store.YES,
263:                        Property.Index.TOKENIZED));
264:                multiId.addProperty(resourceFactory.createProperty(
265:                        PROPERTY_VAL3, VALUE_VAL3, Property.Store.YES,
266:                        Property.Index.TOKENIZED));
267:                multiId.addProperty(resourceFactory.createProperty(
268:                        PROPERTY_VAL4, VALUE_VAL4, Property.Store.YES,
269:                        Property.Index.TOKENIZED));
270:                ((InternalResource) multiId).addUID();
271:                return multiId;
272:            }
273:
274:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.