本文整理汇总了Java中com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory类的典型用法代码示例。如果您正苦于以下问题:Java OPartitionedDatabasePoolFactory类的具体用法?Java OPartitionedDatabasePoolFactory怎么用?Java OPartitionedDatabasePoolFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OPartitionedDatabasePoolFactory类属于com.orientechnologies.orient.core.db包,在下文中一共展示了OPartitionedDatabasePoolFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testConfigs
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
@Test
public void testConfigs() throws Exception {
OrientDbConfigurationManager cm = new OrientDbConfigurationManager(config, new OPartitionedDatabasePoolFactory());
cm.setHostGroup("dev");
cm.init();
cm.putProperty(ConfigProperty.TEST1_CONFIG, "value");
cm.putProperty(ConfigProperty.POLL_INTERVAL, 16);
Assert.assertEquals("value", cm.readString(ConfigProperty.TEST1_CONFIG));
Assert.assertEquals(16, cm.readInt(ConfigProperty.POLL_INTERVAL));
cm.destroy();
cm = new OrientDbConfigurationManager(config, new OPartitionedDatabasePoolFactory());
cm.setHostGroup("dev");
cm.init();
Assert.assertEquals("value", cm.readString(ConfigProperty.TEST1_CONFIG));
Assert.assertEquals(16, cm.readInt(ConfigProperty.POLL_INTERVAL));
cm.destroy();
}
开发者ID:dmart28,项目名称:gcplot,代码行数:21,代码来源:OrientDbRepositoryTest.java
示例2: testFilters
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
@Test
public void testFilters() throws Exception {
FiltersOrientDbRepository repository = new FiltersOrientDbRepository(config, new OPartitionedDatabasePoolFactory());
repository.init();
Assert.assertEquals(0, repository.getAllFiltered("type1").size());
repository.filter("type1", "value1");
repository.filter("type1", "value2");
Assert.assertEquals(2, repository.getAllFiltered("type1").size());
Assert.assertArrayEquals(new String[] { "value1", "value2" }, repository.getAllFiltered("type1").toArray());
repository.notFilter("type1", "value2");
Assert.assertEquals(1, repository.getAllFiltered("type1").size());
repository.destroy();
}
开发者ID:dmart28,项目名称:gcplot,代码行数:15,代码来源:OrientDbRepositoryTest.java
示例3: testOrientDbLifeCycle
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
public void testOrientDbLifeCycle(String dbURL, boolean createDb, boolean dropDb) throws Exception
{
Orient.instance().startup();
assertNotNull(ODatabaseRecordThreadLocal.INSTANCE);
Orient.instance().removeShutdownHook();
OServer server = OServerMain.create();
server.startup(OrientDbTestWebApplication.class.getResource("db.config.xml").openStream());
server.activate();
if(createDb)
{
ODatabaseDocument dbToCreate = new ODatabaseDocumentTx(dbURL);
if(!dbToCreate.exists()) dbToCreate.create();
dbToCreate.close();
}
assertNotNull(ODatabaseRecordThreadLocal.INSTANCE);
ODatabaseDocument db = new OPartitionedDatabasePoolFactory().get(dbURL, "admin", "admin").acquire();
db.close();
assertNotNull(ODatabaseRecordThreadLocal.INSTANCE);
if(dropDb)
{
ODatabaseDocument dbToDrop = new ODatabaseDocumentTx(dbURL);
dbToDrop.open("admin", "admin");
dbToDrop.drop();
}
server.shutdown();
Orient.instance().shutdown();
// Thread.sleep(50);
}
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:29,代码来源:TestStandaloneOrientDBCompatibility.java
示例4: start
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
@Override
public void start(final String uri) {
this.uri = uri;
poolFactory = new OPartitionedDatabasePoolFactory();
poolFactory.setMaxPoolSize(OGlobalConfiguration.DB_POOL_MAX.getValueAsInteger());
// check database connection
new ODatabaseDocumentTx(uri).open(userManager.getUser(), userManager.getPassword()).close();
logger.debug("Pool {} started for '{}'", getType(), uri);
}
开发者ID:xvik,项目名称:guice-persist-orient,代码行数:10,代码来源:DocumentPool.java
示例5: initialize
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
/**
* {@inheritDoc}
* Initialize the OrientDB dataStore by {@link Properties} parameters.
*
* @param keyClass key class type for dataStore.
* @param persistentClass persistent class type for dataStore.
* @param properties OrientDB dataStore properties EG:- OrientDB client credentials.
*/
@Override
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) {
super.initialize(keyClass, persistentClass, properties);
try {
orientDbStoreParams = OrientDBStoreParameters.load(properties);
ROOT_URL = "remote:".concat(orientDbStoreParams.getServerHost()).concat(":")
.concat(orientDbStoreParams.getServerPort());
ROOT_DATABASE_URL = ROOT_URL.concat("/").concat(orientDbStoreParams.getDatabaseName());
remoteServerAdmin = new OServerAdmin(ROOT_URL).connect(orientDbStoreParams.getUserName(),
orientDbStoreParams.getUserPassword());
if (!remoteServerAdmin.existsDatabase(orientDbStoreParams.getDatabaseName(), "memory")) {
remoteServerAdmin.createDatabase(orientDbStoreParams.getDatabaseName(), "document", "memory");
}
if (orientDbStoreParams.getConnectionPoolSize() != null) {
int connPoolSize = Integer.valueOf(orientDbStoreParams.getConnectionPoolSize());
connectionPool = new OPartitionedDatabasePoolFactory(connPoolSize)
.get(ROOT_DATABASE_URL, orientDbStoreParams.getUserName(),
orientDbStoreParams.getUserPassword());
} else {
connectionPool = new OPartitionedDatabasePoolFactory().get(ROOT_DATABASE_URL,
orientDbStoreParams.getUserName(), orientDbStoreParams.getUserPassword());
}
OrientDBMappingBuilder<K, T> builder = new OrientDBMappingBuilder<>(this);
orientDBMapping = builder.fromFile(orientDbStoreParams.getMappingFile()).build();
if (!schemaExists()) {
createSchema();
}
} catch (Exception e) {
LOG.error("Error while initializing OrientDB dataStore: {}",
new Object[]{e.getMessage()});
throw new RuntimeException(e);
}
}
开发者ID:apache,项目名称:gora,代码行数:45,代码来源:OrientDBStore.java
示例6: ContentStore
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
public ContentStore(final String type, String name) {
startupIfEnginesAreMissing();
OPartitionedDatabasePool pool = new OPartitionedDatabasePoolFactory().get(type+":"+name, "admin", "admin");
pool.setAutoCreate(true);
db = pool.acquire();
ODatabaseRecordThreadLocal.INSTANCE.set(db);
updateSchema();
}
开发者ID:jbake-org,项目名称:jbake,代码行数:10,代码来源:ContentStore.java
示例7: MeshRecordFactory
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
public MeshRecordFactory(OPartitionedDatabasePoolFactory poolFactory) {
this.poolFactory = poolFactory;
}
开发者ID:gentics,项目名称:mesh,代码行数:4,代码来源:MeshRecordFactory.java
示例8: RolesOrientDbRepository
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
public RolesOrientDbRepository(OrientDbConfig config, OPartitionedDatabasePoolFactory poolFactory) {
super(config, poolFactory);
}
开发者ID:dmart28,项目名称:gcplot,代码行数:4,代码来源:RolesOrientDbRepository.java
示例9: TriggerOrientDbRepository
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
public TriggerOrientDbRepository(OrientDbConfig config, OPartitionedDatabasePoolFactory poolFactory) {
super(config, poolFactory);
}
开发者ID:dmart28,项目名称:gcplot,代码行数:4,代码来源:TriggerOrientDbRepository.java
示例10: FiltersOrientDbRepository
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
public FiltersOrientDbRepository(OrientDbConfig config, OPartitionedDatabasePoolFactory poolFactory) {
super(config, poolFactory);
}
开发者ID:dmart28,项目名称:gcplot,代码行数:4,代码来源:FiltersOrientDbRepository.java
示例11: AccountOrientDbRepository
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
public AccountOrientDbRepository(OrientDbConfig config, OPartitionedDatabasePoolFactory poolFactory) {
super(config, poolFactory);
}
开发者ID:dmart28,项目名称:gcplot,代码行数:4,代码来源:AccountOrientDbRepository.java
示例12: AbstractOrientDbRepository
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
public AbstractOrientDbRepository(OrientDbConfig config, OPartitionedDatabasePoolFactory poolFactory) {
this.config = config;
this.pool = poolFactory.get(config.connectionString, config.user, config.password);
}
开发者ID:dmart28,项目名称:gcplot,代码行数:5,代码来源:AbstractOrientDbRepository.java
示例13: OrientDbConfigurationManager
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
public OrientDbConfigurationManager(OrientDbConfig config, OPartitionedDatabasePoolFactory poolFactory) {
super(config, poolFactory);
}
开发者ID:dmart28,项目名称:gcplot,代码行数:4,代码来源:OrientDbConfigurationManager.java
示例14: testRoles
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
@Test
public void testRoles() throws Exception {
OPartitionedDatabasePoolFactory poolFactory = new OPartitionedDatabasePoolFactory();
AccountOrientDbRepository accRep = new AccountOrientDbRepository(config, poolFactory);
accRep.init();
RolesOrientDbRepository rolesRep = new RolesOrientDbRepository(config, poolFactory);
rolesRep.init();
RoleImpl role = new RoleImpl("test_role", Lists.newArrayList(
new RoleImpl.RestrictionImpl(RestrictionType.TOGGLE, true, "one", 0, Collections.emptyMap()),
new RoleImpl.RestrictionImpl(RestrictionType.QUANTITATIVE, false, "two", 5, Collections.emptyMap())));
role = (RoleImpl) rolesRep.store(role);
Assert.assertEquals(1, rolesRep.roles().size());
Assert.assertEquals("test_role", role.title());
Assert.assertEquals(2, role.restrictions().size());
Assert.assertEquals(RestrictionType.TOGGLE, role.restrictions().get(0).type());
Assert.assertEquals(true, role.restrictions().get(0).restricted());
Assert.assertEquals("one", role.restrictions().get(0).action());
Assert.assertEquals(0, role.restrictions().get(0).amount());
Assert.assertEquals(0, role.restrictions().get(0).properties().size());
Assert.assertEquals(RestrictionType.QUANTITATIVE, role.restrictions().get(1).type());
Assert.assertEquals("two", role.restrictions().get(1).action());
Assert.assertEquals(false, role.restrictions().get(1).restricted());
Assert.assertEquals(5L, role.restrictions().get(1).amount());
Assert.assertEquals(0, role.restrictions().get(1).properties().size());
AccountImpl account = AccountImpl.createNew("abc", "Artem", "Dmitriev",
"[email protected]", "token", "pass", "salt", Lists.newArrayList(role), DateTime.now(DateTimeZone.UTC), Collections.emptySet());
accRep.insert(account);
account = (AccountImpl) accRep.account("token").get();
Assert.assertEquals(1, account.roles().size());
Assert.assertEquals(role, account.roles().get(0));
role.setTitle("another_title");
role = (RoleImpl) rolesRep.store(role);
account = (AccountImpl) accRep.account("token").get();
Assert.assertEquals(role, account.roles().get(0));
// add new existing role to the existing account
RoleImpl role2 = new RoleImpl("empty_role", Lists.newArrayList(), true);
role2 = (RoleImpl) rolesRep.store(role2);
accRep.attachRole(account, role2);
account = (AccountImpl) accRep.account("token").get();
Assert.assertEquals(2, account.roles().size());
Assert.assertEquals(role2, account.roles().get(1));
accRep.destroy();
rolesRep.destroy();
}
开发者ID:dmart28,项目名称:gcplot,代码行数:59,代码来源:OrientDbRepositoryTest.java
示例15: testTriggers
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
@Test
public void testTriggers() throws Exception {
TriggerOrientDbRepository r = new TriggerOrientDbRepository(config, new OPartitionedDatabasePoolFactory());
r.init();
Identifier accId = Identifier.fromStr("123");
BinaryTriggerImpl btr = new BinaryTriggerImpl();
btr.setState(State.ACQUIRED);
btr.setProperties(Collections.singletonMap("one", "two"));
btr.setAccountId(accId);
btr.setLastTimeTrigger(System.currentTimeMillis());
btr.setType(TriggerType.REALTIME_AGENT_HEALTH);
r.saveTrigger(btr);
List<Trigger> triggers = r.triggersFor(accId);
Assert.assertEquals(1, triggers.size());
BinaryTrigger fromDb = (BinaryTrigger) triggers.get(0);
Assert.assertNotNull(fromDb.id());
Assert.assertEquals(accId, fromDb.accountId());
Assert.assertEquals(btr.lastTimeTrigger(), fromDb.lastTimeTrigger());
Assert.assertEquals(btr.state(), fromDb.state());
Assert.assertEquals(btr.properties(), fromDb.properties());
TestTrigger tt = new TestTrigger();
tt.setState(true);
tt.setAccountId(accId);
r.saveTrigger(tt);
triggers = r.triggersFor(accId);
Assert.assertEquals(triggers.size(), 2);
Assert.assertTrue(triggers.get(0) instanceof BinaryTrigger);
Assert.assertTrue(triggers.get(1) instanceof TestTrigger);
Assert.assertTrue((Boolean) triggers.get(1).state());
r.updateState(triggers.get(1).id(), false);
tt = (TestTrigger) r.trigger(triggers.get(1).id());
Assert.assertFalse(tt.state());
r.updateState(triggers.get(1).id(), true);
tt = (TestTrigger) r.trigger(triggers.get(1).id());
Assert.assertTrue(tt.state());
r.updateLastTimeTriggered(triggers.get(0).id(), btr.lastTimeTrigger() + 3);
BinaryTriggerImpl btr1 = (BinaryTriggerImpl) r.trigger(triggers.get(0).id());
Assert.assertEquals(btr1.lastTimeTrigger(), btr.lastTimeTrigger() + 3);
r.putProperty(btr1.id(), "one", "two");
btr1 = (BinaryTriggerImpl) r.trigger(btr1.id());
Assert.assertEquals(btr1.properties().size(), 1);
Assert.assertEquals(btr1.properties().get("one"), "two");
r.destroy();
}
开发者ID:dmart28,项目名称:gcplot,代码行数:56,代码来源:OrientDbRepositoryTest.java
示例16: testPooling
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
@Test
public void testPooling() throws Exception {
try (final ODatabase db = new OPartitionedDatabasePoolFactory().get("plocal:" + getClass().getSimpleName(), "writer", "writer").acquire()) {
testSavingEventLogRecord(db, "testPooling");
}
}
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:7,代码来源:RunRightFastOrientDBLifeCycleListenerTest.java
示例17: getDatabasePoolFactory
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
@Override
public OPartitionedDatabasePoolFactory getDatabasePoolFactory() {
return poolFactory;
}
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:5,代码来源:OrientDbSettings.java
示例18: setDatabasePoolFactory
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
@Override
public void setDatabasePoolFactory(OPartitionedDatabasePoolFactory poolFactory) {
this.poolFactory = poolFactory;
}
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:5,代码来源:OrientDbSettings.java
示例19: getDatabasePoolFactory
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
/**
* @return {@link OPartitionedDatabasePoolFactory} for DB pool for the application
*/
public OPartitionedDatabasePoolFactory getDatabasePoolFactory();
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:5,代码来源:IOrientDbSettings.java
示例20: setDatabasePoolFactory
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory; //导入依赖的package包/类
/**
* Set {@link ODatabasePoolBase} which should be used for DB connections pooling
* @param poolFactory setup a poolFactory
*/
public void setDatabasePoolFactory(OPartitionedDatabasePoolFactory poolFactory);
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:6,代码来源:IOrientDbSettings.java
注:本文中的com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论