Skip to content

Commit

Permalink
- prepared for releases via sonatype
Browse files Browse the repository at this point in the history
- upgraded to Neo4j 2.3.7
  • Loading branch information
DirkMahler committed Oct 4, 2016
1 parent 0f1374d commit 18e6da3
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 54 deletions.
10 changes: 0 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
sudo: false
language: java
jdk: oraclejdk8
after_success:
- test "${TRAVIS_PULL_REQUEST}" == "false" && test "${TRAVIS_TAG}" != "" && mvn deploy --settings build/travis-ci/settings.xml
branches:
only:
- master
- "/^[0-9]+\\.[0-9]+\\.[0-9]+/"
env:
global:
- secure: EvV6T5hI6B7K8qTICGhgDXP1c9cm/oK6DWbCRBZFmJ/gesJyXlOl96AgHnigXkuq8gmLBBrnucaL8bU95a5rc72mrPImmvlwHQjMAw8U4OK0andHXBOanXK9Hbgf5w+p3oHu+iHOkN5tSq9n+1HXN6MMXygxgfvXPWPVUdx0jhQ=
- secure: b961JrzR/lavfb/Q8EndryTYzQsXZ9UfuzSigXhev0InOV4FaJshiNYS5vWOuRvnnkdXvJtLLtHrtKEKcEtmvycU66olMAgrsRwaaNEgQC6cieWdI02CIR8jyaLJY/QpomgUH10l0JnUUo4a1856kSB1Nilqz2lSK1SZ7WOsOW4=
9 changes: 0 additions & 9 deletions build/travis-ci/settings.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.buschmais.xo.neo4j.api;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
Expand All @@ -22,7 +23,7 @@ public EmbeddedNeo4jDatastore createGraphDatabaseService(URI uri, Properties pro
} catch (UnsupportedEncodingException e) {
throw new MalformedURLException(e.getMessage());
}
GraphDatabaseBuilder databaseBuilder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(path);
GraphDatabaseBuilder databaseBuilder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(new File(path));
Properties neo4jProperties = Neo4jPropertyHelper.getNeo4jProperties(properties);
for (String name : neo4jProperties.stringPropertyNames()) {
databaseBuilder.setConfig(name, neo4jProperties.getProperty(name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ protected <T> ResultIterable<T> find(Class<T> type, Object value) {
// convert the value from object to datastore representation
Object datastoreValue = xoSession.toDatastore(value);
// find the nodes
ResourceIterable<Node> nodesIterable = graphDatabaseService.findNodesByLabelAndProperty(label, propertyName, datastoreValue);
ResourceIterator<Node> iterator = nodesIterable.iterator();
ResourceIterator<Node> iterator = graphDatabaseService.findNodes(label, propertyName, datastoreValue);
return xoSession.toResult(new ResultIterator<Node>() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import com.buschmais.xo.spi.metadata.type.EntityTypeMetadata;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.neo4j.graphdb.*;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.ResourceIterator;

import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -89,9 +92,8 @@ public ResultIterator<Node> findEntity(EntityTypeMetadata<NodeMetadata> entityTy
}
PropertyMetadata propertyMetadata = propertyMethodMetadata.getDatastoreMetadata();
Object value = entry.getValue();
ResourceIterable<Node> nodesByLabelAndProperty = graphDatabaseService.findNodesByLabelAndProperty(discriminator,
ResourceIterator<Node> iterator = graphDatabaseService.findNodes(discriminator,
propertyMetadata.getName(), value);
final ResourceIterator<Node> iterator = nodesByLabelAndProperty.iterator();
return new ResultIterator<Node>() {
@Override
public boolean hasNext() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,82 @@
package com.buschmais.xo.neo4j.test;

import static com.buschmais.xo.neo4j.test.Neo4jDatabase.MEMORY;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.kernel.GraphDatabaseAPI;
import org.neo4j.server.WrappingNeoServer;
import org.neo4j.test.TestGraphDatabaseFactory;

import com.buschmais.xo.api.ConcurrencyMode;
import com.buschmais.xo.api.Transaction;
import com.buschmais.xo.api.ValidationMode;
import com.buschmais.xo.api.XOManager;
import com.buschmais.xo.api.bootstrap.XOUnit;
import com.buschmais.xo.test.AbstractXOManagerTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.kernel.GraphDatabaseDependencies;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.factory.GraphDatabaseFacade;
import org.neo4j.logging.NullLogProvider;
import org.neo4j.server.CommunityNeoServer;
import org.neo4j.test.TestGraphDatabaseFactory;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import static com.buschmais.xo.neo4j.test.Neo4jDatabase.MEMORY;
import static org.neo4j.server.database.Database.Factory;

public abstract class AbstractNeo4jXOManagerTest extends AbstractXOManagerTest {

private static WrappingNeoServer server;
private static CommunityNeoServer server;

protected AbstractNeo4jXOManagerTest(XOUnit xoUnit) {
super(xoUnit);
}

@BeforeClass
public static void startServer() {
GraphDatabaseService graphDatabaseService = new TestGraphDatabaseFactory().newImpermanentDatabase();
server = new WrappingNeoServer((GraphDatabaseAPI) graphDatabaseService);
GraphDatabaseService databaseService = new TestGraphDatabaseFactory().newImpermanentDatabase();
Factory factory = (config, dependencies) -> new org.neo4j.server.database.Database() {
@Override
public String getLocation() {
return "mem";
}

@Override
public GraphDatabaseFacade getGraph() {
return (GraphDatabaseFacade) databaseService;
}

@Override
public boolean isRunning() {
return true;
}

@Override
public void init() throws Throwable {

}

@Override
public void start() throws Throwable {

}

@Override
public void stop() throws Throwable {

}

@Override
public void shutdown() throws Throwable {
databaseService.shutdown();
}
};
server = new CommunityNeoServer(new Config(), factory, GraphDatabaseDependencies.newDependencies(), NullLogProvider.getInstance());
server.start();
}

protected static Collection<Object[]> xoUnits(Class<?>... types) {
return xoUnits(Arrays.asList(MEMORY), Arrays.asList(types), Collections.<Class<?>> emptyList(), ValidationMode.AUTO, ConcurrencyMode.SINGLETHREADED,
return xoUnits(Arrays.asList(MEMORY), Arrays.asList(types), Collections.<Class<?>>emptyList(), ValidationMode.AUTO, ConcurrencyMode.SINGLETHREADED,
Transaction.TransactionAttribute.NONE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public void bootstrap() throws URISyntaxException {
xoManager.close();
xoManagerFactory.close();
try (Transaction transaction = graphDatabaseService.beginTx()) {
ResourceIterable<Node> nodes = graphDatabaseService.findNodesByLabelAndProperty(label("A"), "name", "Test");
ResourceIterator<Node> iterator = nodes.iterator();
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public ResultIterator<Map<String, Object>> execute(String query, Map<String, Obj
String key = matcher.group(2);
String value = matcher.group(3);
final ResourceIterator<Node> iterator = ((Neo4jDatastoreSession<?>) session).getGraphDatabaseService()
.findNodesByLabelAndProperty(DynamicLabel.label(label), key, value).iterator();
.findNodes(DynamicLabel.label(label), key, value);
return new ResultIterator<Map<String, Object>>() {
@Override
public void close() {
Expand Down
52 changes: 44 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@
</ciManagement>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>bintray</id>
<url>https://api.bintray.com/maven/buschmais/maven/extended-objects;publish=1</url>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<site>
<id>github-pages-site</id>
Expand All @@ -57,15 +63,45 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java8.build.outputDirectory>${project.build.directory}/classes-java8</java8.build.outputDirectory>
<github.global.server>github</github.global.server>
<org_asciidoctor.version>1.5.0</org_asciidoctor.version>
<org.neo4j_version>2.3.1</org.neo4j_version>
<org_asciidoctor.version>1.5.3</org_asciidoctor.version>
<org.neo4j_version>2.3.7</org.neo4j_version>

<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
<bundle.name>com.buschmais.${project.artifactId}</bundle.name>
<jqassistant.version>1.1.1</jqassistant.version>
<jqassistant.version>1.1.3</jqassistant.version>
</properties>

<profiles>
<profile>
<id>release</id>
<!--
! This profile is automatically activated by using maven-release-plugin:perfom.
! So this mean signing of artifacts is only done in case of running a release.
-->
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>QA</id>
<build>
Expand Down Expand Up @@ -317,7 +353,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -343,12 +379,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
<goal>javadoc-no-fork</goal>
</goals>
</execution>
</executions>
Expand Down

0 comments on commit 18e6da3

Please sign in to comment.