本文整理汇总了Java中org.apache.cayenne.configuration.server.ServerRuntime.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Java ServerRuntime.shutdown方法的具体用法?Java ServerRuntime.shutdown怎么用?Java ServerRuntime.shutdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cayenne.configuration.server.ServerRuntime
的用法示例。
在下文中一共展示了ServerRuntime.shutdown方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateCayenneRuntime_NoName
import org.apache.cayenne.configuration.server.ServerRuntime; //导入方法依赖的package包/类
@Test
public void testCreateCayenneRuntime_NoName() {
ServerRuntimeFactory factory = new ServerRuntimeFactory();
factory.setDatasource("ds1");
ServerRuntime runtime = factory.createCayenneRuntime(mockDSFactory, Collections.emptyList());
try {
DataDomain domain = runtime.getDataDomain();
assertEquals("cayenne", domain.getName());
assertEquals(1, domain.getDataNodes().size());
assertNotNull(domain.getDefaultNode());
assertEquals("cayenne", domain.getDefaultNode().getName());
} finally {
runtime.shutdown();
}
}
示例2: testCreateCayenneRuntime_Name
import org.apache.cayenne.configuration.server.ServerRuntime; //导入方法依赖的package包/类
@Test
public void testCreateCayenneRuntime_Name() {
ServerRuntimeFactory factory = new ServerRuntimeFactory();
factory.setConfigs(asList("cayenne-project1.xml"));
factory.setDatasource("ds1");
factory.setName("me");
ServerRuntime runtime = factory.createCayenneRuntime(mockDSFactory, Collections.emptyList());
try {
DataDomain domain = runtime.getDataDomain();
assertEquals("me", domain.getName());
assertEquals(1, domain.getDataNodes().size());
assertNotNull(domain.getDefaultNode());
assertEquals("me", domain.getDefaultNode().getName());
} finally {
runtime.shutdown();
}
}
示例3: testCreateCayenneRuntime_Configs
import org.apache.cayenne.configuration.server.ServerRuntime; //导入方法依赖的package包/类
@Test
public void testCreateCayenneRuntime_Configs() {
ServerRuntimeFactory factory = new ServerRuntimeFactory();
factory.setDatasource("ds1");
factory.setConfigs(asList("cayenne-project2.xml", "cayenne-project1.xml"));
ServerRuntime runtime = factory.createCayenneRuntime(mockDSFactory, Collections.emptyList());
try {
DataDomain domain = runtime.getDataDomain();
assertNotNull(domain.getEntityResolver().getDbEntity("db_entity"));
assertNotNull(domain.getEntityResolver().getDbEntity("db_entity2"));
} finally {
runtime.shutdown();
}
}
示例4: testCreateCayenneRuntime_NoConfig
import org.apache.cayenne.configuration.server.ServerRuntime; //导入方法依赖的package包/类
@Test
public void testCreateCayenneRuntime_NoConfig() {
ServerRuntimeFactory factory = new ServerRuntimeFactory();
factory.setDatasource("ds1");
ServerRuntime runtime = factory.createCayenneRuntime(mockDSFactory, Collections.emptyList());
try {
DataDomain domain = runtime.getDataDomain();
assertTrue(domain.getEntityResolver().getDbEntities().isEmpty());
} finally {
runtime.shutdown();
}
}
示例5: testListeners
import org.apache.cayenne.configuration.server.ServerRuntime; //导入方法依赖的package包/类
@Test
public void testListeners() {
L1 l1 = new L1();
CayenneDataObject o1 = new CayenneDataObject();
o1.setObjectId(new ObjectId("T1"));
o1.writeProperty("name", "n" + 1);
CayenneDataObject o2 = new CayenneDataObject();
o2.setObjectId(new ObjectId("T1"));
o2.writeProperty("name", "n" + 2);
ServerRuntime runtime = runtimeWithListeners(l1);
try {
ObjectContext c = runtime.newContext();
c.registerNewObject(o1);
c.registerNewObject(o2);
c.commitChanges();
} finally {
runtime.shutdown();
}
assertEquals(2, l1.postPersisted.size());
assertTrue(l1.postPersisted.contains(o1));
assertTrue(l1.postPersisted.contains(o2));
}
示例6: testFilters
import org.apache.cayenne.configuration.server.ServerRuntime; //导入方法依赖的package包/类
@Test
public void testFilters() {
DataChannelFilter f = mock(DataChannelFilter.class);
when(f.onSync(any(), any(), anyInt(), any())).thenReturn(mock(GraphDiff.class));
CayenneDataObject o1 = new CayenneDataObject();
o1.setObjectId(new ObjectId("T1"));
o1.writeProperty("name", "n" + 1);
CayenneDataObject o2 = new CayenneDataObject();
o2.setObjectId(new ObjectId("T1"));
o2.writeProperty("name", "n" + 2);
ServerRuntime runtime = runtimeWithFilters(f);
try {
ObjectContext c = runtime.newContext();
c.registerNewObject(o1);
c.registerNewObject(o2);
c.commitChanges();
} finally {
runtime.shutdown();
}
verify(f).onSync(any(), any(), anyInt(), any());
}