Manybubbles has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/198748

Change subject: Start blazegraph for integration tests
......................................................................

Start blazegraph for integration tests

We'll use this to test the update tool.

Change-Id: Ib080fe55f36ffb87acbb15301a0b96f09fb72747
---
M .gitignore
M README.md
M pom.xml
M tools/pom.xml
A tools/src/test/java/org/wikidata/rdf/tool/BlazegraphCanaryIntegrationTest.java
A tools/src/test/resources/blazegraph/RWStore.properties
6 files changed, 151 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/rdf 
refs/changes/48/198748/1

diff --git a/.gitignore b/.gitignore
index 676a294..7e54b9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@
 data/
 *.iml
 .idea
+**/rules.log
diff --git a/README.md b/README.md
index be7be87..f1e042b 100644
--- a/README.md
+++ b/README.md
@@ -6,3 +6,7 @@
 ** Apache Licensed
 * blazegraph - Blazegraph extension to make querying Wikibase instances more 
efficient
 ** GPLv2 Licensed
+
+Development Notes
+-----------------
+* Eclipse - Works well with m2e.
diff --git a/pom.xml b/pom.xml
index 6bb2ac8..cd11fe6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -300,6 +300,10 @@
       <id>bigdata.releases</id>
       <url>http://www.systap.com/maven/releases</url>
     </repository>
+    <repository>
+      <id>wmf.mirrored</id>
+      <url>http://archiva.wikimedia.org/repository/mirrored</url>
+    </repository>
   </repositories>
 
   <profiles>
diff --git a/tools/pom.xml b/tools/pom.xml
index 3eb7673..4103948 100644
--- a/tools/pom.xml
+++ b/tools/pom.xml
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.wikidata.query.rdf</groupId>
@@ -81,6 +82,95 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.10</version>
+        <executions>
+          <execution>
+            <id>unpack</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>com.bigdata</groupId>
+                  <artifactId>bigdata</artifactId>
+                  <version>1.5.1</version>
+                  <type>war</type>
+                </artifactItem>
+              </artifactItems>
+              
<outputDirectory>${project.build.directory}/blazegraph</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>properties-maven-plugin</artifactId>
+        <version>1.0-alpha-2</version>
+        <executions>
+          <execution>
+            <id>setup-blazegraph-properties</id>
+            <goals>
+              <goal>set-system-properties</goal>
+            </goals>
+            <phase>pre-integration-test</phase>
+            <configuration>
+              <properties>
+                <property>
+                  <!-- By default Blazegraph's WAR thinks it running in tomcat 
and uses funky relative paths. They suggest 
+                    you overwrite it. We do. -->
+                  
<name>com.bigdata.rdf.sail.webapp.ConfigParams.propertyFile</name>
+                  
<value>${project.basedir}/src/test/resources/blazegraph/RWStore.properties</value>
+                </property>
+              </properties>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.eclipse.jetty</groupId>
+        <artifactId>jetty-maven-plugin</artifactId>
+        <version>9.2.10.v20150310</version>
+        <configuration>
+          <scanIntervalSeconds>10</scanIntervalSeconds>
+          <stopKey>stopblazegraphrightnowplzkthx</stopKey>
+          <stopPort>9898</stopPort>
+        </configuration>
+        <executions>
+          <execution>
+            <id>start-blzegraph</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>start</goal>
+            </goals>
+            <!-- This complains some because this project _isn't_ a war. But 
we want to start the Blazegraph war. -->
+            <configuration>
+              <scanIntervalSeconds>0</scanIntervalSeconds>
+              <httpConnector>
+                <port>9999</port>
+              </httpConnector>
+              <contextHandlers>
+                <contextHandler 
implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
+                  <!-- TODO a war with the blazegraph extensions -->
+                  <war>${project.build.directory}/blazegraph</war>
+                  <contextPath>/bigdata</contextPath>
+                </contextHandler>
+              </contextHandlers>
+            </configuration>
+          </execution>
+          <execution>
+            <id>stop-blazegraph</id>
+            <phase>post-integration-test</phase>
+            <goals>
+              <goal>stop</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>
diff --git 
a/tools/src/test/java/org/wikidata/rdf/tool/BlazegraphCanaryIntegrationTest.java
 
b/tools/src/test/java/org/wikidata/rdf/tool/BlazegraphCanaryIntegrationTest.java
new file mode 100644
index 0000000..9d1698a
--- /dev/null
+++ 
b/tools/src/test/java/org/wikidata/rdf/tool/BlazegraphCanaryIntegrationTest.java
@@ -0,0 +1,25 @@
+package org.wikidata.rdf.tool;
+
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.junit.Test;
+
+import com.google.common.base.Charsets;
+import com.google.common.io.Resources;
+
+/**
+ * Will fail if there isn't a local Blazegraph instance running on port 9999.
+ * Maven will run Blzegraph on that port during the pre-integration-test phase
+ * but if it fails to start then it won't always notice.
+ */
+public class BlazegraphCanaryIntegrationTest {
+    @Test
+    public void canary() throws IOException {
+        String fetched = Resources.asCharSource(new 
URL("http://localhost:9999/bigdata/status";), Charsets.UTF_8).read();
+        assertThat(fetched, containsString("queriesPerSecond"));
+    }
+}
diff --git a/tools/src/test/resources/blazegraph/RWStore.properties 
b/tools/src/test/resources/blazegraph/RWStore.properties
new file mode 100644
index 0000000..ea31ca1
--- /dev/null
+++ b/tools/src/test/resources/blazegraph/RWStore.properties
@@ -0,0 +1,26 @@
+# Dump data in target.
+com.bigdata.journal.AbstractJournal.file=target/bigdata/bigdata.jnl
+com.bigdata.journal.AbstractJournal.bufferMode=DiskRW
+com.bigdata.service.AbstractTransactionService.minReleaseAge=1
+com.bigdata.btree.writeRetentionQueue.capacity=4000
+com.bigdata.btree.BTree.branchingFactor=128
+
+# Small (2M) initial extent for small test data.
+com.bigdata.journal.AbstractJournal.initialExtent=2097152
+com.bigdata.journal.AbstractJournal.maximumExtent=2097152
+
+# Use RDR mode just in case we use it.
+com.bigdata.rdf.store.AbstractTripleStore.quads=false
+com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers=true
+
+# Don't use truth maintenance right yet.
+com.bigdata.rdf.sail.truthMaintenance=false
+com.bigdata.rdf.store.AbstractTripleStore.textIndex=false
+com.bigdata.rdf.store.AbstractTripleStore.axiomsClass=com.bigdata.rdf.axioms.NoAxioms
+
+# Use the default vocabulary for now.
+com.bigdata.rdf.store.AbstractTripleStore.vocabularyClass=com.bigdata.rdf.vocab.DefaultBigdataVocabulary
+
+# These seem to be ubiquitous overwrites.  Not sure why they aren't the 
default but it works.
+com.bigdata.namespace.kb.lex.com.bigdata.btree.BTree.branchingFactor=400
+com.bigdata.namespace.kb.spo.com.bigdata.btree.BTree.branchingFactor=1024

-- 
To view, visit https://gerrit.wikimedia.org/r/198748
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib080fe55f36ffb87acbb15301a0b96f09fb72747
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/rdf
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to