KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > jcr > test > BaseJCRTest


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.jcr.test;
18
19 import javax.jcr.Repository;
20
21 import junit.framework.TestCase;
22
23 import org.alfresco.jcr.repository.RepositoryFactory;
24 import org.alfresco.jcr.repository.RepositoryImpl;
25 import org.alfresco.service.cmr.repository.StoreRef;
26 import org.springframework.context.ApplicationContext;
27 import org.springframework.context.support.ClassPathXmlApplicationContext;
28
29 /**
30  * Base JCR Test
31  *
32  * @author David Caruana
33  */

34 public class BaseJCRTest extends TestCase
35 {
36     private RepositoryImpl repositoryImpl;
37     protected Repository repository;
38     protected StoreRef storeRef;
39     
40     private static ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:org/alfresco/jcr/test/test-context.xml");
41     
42     protected String JavaDoc getWorkspace()
43     {
44         return storeRef.getIdentifier();
45     }
46
47     @Override JavaDoc
48     protected void setUp() throws Exception JavaDoc
49     {
50         storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
51         TestData.generateTestData(applicationContext, storeRef.getIdentifier());
52         repositoryImpl = (RepositoryImpl)applicationContext.getBean(RepositoryFactory.REPOSITORY_BEAN);
53         repositoryImpl.setDefaultWorkspace(storeRef.getIdentifier());
54         repository = repositoryImpl;
55     }
56
57 }
58
Popular Tags