2
* Copyright © 2011-2012 Akiban Technologies, Inc. All rights reserved.
4
* This program and the accompanying materials are made available
5
* under the terms of the Eclipse Public License v1.0 which
6
* accompanies this distribution, and is available at
7
* http://www.eclipse.org/legal/epl-v10.html
9
* This program may also be available under different license terms.
10
* For more information, see www.akiban.com or contact licensing@akiban.com.
13
* Akiban Technologies, Inc.
16
package com.persistit.unit;
18
import static org.junit.Assert.assertTrue;
20
import org.junit.Test;
21
import org.springframework.context.ApplicationContext;
22
import org.springframework.context.support.ClassPathXmlApplicationContext;
24
import com.persistit.Persistit;
25
import com.persistit.exception.PersistitException;
28
* Create a Persistit instance using Spring Framework.
33
public class SpringFrameworkConfigurationTest {
35
public static class TestClient {
38
public TestClient(final Persistit db) {
43
System.out.println(db.getVolumes());
46
} catch (final PersistitException e) {
53
public void configurePersistitFromSpring() throws Exception {
54
System.setProperty("com.persistit.datapath", UnitTestProperties.DATA_PATH);
55
final ApplicationContext context = new ClassPathXmlApplicationContext(
56
"com/persistit/unit/SpringFrameworkConfiguraitonTest.xml");
58
final Persistit persistit = (Persistit) context.getBean("persistit");
59
assertTrue("Persistit should be initialized", persistit.isInitialized());
61
final TestClient testClient = (TestClient) context.getBean("testClient");