Skip to content

Commit

Permalink
added J2SE module to start up server, setup external fixture
Browse files Browse the repository at this point in the history
another module to shutdown server and teardown ext fixture.

bug fixes and feature additions to ral.
  • Loading branch information
sasinda committed Aug 14, 2012
1 parent f2853e1 commit b27bcff
Show file tree
Hide file tree
Showing 103 changed files with 6,368 additions and 700 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Build
target
*/target
target-eclipse
target/
target-eclipse/

# IDEA
*.iml
Expand Down
249 changes: 182 additions & 67 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,72 +22,187 @@
-->

<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.xwiki.commons</groupId>
<artifactId>xwiki-commons</artifactId>
<version>4.1.2</version>
</parent>
<groupId>org.xwiki.android</groupId>
<artifactId>xwiki-android</artifactId>
<version>1.0-SNAPSHOT</version>
<name>XWiki Android - Parent POM</name>
<packaging>pom</packaging>
<description>XWiki Android - Parent POM</description>
<properties>
<xwiki.clirr.skip>true</xwiki.clirr.skip>
<!-- Force accessing banned dependency junit since android-test artifact
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.xwiki.commons</groupId>
<artifactId>xwiki-commons</artifactId>
<version>4.1.2</version>
</parent>
<groupId>org.xwiki.android</groupId>
<artifactId>xwiki-android</artifactId>
<version>1.0-SNAPSHOT</version>
<name>XWiki Android - Parent POM</name>
<packaging>pom</packaging>
<description>XWiki Android - Parent POM</description>


<modules>
<module>xwiki-rest-model</module>
<module>xwiki-android-rest</module>
<module>xwiki-android-core</module>
<module>xwiki-android-components</module>
<module>xwiki-android-client</module>

<module>xwiki-android-test-fixture-setup</module>
<module>xwiki-android-test-rest</module>
<module>xwiki-android-tests-instrumentation</module>
<module>xwiki-android-test-fixture-teardown</module>
</modules>

<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.1.2</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>

<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<sdk>
<path>${env.ANDROID_HOME}</path>
<platform>2.1</platform>
</sdk>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<coreLibrary>true</coreLibrary>
</configuration>
<extensions>true</extensions>

</plugin>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
</plugins>


<pluginManagement>
<!-- surefire plugin for testing: config env properties for testing. -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<forkMode>once</forkMode>

<systemProperties>
<!-- Xwiki Execution directory settings for test fixture
:::::::::::::::::::::::::::::::::::::::::::::::::::::::
-->
<!-- explicitly set here other wise the java runtime System.getProperty() cannot access this propert. -->
<property>
<name>xwikiExecutionDirectory</name>
<value>${xwikiExecutionDirectory}</value>
</property>
<property>
<name>xwikiExecutionIndex</name>
<value>${xwikiExecutionIndex}</value>
</property>
</systemProperties>
</configuration>
</plugin>

<!--dependancy plugin configured to unpack xwkik jetty distribution-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unzip-application</id>
<phase>test-compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.xwiki.enterprise</groupId>
<artifactId>xwiki-enterprise-jetty-${xwiki.db}</artifactId>
<version>${xwiki.xe.version}</version>
<type>zip</type>
</artifactItem>
</artifactItems>
<outputDirectory>${xwikiExecutionDirectory}/../</outputDirectory>
<!-- Allow skipping the unpack -->
<skip>${xwiki.test.skipUnpack}</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>

</build>

<properties>

<xwiki.clirr.skip>true</xwiki.clirr.skip>
<!-- Force accessing banned dependency junit since android-test artifact
uses it -->
<xwiki.enforcer.skip>true</xwiki.enforcer.skip>
</properties>

<modules>
<module>xwiki-rest-model</module>
<module>xwiki-android-rest</module>
<module>xwiki-android-core</module>
<module>xwiki-android-components</module>
<module>xwiki-android-client</module>
<!-- <module>xwiki-android-test-rest</module> -->
<module>xwiki-android-tests-instrumentation</module>
</modules>

<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.1.2</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<sourceDirectory>src</sourceDirectory>

<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<sdk>
<path>${env.ANDROID_HOME}</path>
<platform>2.1</platform>
</sdk>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<coreLibrary>true</coreLibrary>
</configuration>
<extensions>true</extensions>
</plugin>


<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
</plugins>

</build>
<xwiki.enforcer.skip>true</xwiki.enforcer.skip>

<!-- properties taken from
https://github.com/xwiki/xwiki-enterprise/blob/master/xwiki-enterprise-test/pom.xml
some extras were deleted
-->

<port>8080</port>
<stopport>8079</stopport>
<rmiport>6666</rmiport>
<seleniumPort>4444</seleniumPort>

<!-- Specify the part of the URL before the port number where the XWiki instance is running. This is used when running tests on a remote instance.
Do not add a trailing slash. Example:
http://localhost
https://testmachine.mynetwork.net
See also "port" for defining the port to connect to.
-->
<xwiki.test.baseURL>http://localhost</xwiki.test.baseURL>
<!-- Skip starting the XE instance. This is used when there is an instance already running on the local machine
or when there is a started instance on another machine
-->
<xwiki.test.skipStart>false</xwiki.test.skipStart>
<!-- Allow skipping the unpack -->
<xwiki.test.skipUnpack>false</xwiki.test.skipUnpack>
<xwikiExecutionDirectory>${project.parent.basedir}/target/test-server/xwiki-enterprise-jetty-${xwiki.db}-${xwiki.xe.version}</xwikiExecutionDirectory>
<xwikiExecutionIndex>0</xwikiExecutionIndex>
</properties>
<!--
profile taken from
https://github.com/xwiki/xwiki-enterprise/blob/master/pom.xml
some extras deleted.
-->
<profiles>
<profile>
<id>hsqldb</id>
<!-- Activate this profile by default. Note that it you wish to run with another profile you'll need to explicitly
add this profile -->
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<xwiki.xe.version>4.1.3</xwiki.xe.version>
<xwiki.db>hsqldb</xwiki.db>
<xwiki.db.jdbc.groupId>org.hsqldb</xwiki.db.jdbc.groupId>
<xwiki.db.jdbc.artifactId>hsqldb</xwiki.db.jdbc.artifactId>
<xwiki.db.jdbc.version>2.2.8</xwiki.db.jdbc.version>
</properties>
</profile>
</profiles>

</project>
2 changes: 1 addition & 1 deletion xwiki-android-client/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:icon="@drawable/icon"
android:label="@string/app_name" >
<activity
android:name=".Main"
android:name=".org.xwiki.android.test.org.xwiki.test.integration.Main"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
7 changes: 4 additions & 3 deletions xwiki-android-client/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

# Project target.
target=android-7

android.library.reference.3=../xwiki-android-core
android.library.reference.1=../xwiki-android-components
android.library.reference.2=../xwiki-android-rest
android.library.reference.2=../xwiki-android-core
android.library.reference.3=../xwiki-android-rest


2 changes: 2 additions & 0 deletions xwiki-android-components/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ android.library=true
# Project target.
target=android-7
android.library.reference.1=../xwiki-android-core
android.library.reference.2=../xwiki-android-rest

2 changes: 1 addition & 1 deletion xwiki-android-components/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, Main!</string>
<string name="hello">Hello World, org.xwiki.android.test.org.xwiki.test.integration.Main!</string>
<string name="app_name">Xwiki Components</string>
<string name="main_no_items">No items</string>
<string name="xwikiNavigatorListClick">xwikiNavigatorListClick</string>
Expand Down
1 change: 1 addition & 0 deletions xwiki-android-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

<artifactId>xwiki-android-core</artifactId>
<packaging>apklib</packaging>
<version>1.0-SNAPSHOT</version>
<name>XWiki android core lib</name>

<dependencies>
Expand Down
1 change: 1 addition & 0 deletions xwiki-android-core/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
target=android-7
android.library=true
android.library.reference.1=../xwiki-android-rest

Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public void updateToAuthenticatedState(User user)

public static XWikiApplicationContext getInstance()
{
return currContext;
if(currContext==null) throw new RuntimeException("please set XWikiApplicationContext in android manifest <application android:name");
return currContext;
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,18 @@ public interface DocumentRao extends Rao<Document>
* doc.set("XOMyClass/0",o1)
* the create method adds the same object twice to the remote page.
* @param doc
* @return created document extracted from server.
*/
@Override
public Document create(Document doc) throws RestConnectionException ,RaoException;

/**
* check wether the doc exists on server
* @param dref
* @return
*/
public boolean exists(DocumentReference dref) throws RestConnectionException,RaoException;;

/**
* default semantics
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package org.xwiki.android.rest.ral;

import java.util.Properties;

import org.xwiki.android.resources.Space;
import org.xwiki.android.resources.Wiki;
import org.xwiki.android.rest.RestConnection;
import org.xwiki.android.rest.XWikiAPI;
import org.xwiki.android.xmodel.entity.Document;

public interface RESTfulManager
Expand All @@ -11,4 +15,9 @@ public interface RESTfulManager
SpaceRao newSpaceRao();

WikiRao newWikiRao();

RestConnection getConnection();



}
2 changes: 2 additions & 0 deletions xwiki-android-core/src/org/xwiki/android/rest/ral/Rao.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
interface Rao<T>
{
T create(T resrc) throws RestConnectionException,RaoException;

boolean exists(T resrc) throws RestConnectionException,RaoException;

T retreive(T resrc) throws RestConnectionException,RaoException;

Expand Down
Loading

0 comments on commit b27bcff

Please sign in to comment.