• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java XOUnit类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.buschmais.xo.api.bootstrap.XOUnit的典型用法代码示例。如果您正苦于以下问题:Java XOUnit类的具体用法?Java XOUnit怎么用?Java XOUnit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

XOUnit类属于com.buschmais.xo.api.bootstrap包,在下文中一共展示了XOUnit类的37个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configure

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
protected void configure(XOUnit.XOUnitBuilder builder) {
    builder.provider(RemoteNeo4jXOProvider.class);
    Properties properties = new Properties();
    String username = storeConfiguration.getUsername();
    if (username != null) {
        properties.setProperty(Property.USERNAME.getKey(), username);
    }
    String password = storeConfiguration.getPassword();
    if (password != null) {
        properties.setProperty(Property.PASSWORD.getKey(), password);
    }
    String encryptionLevel = storeConfiguration.getEncryptionLevel();
    if (encryptionLevel != null) {
        properties.setProperty(Property.ENCRYPTION_LEVEL.getKey(), encryptionLevel);
    }
    Properties storeConfigurationProperties = storeConfiguration.getProperties();
    if (storeConfigurationProperties != null) {
        properties.putAll(storeConfigurationProperties);
    }
    builder.properties(properties);
}
 

开发者ID:buschmais,
项目名称:jqa-core-framework,
代码行数:23,
代码来源:RemoteGraphStore.java

示例2: createDatastore

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
   public Datastore<DuctileStoreSession, DuctileVertexMetadata, String, DuctileEdgeMetadata, String> createDatastore(
    XOUnit xoUnit) {
if (xoUnit == null) {
    throw new IllegalArgumentException("XOUnit must not be null!");
}
URI uri = xoUnit.getUri();
if (uri == null) {
    throw new XOException("No URI is specified for the store.");
}
try {
    return new DuctileStore(uri.toURL());
} catch (IOException e) {
    throw new XOException("Could not initialize store.", e);
}
   }
 

开发者ID:PureSolTechnologies,
项目名称:DuctileDB,
代码行数:17,
代码来源:DuctileXOProvider.java

示例3: configuredXOUnits

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
public static Collection<XOUnit[]> configuredXOUnits() throws IOException {
List<XOUnit[]> xoUnits = new ArrayList<>();
List<XOUnit> readXOUnits = XOUnitFactory.getInstance()
	.getXOUnits(AbstractXODuctileDBTest.class.getResource(XO_CONFIGURATION_RESOURCE));
for (XOUnit xoUnit : readXOUnits) {
    try {
	xoUnits.add(new XOUnit[] { new XOUnit(xoUnit.getName(), xoUnit.getDescription(),
		AbstractDuctileDBTest.DEFAULT_TEST_CONFIG_URL.toURI(), xoUnit.getProvider(), xoUnit.getTypes(),
		xoUnit.getInstanceListeners(), xoUnit.getValidationMode(), xoUnit.getConcurrencyMode(),
		xoUnit.getDefaultTransactionAttribute(), xoUnit.getProperties()) });
    } catch (URISyntaxException e) {
	throw new IllegalStateException(e);
    }
}
return xoUnits;
   }
 

开发者ID:PureSolTechnologies,
项目名称:DuctileDB,
代码行数:17,
代码来源:DuctileDBTestUtils.java

示例4: initialize

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@BeforeClass
   public static void initialize() {
Collection<XOUnit[]> xoUnits = DuctileDBTestUtils.xoUnits(
	Arrays.<Class<?>>asList(TreeNode.class, TreeNodeRelation.class), Collections.<Class<?>>emptyList(),
	ValidationMode.NONE, ConcurrencyMode.MULTITHREADED, Transaction.TransactionAttribute.MANDATORY);
assertThat(xoUnits, hasSize(1));
XOUnit[] xoUnit = xoUnits.iterator().next();
assertThat(xoUnit.length, is(1));
xoManagerFactory = XO.createXOManagerFactory(xoUnit[0]);

try (XOManager xoManager = xoManagerFactory.createXOManager()) {
    DuctileStoreSession datastoreSession = xoManager.getDatastoreSession(DuctileStoreSession.class);
    DuctileGraph graph = datastoreSession.getGraph();
    // Some initial input to finish bootstrapping...
    DuctileVertex vertex1 = graph.addVertex();
    DuctileVertex vertex2 = graph.addVertex();
    vertex1.addEdge("BOOTSTRAPPING", vertex2);
}
   }
 

开发者ID:PureSolTechnologies,
项目名称:DuctileDB,
代码行数:20,
代码来源:XOVsDuctileDBNativePerformanceIT.java

示例5: initialize

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@BeforeClass
public static void initialize() {
	Collection<XOUnit[]> xoUnits = XOTitanTestUtils.xoUnits(Arrays
			.<Class<?>> asList(TreeNode.class, TreeNodeRelation.class),
			Collections.<Class<?>> emptyList(), ValidationMode.NONE,
			ConcurrencyMode.MULTITHREADED,
			Transaction.TransactionAttribute.MANDATORY);
	assertThat(xoUnits, hasSize(1));
	XOUnit[] xoUnit = xoUnits.iterator().next();
	assertThat(xoUnit.length, is(1));
	xoManagerFactory = XO.createXOManagerFactory(xoUnit[0]);

	try (XOManager xoManager = xoManagerFactory.createXOManager()) {
		TitanStoreSession datastoreSession = xoManager
				.getDatastoreSession(TitanStoreSession.class);
		TitanGraph titanGraph = datastoreSession.getTitanGraph();
		// Some initial input to finish bootstrapping...
		Vertex vertex1 = titanGraph.addVertex(null);
		Vertex vertex2 = titanGraph.addVertex(null);
		vertex1.addEdge("BOOTSTRAPPING", vertex2);
	}
}
 

开发者ID:PureSolTechnologies,
项目名称:extended-objects-titan,
代码行数:23,
代码来源:XOVsTitanNativePerformanceIT.java

示例6: createDatastore

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
   public Datastore<TitanStoreSession, TitanVertexMetadata, String, TitanEdgeMetadata, String> createDatastore(
    XOUnit xoUnit) {
if (xoUnit == null) {
    throw new IllegalArgumentException("CdoUnit must not be null!");
}
URI uri = xoUnit.getUri();
if (uri == null) {
    throw new XOException("No URI is specified for the store.");
}
String scheme = uri.getScheme();
if (!scheme.startsWith(TITAN_SCHEME_PREFIX)) {
    throw new XOException("Only URIs starting with '"
	    + TITAN_SCHEME_PREFIX + "' are supported by this store.");
}
String host = uri.getHost();
int port = uri.getPort();
String keyspace = TitanCassandraStore.retrieveKeyspaceFromURI(uri);
switch (scheme) {
case TITAN_CASSANDRA_SCHEME:
    return new TitanCassandraStore(host, port, keyspace);
default:
    throw new XOException("Scheme '" + scheme
	    + "' is not supported by this store.");
}
   }
 

开发者ID:PureSolTechnologies,
项目名称:extended-objects-titan,
代码行数:27,
代码来源:TitanXOProvider.java

示例7: createXOManagerFactory

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
/**
 * Create a {@link com.buschmais.xo.api.XOManagerFactory} for the given XO
 * unit.
 * <p>
 * Internally it performs a lookup in the OSGi service registry to retrieve the
 * XOBootstrapService service.
 * </p>
 *
 * @param xoUnit
 *            The XO unit.
 * @return The {@link com.buschmais.xo.api.XOManagerFactory}.
 */
public static XOManagerFactory createXOManagerFactory(XOUnit xoUnit) {
    if (OSGiUtil.isXOLoadedAsOSGiBundle()) {
        BundleContext bundleContext = FrameworkUtil.getBundle(XOSGi.class).getBundleContext();
        ServiceReference<XOBootstrapService> xoBootstrapServiceReference = bundleContext
                .getServiceReference(XOBootstrapService.class);
        if (xoBootstrapServiceReference == null) {
            throw new XOException("Cannot bootstrap XO implementation.");
        }
        XOBootstrapService xoBootstrapService = bundleContext.getService(xoBootstrapServiceReference);
        if (xoBootstrapService == null) {
            throw new XOException("Cannot bootstrap XO implementation.");
        }
        XOManagerFactory xoManagerFactory = xoBootstrapService.createXOManagerFactory(xoUnit);
        bundleContext.ungetService(xoBootstrapServiceReference);
        if (xoManagerFactory != null) {
            return xoManagerFactory;
        }
    }
    throw new XOException("Cannot bootstrap XO implementation.");
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:33,
代码来源:XOSGi.java

示例8: bootstrap

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Test
public void bootstrap() throws URISyntaxException {
    GraphDatabaseService graphDatabaseService = new TestGraphDatabaseFactory().newImpermanentDatabase();
    XOUnit xoUnit = XOUnitBuilder.create("graphDb:///", Neo4jXOProvider.class, A.class).property(GraphDatabaseService.class.getName(), graphDatabaseService).create();
    XOManagerFactory xoManagerFactory = XO.createXOManagerFactory(xoUnit);
    XOManager xoManager = xoManagerFactory.createXOManager();
    xoManager.currentTransaction().begin();
    A a = xoManager.create(A.class);
    a.setName("Test");
    xoManager.currentTransaction().commit();
    xoManager.close();
    xoManagerFactory.close();
    try (Transaction transaction = graphDatabaseService.beginTx()) {
        ResourceIterator<Node> iterator = graphDatabaseService.findNodes(label("A"), "name", "Test");
        assertThat(iterator.hasNext(), equalTo(true));
        Node node = iterator.next();
        assertThat(node.hasLabel(label("A")), equalTo(true));
        assertThat(node.getProperty("name"), equalTo((Object) "Test"));
        transaction.success();
    }
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:22,
代码来源:GraphDbBootstrapTest.java

示例9: bootstrapJava

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Test
public void bootstrapJava() throws URISyntaxException {
    // tag::BootstrapJava[]
    XOUnit xoUnit = XOUnit.builder().provider(EmbeddedNeo4jXOProvider.class).uri(new URI("file:databases/movies")).type(Person.class).type(Actor.class)
            .build();
    XOManagerFactory movies = XO.createXOManagerFactory(xoUnit);
    XOManager xoManager = movies.createXOManager();

    xoManager.currentTransaction().begin();

    Person person = xoManager.create(Person.class);
    person.setName("Indiana Jones");

    xoManager.currentTransaction().commit();

    xoManager.close();
    movies.close();
    // end::BootstrapJava[]
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:20,
代码来源:BootstrapTest.java

示例10: updated

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
public void updated(String pid, Dictionary<String, ?> properties) throws ConfigurationException {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("updated: {}", pid);
    }
    if (properties == null) {
        return;
    }
    XOUnit xoUnit;
    try {
        xoUnit = XOUnitConverter.fromProperties(properties);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("config: {}", xoUnit);
        }
    } catch (XOException e) {
        throw new ConfigurationException(NAME.getKey(), e.getMessage(), e);
    }

    deleted(pid);

    XOManagerFactory xoManagerFactory = new XOManagerFactoryImpl(xoUnit);
    ServiceRegistration<XOManagerFactory> registration = bundleContext.registerService(XOManagerFactory.class, xoManagerFactory, properties);
    serviceInstances.put(pid, registration);
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:25,
代码来源:XOManagerFactoryServiceFactory.java

示例11: readXODescriptors

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
private Map<String, XOUnit> readXODescriptors() {
    Map<String, XOUnit> result = new HashMap<>();
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    if (classLoader == null) {
        classLoader = XOUnitFactory.class.getClassLoader();
    }
    try {
        Enumeration<URL> resources = classLoader.getResources(XO_DESCRIPTOR_RESOURCE);
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            for (XOUnit xoUnit : xoUnitFactory.getXOUnits(url)) {
                XOUnit existingXOUnit = result.put(xoUnit.getName(), xoUnit);
                if (existingXOUnit != null) {
                    throw new XOException("Found more than one XO unit with name '" + xoUnit.getName() + "'.");
                }
            }
        }
    } catch (IOException e) {
        throw new XOException("Cannot read xo.xml descriptors.", e);
    }
    return result;
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:23,
代码来源:XOBootstrapServiceImpl.java

示例12: testUnit

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Test
public void testUnit() {
    XOManagerFactory XOManagerFactory = XO.createXOManagerFactory("testUnit");
    assertThat(XOManagerFactory, not(equalTo(null)));
    XOManagerFactoryImpl xoManagerFactoryImpl = (XOManagerFactoryImpl) XOManagerFactory;
    XOUnit xoUnit = xoManagerFactoryImpl.getXOUnit();
    assertThat(xoUnit.getName(), equalTo("testUnit"));
    assertThat(xoUnit.getDescription(), equalTo("This is a test unit."));
    assertThat(xoUnit.getUri().toString(), equalTo("file://foo"));
    assertThat(xoUnit.getProvider(), typeCompatibleWith(TestXOProvider.class));
    Set<? extends Class<?>> types = xoUnit.getTypes();
    assertThat(types.size(), equalTo(1));
    assertThat(types.toArray(), IsArrayContaining.<Object>hasItemInArray(A.class));
    assertThat(xoUnit.getValidationMode(), equalTo(NONE));
    assertThat(xoUnit.getConcurrencyMode(), equalTo(MULTITHREADED));
    assertThat(xoUnit.getDefaultTransactionAttribute(), equalTo(MANDATORY));
    assertThat(xoUnit.getProperties(), hasEntry(equalTo((Object) "foo"), equalTo((Object) "bar")));
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:19,
代码来源:BootstrapTest.java

示例13: methodStatistics

点赞 3

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Test
public void methodStatistics() throws URISyntaxException, IOException, JMException {
    XOUnit xoUnit = XOUnitBuilder.create("file:target/json/store", TraceDatastoreProvider.class, A.class).property("com.buschmais.xo.test.trace.api.DelegateProvider", JsonFileStoreProvider.class.getName()).create();
    XOManagerFactory xoManagerFactory = XO.createXOManagerFactory(xoUnit);
    assertThat(mbeanServer.getMBeanInfo(objectName), notNullValue());
    XOManager xoManager = xoManagerFactory.createXOManager();
    A a = xoManager.create(A.class);
    a.setName("Test");
    xoManager.close();

    CompositeData[] statistics = (CompositeData[]) mbeanServer.getAttribute(objectName, "MethodStatistics");
    assertThat(statistics, notNullValue());
    assertThat(statistics.length, greaterThan(0));
    CompositeData methodStatistic = statistics[0];
    assertThat((Long) methodStatistic.get("totalTime"), greaterThan(0l));
    assertThat((Long) methodStatistic.get("invocations"), greaterThan(0l));
    xoManagerFactory.close();
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:19,
代码来源:TraceMonitorMXBeanTest.java

示例14: configure

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
protected void configure(XOUnit.XOUnitBuilder builder) {
    builder.provider(EmbeddedNeo4jXOProvider.class);
    Properties properties = new Properties();
    properties.put(PROPERTY_NEO4J_ALLOW_STORE_UPGRADE, Boolean.TRUE.toString());
    properties.put(PROPERTY_NEO4J_KEEP_LOGICAL_LOGS, Boolean.FALSE.toString());
    properties.put(PROPERTY_NEO4J_DBMS_ALLOW_FORMAT_MIGRATION, Boolean.TRUE.toString());
    properties.put(PROPERTY_NEO4J_DBMS_CONNECTOR_BOLT_ENABLED, Boolean.TRUE.toString());
    builder.properties(properties);
}
 

开发者ID:buschmais,
项目名称:jqa-core-framework,
代码行数:11,
代码来源:EmbeddedGraphStore.java

示例15: start

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
public void start(Collection<Class<?>> types) {
    XOUnit.XOUnitBuilder builder = XOUnit.builder().uri(storeConfiguration.getUri()).types(types).validationMode(ValidationMode.NONE)
                                         .mappingConfiguration(XOUnit.MappingConfiguration.builder().strictValidation(true).build());
    configure(builder);
    xoManagerFactory = XO.createXOManagerFactory(builder.build());
    xoManager = xoManagerFactory.createXOManager();
}
 

开发者ID:buschmais,
项目名称:jqa-core-framework,
代码行数:9,
代码来源:AbstractGraphStore.java

示例16: testIllegalProtocol

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Test(expected = XOException.class)
   public void testIllegalProtocol() throws URISyntaxException {
XOUnit xoUnit = mock(XOUnit.class);
URI uri = new URI("illegal-ductiledb://ductiledb");
when(xoUnit.getUri()).thenReturn(uri);
ductileDBXOProvider.createDatastore(xoUnit);
   }
 

开发者ID:PureSolTechnologies,
项目名称:DuctileDB,
代码行数:8,
代码来源:DuctileDBXOProviderTest.java

示例17: getCdoUnits

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Parameterized.Parameters
public static Collection<XOUnit[]> getCdoUnits() {
	return DuctileDBTestUtils.xoUnits(asList(TestEntity.class),
			Collections.<Class<?>> emptyList(), ValidationMode.AUTO,
			ConcurrencyMode.MULTITHREADED,
			Transaction.TransactionAttribute.REQUIRES);
}
 

开发者ID:PureSolTechnologies,
项目名称:DuctileDB,
代码行数:8,
代码来源:MultithreadedIT.java

示例18: testIllegalProtocol

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Test(expected = XOException.class)
public void testIllegalProtocol() throws URISyntaxException {
	XOUnit xoUnit = mock(XOUnit.class);
	URI uri = new URI("illegal-titan-cassandra://titan");
	when(xoUnit.getUri()).thenReturn(uri);
	titanXOProvider.createDatastore(xoUnit);
}
 

开发者ID:PureSolTechnologies,
项目名称:extended-objects-titan,
代码行数:8,
代码来源:TitanXOProviderTest.java

示例19: getXOUnits

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Parameterized.Parameters
public static Collection<XOUnit[]> getXOUnits() throws URISyntaxException {
	return XOTitanTestUtils.xoUnits(Arrays.asList(A.class),
			Collections.<Class<?>> emptyList(), ValidationMode.AUTO,
			ConcurrencyMode.SINGLETHREADED,
			Transaction.TransactionAttribute.MANDATORY);
}
 

开发者ID:PureSolTechnologies,
项目名称:extended-objects-titan,
代码行数:8,
代码来源:TransactionAttributeMandatoryIT.java

示例20: getXOUnits

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Parameterized.Parameters
   public static Collection<XOUnit[]> getXOUnits() throws URISyntaxException {
return XOTitanTestUtils.xoUnits(asList(A.class, B.class),
	Collections.<Class<?>> emptyList(), ValidationMode.AUTO,
	ConcurrencyMode.SINGLETHREADED,
	Transaction.TransactionAttribute.REQUIRES);
   }
 

开发者ID:PureSolTechnologies,
项目名称:extended-objects-titan,
代码行数:8,
代码来源:TransactionAttributeRequiresIT.java

示例21: getCdoUnits

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Parameterized.Parameters
public static Collection<XOUnit[]> getCdoUnits() {
	return XOTitanTestUtils.xoUnits(asList(TestEntity.class),
			Collections.<Class<?>> emptyList(), ValidationMode.AUTO,
			ConcurrencyMode.MULTITHREADED,
			Transaction.TransactionAttribute.REQUIRES);
}
 

开发者ID:PureSolTechnologies,
项目名称:extended-objects-titan,
代码行数:8,
代码来源:MultithreadedIT.java

示例22: configuredXOUnits

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
public static Collection<XOUnit[]> configuredXOUnits() throws IOException {
List<XOUnit[]> xoUnits = new ArrayList<>();
List<XOUnit> readXOUnits = XOUnitFactory.getInstance().getXOUnits(
	AbstractXOTitanTest.class
		.getResource(XO_CONFIGURATION_RESOURCE));
for (XOUnit xoUnit : readXOUnits) {
    xoUnits.add(new XOUnit[] { xoUnit });
}
return xoUnits;
   }
 

开发者ID:PureSolTechnologies,
项目名称:extended-objects-titan,
代码行数:11,
代码来源:XOTitanTestUtils.java

示例23: xoUnits

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
public static Collection<XOUnit[]> xoUnits() {
return xoUnits(Arrays.asList(DEFAULT_LOCAL_URI),
	Collections.<Class<?>> emptyList(),
	Collections.<Class<?>> emptyList(), ValidationMode.AUTO,
	ConcurrencyMode.SINGLETHREADED,
	Transaction.TransactionAttribute.MANDATORY);
   }
 

开发者ID:PureSolTechnologies,
项目名称:extended-objects-titan,
代码行数:8,
代码来源:XOTitanTestUtils.java

示例24: createDatastore

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
public Datastore<?, ?, ?, ?, ?> createDatastore(XOUnit xoUnit) {
    URI uri = xoUnit.getUri();
    DatastoreFactory datastoreFactory = lookupFactory(uri);
    try {
        return datastoreFactory.createGraphDatabaseService(uri, xoUnit.getProperties());
    } catch (MalformedURLException e) {
        throw new XOException("Cannot create datastore.", e);
    }
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:11,
代码来源:EmbeddedNeo4jXOProvider.java

示例25: testEncodedDatabasePathContainingSpaces

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Test
public void testEncodedDatabasePathContainingSpaces() throws Exception {
    String encodedPath = dbPath.toURI().toURL().toExternalForm();
    XOUnit xoUnit = XOUnitBuilder.create(encodedPath, Neo4jXOProvider.class).create();
    XOManagerFactory xoManagerFactory = XO.createXOManagerFactory(xoUnit);
    XOManager xoManager = xoManagerFactory.createXOManager();

    assertThat(dbPath.exists(), is(true));
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:10,
代码来源:URLEncodingTest.java

示例26: strict

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Test
public void strict() throws URISyntaxException {
    try (XOManagerFactory xoManagerFactory = createFactory(XOUnit.MappingConfiguration.builder().strictValidation(true).build())) {
        fail("Expecting an " + XOException.class.getName());
    } catch (XOException e) {
        assertThat(e.getMessage(), containsString("AmbiguousA"));
    }
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:9,
代码来源:AmbiguousLabelsTest.java

示例27: createFactory

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
private XOManagerFactory createFactory(XOUnit.MappingConfiguration mappingConfiguration) throws URISyntaxException {
    GraphDatabaseService graphDatabaseService = new TestGraphDatabaseFactory().newImpermanentDatabase();
    Properties properties = new Properties();
    properties.put(GraphDatabaseService.class.getName(), graphDatabaseService);
    XOUnit.XOUnitBuilder builder = XOUnit.builder().provider(Neo4jXOProvider.class).uri(new URI("graphDb:///")).properties(properties).type(A.class)
            .type(AmbiguousA.class);
    if (mappingConfiguration != null) {
        builder.mappingConfiguration(mappingConfiguration);
    }
    XOUnit xoUnit = builder.build();
    return XO.createXOManagerFactory(xoUnit);
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:13,
代码来源:AmbiguousLabelsTest.java

示例28: setUp

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Before
public void setUp() throws URISyntaxException {
    XOUnit.XOUnitBuilder builder = XOUnit.builder().provider(EmbeddedNeo4jXOProvider.class).uri(new URI("memory:///"));
    builder.mappingConfiguration(XOUnit.MappingConfiguration.builder().strictValidation(true).build());
    configure(builder);
    XOUnit xoUnit = builder.build();
    xoManagerFactory = XO.createXOManagerFactory(xoUnit);
    xoManager = xoManagerFactory.createXOManager();
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:10,
代码来源:AbstractDocumentationTest.java

示例29: createDatastore

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
public Datastore<JsonDatastoreSession, JsonNodeMetadata, String, JsonRelationMetadata, String> createDatastore(XOUnit xoUnit) {
    URI uri = xoUnit.getUri();
    if (!"file".equals(uri.getScheme())) {
        throw new XOException("Only file URIs are supported by this store.");
    }
    try {
        return new JsonFileStore(uri.toURL().getPath());
    } catch (MalformedURLException e) {
        throw new XOException("Cannot convert URI '" + uri.toString() + "' to URL.", e);
    }
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:13,
代码来源:JsonFileStoreProvider.java

示例30: fromXOUnit

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
public static Properties fromXOUnit(final XOUnit xoUnit) {
    Properties properties = new Properties();

    // optional: properties
    Properties props = xoUnit.getProperties();
    // only simple types and collections/arrays of simple types allowed
    Collection<Object> providerProps = toList(props);
    if (!providerProps.isEmpty()) {
        properties.put(PROPERTIES.getKey(), providerProps);
    }

    return properties;
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:14,
代码来源:XOUnitConverter.java

示例31: deployXOUnits

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
private void deployXOUnits(Bundle bundle) {
    Enumeration<?> e = bundle.findEntries("META-INF", "xo.xml", false); //$NON-NLS-1$, $NON-NLS-2$
    if (e != null) {
        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Deploying XO units in bundle '{}'", bundle.getSymbolicName());
        }
        List<XOManagerFactory> xoManagerFactories = new LinkedList<>();
        while (e.hasMoreElements()) {
            URL xoUnitUrl = (URL) e.nextElement();
            List<XOUnit> xoUnits = Collections.emptyList();
            try {
                xoUnits = XOUnitFactory.getInstance().getXOUnits(xoUnitUrl);
            } catch (IOException ioe) {
                if (LOGGER.isErrorEnabled()) {
                    LOGGER.error("Error while loading XOUnit", ioe);
                }
            }
            for (XOUnit xoUnit : xoUnits) {
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Found XOUnit '{}'", xoUnit.getName());
                }
                XOManagerFactory xoManagerFactory = new XOManagerFactoryImpl(xoUnit);
                Dictionary<String, Object> p = new Hashtable<>();
                p.put("name", xoUnit.getName());
                bundle.getBundleContext().registerService(XOManagerFactory.class, xoManagerFactory, p);
                xoManagerFactories.add(xoManagerFactory);
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Registered service for XOUnit '{}'", xoUnit.getName());
                }
            }
        }
        this.registeredXOManagerFactories.put(Long.valueOf(bundle.getBundleId()), xoManagerFactories);
    }
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:35,
代码来源:XOUnitBundleListener.java

示例32: createXOManagerFactory

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
public XOManagerFactory createXOManagerFactory(String name) {
    XOUnit xoUnit = xoUnits.get(name);
    if (xoUnit == null) {
        throw new XOException("XO unit with name '" + name + "' does not exist.");
    }
    return createXOManagerFactory(xoUnit);
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:9,
代码来源:XOBootstrapServiceImpl.java

示例33: createDatastore

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
public Datastore<?, EntityMetadata, EntityDiscriminator, RelationMetadata, RelationDiscriminator> createDatastore(XOUnit xoUnit) {
    Properties properties = xoUnit.getProperties();
    String delegateProviderName = properties.getProperty(DELEGATE_KEY);
    if (delegateProviderName == null) {
        throw new XOException("Property '" + DELEGATE_KEY + "' must be specified using the class name of a data store provider.");
    }
    Class<XODatastoreProvider> delegateProviderType = ClassHelper.getType(delegateProviderName);
    XODatastoreProvider<EntityMetadata, EntityDiscriminator, RelationMetadata, RelationDiscriminator> delegateProvider = ClassHelper.newInstance(delegateProviderType);
    Datastore<?, EntityMetadata, EntityDiscriminator, RelationMetadata, RelationDiscriminator> delegateDatastore = delegateProvider.createDatastore(xoUnit);
    TraceMonitor traceMonitor = new TraceMonitor(xoUnit);
    InterceptorFactory interceptorFactory = new InterceptorFactory(Arrays.asList(new TraceMonitorInterceptor(traceMonitor)));
    return new TraceDatastore<>(interceptorFactory.addInterceptor(delegateDatastore, Datastore.class), interceptorFactory, traceMonitor);
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:15,
代码来源:TraceDatastoreProvider.java

示例34: traceProvider

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Test
public void traceProvider() {
    XOManagerFactory XOManagerFactory = XO.createXOManagerFactory("traceProvider");
    assertThat(XOManagerFactory, not(equalTo(null)));
    XOManagerFactoryImpl xoManagerFactoryImpl = (XOManagerFactoryImpl) XOManagerFactory;
    XOUnit xoUnit = xoManagerFactoryImpl.getXOUnit();
    assertThat(xoUnit.getName(), equalTo("traceProvider"));
    assertThat(xoUnit.getProvider(), typeCompatibleWith(TraceDatastoreProvider.class));
    Set<? extends Class<?>> types = xoUnit.getTypes();
    assertThat(types.size(), equalTo(1));
    assertThat(types.toArray(), IsArrayContaining.<Object>hasItemInArray(A.class));
    assertThat(xoUnit.getDefaultTransactionAttribute(), equalTo(NONE));
}
 

开发者ID:buschmais,
项目名称:extended-objects,
代码行数:14,
代码来源:BootstrapTest.java

示例35: configure

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Override
protected void configure(XOUnit.XOUnitBuilder builder) {
    builder.provider(EmbeddedNeo4jXOProvider.class);
}
 

开发者ID:buschmais,
项目名称:jqa-core-framework,
代码行数:5,
代码来源:GraphDbStore.java

示例36: testNullURI

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
@Test(expected = XOException.class)
   public void testNullURI() {
XOUnit xoUnit = Mockito.mock(XOUnit.class);
when(xoUnit.getUri()).thenReturn(null);
ductileDBXOProvider.createDatastore(xoUnit);
   }
 

开发者ID:PureSolTechnologies,
项目名称:DuctileDB,
代码行数:7,
代码来源:DuctileDBXOProviderTest.java

示例37: xoUnits

点赞 2

import com.buschmais.xo.api.bootstrap.XOUnit; //导入依赖的package包/类
public static Collection<XOUnit[]> xoUnits() {
return xoUnits(Arrays.asList(DEFAULT_LOCAL_URI), Collections.<Class<?>>emptyList(),
	Collections.<Class<?>>emptyList(), ValidationMode.AUTO, ConcurrencyMode.SINGLETHREADED,
	Transaction.TransactionAttribute.MANDATORY);
   }
 

开发者ID:PureSolTechnologies,
项目名称:DuctileDB,
代码行数:6,
代码来源:DuctileDBTestUtils.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)