Skip to content

Commit

Permalink
Added comment upload logic to RAL create.
Browse files Browse the repository at this point in the history
edit parent pom.
  • Loading branch information
sasinda committed Aug 15, 2012
1 parent b27bcff commit 2889179
Show file tree
Hide file tree
Showing 16 changed files with 1,279 additions and 1,036 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
<type>zip</type>
</artifactItem>
</artifactItems>
<outputDirectory>${xwikiExecutionDirectory}/../</outputDirectory>
<outputDirectory>${xwikiServerUnpackDirectory}</outputDirectory>
<!-- Allow skipping the unpack -->
<skip>${xwiki.test.skipUnpack}</skip>
</configuration>
Expand Down Expand Up @@ -181,6 +181,7 @@
<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>
<xwikiServerUnpackDirectory>${project.parent.basedir}/target/test-server/</xwikiServerUnpackDirectory>
</properties>
<!--
profile taken from
Expand Down
13 changes: 4 additions & 9 deletions xwiki-android-client/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
android:icon="@drawable/icon"
android:label="@string/app_name" >
<activity
android:name=".org.xwiki.android.test.org.xwiki.test.integration.Main"
android:name=".Main"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand All @@ -47,7 +46,6 @@
<action android:name="android.intent.action.MAIN" />
<action android:name="xwiki.android.action.MAIN" />
<action android:name="xwiki.android.action.BLOG" />

<category android:name="xwiki.android.category.LAUNCHER" />
</intent-filter>
</activity>
Expand All @@ -58,8 +56,7 @@
<action android:name="android.intent.action.MAIN" />
<action android:name="xwiki.android.action.MAIN" />
<action android:name="xwiki.android.action.NAVIGATOR" />

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="xwiki.android.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
Expand All @@ -69,8 +66,7 @@
<action android:name="android.intent.action.MAIN" />
<action android:name="xwiki.android.action.MAIN" />
<action android:name="xwiki.android.action.CONFIGURATION" />

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="xwiki.android.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
Expand All @@ -80,8 +76,7 @@
<action android:name="android.intent.action.MAIN" />
<action android:name="xwiki.android.action.MAIN" />
<action android:name="xwiki.android.action.QuickTests" />

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="xwiki.android.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
Expand Down
118 changes: 83 additions & 35 deletions xwiki-android-client/src/org/xwiki/android/client/dev/QuickTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,64 +10,112 @@
import org.xwiki.android.data.fileStore.FSDocumentReference;
import org.xwiki.android.entity.SyncOutEntity;


import org.xwiki.android.rest.RestConnectionException;
import org.xwiki.android.rest.ral.DocumentRao;
import org.xwiki.android.rest.ral.RaoException;
import org.xwiki.android.rest.reference.DocumentReference;
import org.xwiki.android.security.Master;

import org.xwiki.android.xmodel.entity.Comment;
import org.xwiki.android.xmodel.entity.Document;
import com.j256.ormlite.dao.Dao;


import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;

/**
* class for test purposes .
*
* @author xwiki gsoc 2012
*
*
*/
public class QuickTest extends Activity {
public class QuickTest extends Activity
{
private static final String TAG = "Quikc TEST";

@Override
protected void onCreate(Bundle savedInstanceState) {
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.quicktest);
AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
alertbox.setMessage("Only a code testing/exploration activity.remove this from production");
alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface arg0, int arg1){}
});
alertbox.show();

/*XWikiApplicationContext ctx=(XWikiApplicationContext)getApplicationContext();
EntityManager em=ctx.newEntityManager();
try {
Dao<SyncOutEntity,Integer> dao=em.getDao(SyncOutEntity.class);
List<SyncOutEntity> lst = dao.queryForAll();
SyncOutEntity s=lst.get(0);
FSDocumentReference dr=s.getFSDocref();
Dao<FSDocumentReference,Integer> fsdao=em.getDao(FSDocumentReference.class);
dr=fsdao.queryForSameId(dr);
alertbox.setMessage("dr Page Name: "+dr.getPageName()+" id:"+dr.get_id());
alertbox.show();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/

//test enc
Master secMstr=new Master();
String cipher=secMstr.encryptPassword("abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()");
Log.d( TAG, cipher);
Log.d(TAG, secMstr.decryptPassword(cipher));
alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface arg0, int arg1)
{
}
});
alertbox.show();

/*
* XWikiApplicationContext
* ctx=(XWikiApplicationContext)getApplicationContext(); EntityManager
* em=ctx.newEntityManager(); try { Dao<SyncOutEntity,Integer>
* dao=em.getDao(SyncOutEntity.class); List<SyncOutEntity> lst =
* dao.queryForAll();
*
* SyncOutEntity s=lst.get(0); FSDocumentReference dr=s.getFSDocref();
* Dao<FSDocumentReference,Integer>
* fsdao=em.getDao(FSDocumentReference.class);
* dr=fsdao.queryForSameId(dr);
* alertbox.setMessage("dr Page Name: "+dr.getPageName
* ()+" id:"+dr.get_id()); alertbox.show();
*
* } catch (SQLException e) { // TODO Auto-generated catch block
* e.printStackTrace(); }
*/

// test enc
// Master secMstr=new Master();
// String
// cipher=secMstr.encryptPassword("abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()");
// Log.d( TAG, cipher);
// Log.d(TAG, secMstr.decryptPassword(cipher));

/**
* test doc create
*/
// Comment c1,c2;
// Document doc=new Document("xwiki", "Blog", "tempTestPage" );
// doc.setTitle("tempTestPage");
// c1 = new Comment("hi");
// c2 = new Comment("reply to hi");
// c1.addReplyComment(c2);
// doc.addComment(c1, true);

// ;;;;;;;;;;;;;
Comment c1, c2, c3, c4;
Document doc = new Document("xwiki", "Blog", "tempTestPage");
doc.setTitle("tempTestPage");
c1 = new Comment("0");
c2 = new Comment("1");
c3 = new Comment("2");
c3.setId(2);
c4 = new Comment("3");
c4.setId(3);

c1.addReplyComment(c2);
c3.addReplyComment(c4);

doc.addComment(c1, true);
doc.setComment(c3);
doc.setComment(c4);

DocumentRao rao = XWikiApplicationContext.getInstance().newRESTfulManager().newDocumentRao();

try {
rao.delete(doc);
rao.create(doc);
} catch (RestConnectionException e) {
e.printStackTrace();
} catch (RaoException e) {
e.printStackTrace();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ class Verifier

private static final String TAG ="RAL Verifier";

/**
*
/**
* @param doc
* @return verification result. success=true
*/
static boolean verifyDocumentForCreate(Document doc){
boolean title=false; //verify title set
title=(doc.getTitle()!=null & !doc.getTitle().equals(""));
title=(doc.getTitle()!=null && !doc.getTitle().equals(""));
if(!title){
Log.w(TAG, "doc must have a title. For XWiki version 3.x and below.");
}
Expand Down
Loading

0 comments on commit 2889179

Please sign in to comment.