|
From: <tre...@us...> - 2007-08-27 23:52:57
|
Revision: 275
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=275&view=rev
Author: trevorolio
Date: 2007-08-27 16:52:59 -0700 (Mon, 27 Aug 2007)
Log Message:
-----------
Added ServiceState docs and API. Added test cube and cylindar objs. Added fetal mail service. Added abstract remote servlet for apps in the same container which use ogoglio on the back end. Added some email validation code.
Modified Paths:
--------------
maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
Added Paths:
-----------
maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCube.obj
maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCylinder.obj
Modified: maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2007-08-27 23:52:35 UTC (rev 274)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2007-08-27 23:52:59 UTC (rev 275)
@@ -49,6 +49,7 @@
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
import com.ogoglio.xml.PossessionDocument;
+import com.ogoglio.xml.ServiceStateDocument;
import com.ogoglio.xml.ShapeDocument;
import com.ogoglio.xml.SpaceDocument;
import com.ogoglio.xml.SpaceMemberDocument;
@@ -78,7 +79,6 @@
WebAPIDescriptor descriptor1 = null;
-
public void setUp() {
try {
serviceURI1 = new URI("http://127.0.0.1:8080/og/"); //best choice: 127.0.0.1 for tests
@@ -97,21 +97,14 @@
public void testWebAdmin() {
try {
- WebAPIAuthenticator adminAuthenticator =
- new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1,
- //"library","fart98121");
- WebConstants.getBootstrapUsername(), WebConstants.getBootstrapUserPW());
+ WebAPIAuthenticator adminAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1, WebConstants.getBootstrapUsername(), WebConstants.getBootstrapUserPW());
assertNotNull("got null auth cookie", adminAuthenticator.getAuthCookie());
WebAPIClient adminWebClient = new WebAPIClient(descriptor1, adminAuthenticator, wire1);
- try {
- adminWebClient.createAccount(USERNAME1, AccountDocument.ACCOUNT_LEVEL_ADVANCED, "Susan", "Examplar", "http://example.com/susan/", "su...@ex...", PASSWORD1);
- adminWebClient.createAccount(USERNAME2, AccountDocument.ACCOUNT_LEVEL_ADVANCED, "Tina", "Examplar", "http://example.com/tina/", "ti...@ex...", PASSWORD1);
- } catch (IOException e) {
- //may already exist
- }
+ adminWebClient.createAccount(USERNAME1, AccountDocument.ACCOUNT_LEVEL_ADVANCED, "Susan", "Examplar", "http://example.com/susan/", "su...@ex...", PASSWORD1);
+ adminWebClient.createAccount(USERNAME2, AccountDocument.ACCOUNT_LEVEL_ADVANCED, "Tina", "Examplar", "http://example.com/tina/", "ti...@ex...", PASSWORD1);
- WebAPIAuthenticator basicAuthenticator = new WebAPIAuthenticator(wire1, descriptor1, USERNAME1, PASSWORD1);
+ WebAPIAuthenticator basicAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1, USERNAME1, PASSWORD1);
assertNotNull("got null auth cookie", basicAuthenticator.getAuthCookie());
WebAPIClient basicWebClient = new WebAPIClient(descriptor1, basicAuthenticator, wire1);
try {
@@ -124,6 +117,27 @@
//this should happen, because basic accounts can't create new accounts
}
+ WebAPIGuestAuthenticator guestAuthenticator = new WebAPIAuthenticatorFactory().authenticate(descriptor1, WebConstants.GUEST_COOKIE_PREFIX + "Test_Suite_Guest1");
+ WebAPIClient guestWebClient = new WebAPIClient(descriptor1, guestAuthenticator, wire1);
+
+ ServiceStateDocument serviceStateDoc = adminWebClient.setRegistrationState(ServiceStateDocument.REGISTRATION_STATE_CLOSED);
+ assertEquals(ServiceStateDocument.REGISTRATION_STATE_CLOSED, serviceStateDoc.getRegistrationState());
+ assertNull(adminWebClient.createAccount("shouldnotexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, System.currentTimeMillis() + "@example.com", "1234"));
+ assertNull(basicWebClient.createAccount("shouldnotexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, System.currentTimeMillis() + "@example.com", "1234"));
+ assertNull(guestWebClient.createAccount("shouldnotexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, System.currentTimeMillis() + "@example.com", "1234"));
+
+ serviceStateDoc = adminWebClient.setRegistrationState(ServiceStateDocument.REGISTRATION_STATE_OPEN);
+ assertEquals(ServiceStateDocument.REGISTRATION_STATE_OPEN, serviceStateDoc.getRegistrationState());
+ assertNotNull(adminWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, System.currentTimeMillis() + "@example.com", "1234"));
+ assertNotNull(basicWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, System.currentTimeMillis() + "@example.com", "1234"));
+ assertNotNull(guestWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, System.currentTimeMillis() + "@example.com", "1234"));
+
+ serviceStateDoc = adminWebClient.setRegistrationState(ServiceStateDocument.REGISTRATION_STATE_ADMIN_ONLY);
+ assertEquals(ServiceStateDocument.REGISTRATION_STATE_ADMIN_ONLY, serviceStateDoc.getRegistrationState());
+ assertNotNull(adminWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, System.currentTimeMillis() + "@example.com", "1234"));
+ assertNull(basicWebClient.createAccount("shouldnotexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, System.currentTimeMillis() + "@example.com", "1234"));
+ assertNull(guestWebClient.createAccount("shouldnotexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, System.currentTimeMillis() + "@example.com", "1234"));
+
String username = "testuser" + Math.abs(new Random().nextLong());
adminWebClient.createAccount(username, AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, username + "@example.com", "1234");
@@ -141,8 +155,8 @@
assertEquals(AccountDocument.ACCOUNT_LEVEL_ADMIN, accountDoc.getAccountLevel());
accountDoc.setFrozenUntil(new Date(1000));
accountDoc.setAccountLevel(AccountDocument.ACCOUNT_LEVEL_BASIC);
- accountDoc=adminWebClient.updateAccount(accountDoc);
- AccountDocument ac2= adminWebClient.getAccountDocument(username);
+ accountDoc = adminWebClient.updateAccount(accountDoc);
+ AccountDocument ac2 = adminWebClient.getAccountDocument(username);
assertNull(accountDoc.getFrozenUntil());
assertNull(ac2.getFrozenUntil());
assertEquals(AccountDocument.ACCOUNT_LEVEL_BASIC, accountDoc.getAccountLevel());
@@ -170,31 +184,30 @@
checkNoConnectionToSpaceWithoutAuth(spaceDocument.getSpaceID());
checkAuthDoc(auth1, auth2);
-
+
spaceDocument = checkSpaceSeaLevel(webClient1, spaceDocument);
-
+
checkSettings(spaceDocument.getSpaceID(), webClient1);
-
+
checkBody(webClient1, auth1);
checkSpaceMembership(spaceDocument.getSpaceID(), webClient1);
checkSpaceAuthWithMembership(auth2, webClient2, webClient1, spaceDocument);
-
+
TemplateDocument newTemplateDoc = checkTemplateScriptAPI(webClient1);
ThingDocument[] thingDocs = checkTemplateGeomMaterialsAndPossessions(webClient1, newTemplateDoc, spaceDocument);
-
-
+
//IES CHECK: after messing around above, verify we are are ok
thingDocs = webClient1.getThingDocuments(spaceDocument.getSpaceID());
assertEquals(1, thingDocs.length);
checkPageManipulation(webClient1, thingDocs[0], spaceDocument);
-
+
//figure out the last template added
TemplateDocument[] templateDocs = webClient1.getTemplateDocuments(USERNAME1);
long lastTemplateID = templateDocs[templateDocs.length - 1].getTemplateID();
-
+
checkDoors(webClient1, spaceDocument, lastTemplateID);
spaceClient1 = checkConnectedUsersToSpace(auth1, webClient1, spaceDocument);
@@ -207,7 +220,7 @@
guestSpaceClient1 = checkGuestCookieOperation(spaceDocument.getSpaceID(), webClient1, WebConstants.GUEST_COOKIE_PREFIX + "Test_Suite_Guest");
checkDeletingSpaceDestroysThings(spaceDocument.getSpaceID(), webClient1, USERNAME1);
-
+
} catch (IOException e) {
e.printStackTrace();
fail();
@@ -291,12 +304,12 @@
String key1 = "ogoglio.key.1";
String value1 = "This is a very fine value which is < 1";
Object v = webClient1.getSpaceSetting(spaceID, key1);
-
+
assertNull(v);
-
+
webClient1.putSpaceSetting(spaceID, key1, value1);
assertEquals(value1, webClient1.getSpaceSetting(spaceID, key1));
-
+
String key2 = "ogoglio.key.2";
String value2 = "This is a very fine value & it's value is > 2";
assertNull(webClient1.getSpaceSetting(spaceID, key2));
@@ -308,7 +321,7 @@
assertNull(webClient1.getSpaceSetting(spaceID, key1));
webClient1.removeSpaceSetting(spaceID, key2);
assertNull(webClient1.getSpaceSetting(spaceID, key2));
-
+
}
private void checkBody(WebAPIClient webClient1, WebAPIAuthenticator authenticator) throws IOException {
@@ -517,10 +530,10 @@
String CUBE_GIF = "TestCube.gif";
String CUBE_MATERIAL = "TestCube.mtl";
- Class clazz=getClass();
+ Class clazz = getClass();
webClient1.uploadTemplateGeometryStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), 0, clazz.getResourceAsStream("/sample-art3d/TestCube.obj"));
webClient1.uploadTemplateResourceStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), CUBE_MATERIAL, clazz.getResourceAsStream("/sample-art3d/TestCube.mtl"));
- webClient1.uploadTemplateResourceStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), CUBE_GIF, clazz.getResourceAsStream("/sample-art3d/TestCube.gif"));
+ webClient1.uploadTemplateResourceStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), CUBE_GIF, clazz.getResourceAsStream("/sample-art3d/TestCube.gif"));
webClient1.updateTemplateScript(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), StreamUtils.readInput(clazz.getResourceAsStream("/sample-art3d/TestCube.js")));
baseDoc = webClient1.getTemplateDocument(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID());
@@ -552,7 +565,7 @@
}
//change the geometry to the cylinder
- webClient1.uploadTemplateGeometryStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), 0, getClass().getResourceAsStream("/sample-art3d/TestCylinder.obj"));
+ webClient1.uploadTemplateGeometryStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), 0, getClass().getResourceAsStream("/sample-art3d/TestCylinder.obj"));
afterCylDoc = webClient1.getTemplateDocument(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID());
verifyLastChangedTimes(baseDoc.getGeometryModifiedTime(0), afterCylDoc.getGeometryModifiedTime(0), 1000, true, false);
@@ -564,7 +577,6 @@
assertEquals(spaceDocument.getSpaceID(), possDoc.getSpaceID());
assertEquals(thingDocs[0].getThingID(), possDoc.getThingID());
-
webClient1.reloadThing(spaceDocument.getSpaceID(), thingDocs[0].getThingID());
try {
@@ -572,7 +584,7 @@
} catch (Exception e) {
}
-
+
//we done reload better check again
thingDocs = webClient1.getThingDocuments(spaceDocument.getSpaceID());
@@ -711,7 +723,7 @@
public void receivedBrowserMessage(long sourceThingID, String message) {
}
- public void receivedContextMenuRequest(Thing thing,String shapeName, int x, int y, long nonce) {
+ public void receivedContextMenuRequest(Thing thing, String shapeName, int x, int y, long nonce) {
}
public void receivedContextMenuData(long nonce, String errorIfAny, Vector contextMenu) {
@@ -854,28 +866,26 @@
public void userAnimationStarted(User user, long animationID) {
}
- public void shapeMotionStarted(com.ogoglio.client.model.Shape shape,
- SplinePath path) {
- // TODO Auto-generated method stub
-
- }
+ public void shapeMotionStarted(com.ogoglio.client.model.Shape shape, SplinePath path) {
+ // TODO Auto-generated method stub
- public void shapeMotionStopped(com.ogoglio.client.model.Shape shape,
- Transform3D position) {
- // TODO Auto-generated method stub
-
- }
+ }
- public void templateAdded(com.ogoglio.client.model.Template template) {
- // TODO Auto-generated method stub
-
- }
+ public void shapeMotionStopped(com.ogoglio.client.model.Shape shape, Transform3D position) {
+ // TODO Auto-generated method stub
- public void templateRemoved(com.ogoglio.client.model.Template template) {
- // TODO Auto-generated method stub
-
- }
+ }
+ public void templateAdded(com.ogoglio.client.model.Template template) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void templateRemoved(com.ogoglio.client.model.Template template) {
+ // TODO Auto-generated method stub
+
+ }
+
}
}
Added: maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCube.obj
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCube.obj (rev 0)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCube.obj 2007-08-27 23:52:59 UTC (rev 275)
@@ -0,0 +1,44 @@
+# Blender3D v243 OBJ File: TestCube.blend
+# www.blender3d.org
+mtllib TestCube.mtl
+o Cube
+v 1.000000 2.000000 -1.000000
+v 1.000000 0.000000 -1.000000
+v -1.000000 0.000000 -1.000000
+v -1.000000 2.000000 -1.000000
+v 1.000000 2.000000 1.000000
+v 0.999999 -0.000001 1.000000
+v -1.000000 0.000000 1.000000
+v -1.000000 2.000000 1.000000
+vt 0.499999 0.249999 0.0
+vt 0.499999 0.499999 0.0
+vt 0.250000 0.499999 0.0
+vt 0.250000 0.249999 0.0
+vt 0.500000 0.999999 0.0
+vt 0.249999 0.999999 0.0
+vt 0.249999 0.749998 0.0
+vt 0.500000 0.749998 0.0
+vt 0.749999 0.499998 0.0
+vt 0.749999 0.749998 0.0
+vt 0.500000 0.749998 0.0
+vt 0.499999 0.499999 0.0
+vt 0.499999 0.499999 0.0
+vt 0.500000 0.749998 0.0
+vt 0.249999 0.749998 0.0
+vt 0.250000 0.499999 0.0
+vt 0.250000 0.499999 0.0
+vt 0.249999 0.749998 0.0
+vt 0.000000 0.749998 0.0
+vt 0.000000 0.499999 0.0
+vt 0.499999 0.000000 0.0
+vt 0.499999 0.249999 0.0
+vt 0.250000 0.249999 0.0
+vt 0.249999 0.000000 0.0
+usemtl Material_Numbers.gif
+s 1
+f 1/1 2/2 3/3 4/4
+f 5/5 8/6 7/7 6/8
+f 1/9 5/10 6/11 2/12
+f 2/13 6/14 7/15 3/16
+f 3/17 7/18 8/19 4/20
+f 5/21 1/22 4/23 8/24
Added: maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCylinder.obj
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCylinder.obj (rev 0)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCylinder.obj 2007-08-27 23:52:59 UTC (rev 275)
@@ -0,0 +1,164 @@
+o Cylinder
+v 0.707107 -1.000000 -0.707107
+v 0.831470 -1.000000 -0.555571
+v 0.923880 -1.000001 -0.382684
+v 0.980785 -1.000001 -0.195091
+v 1.000000 -1.000001 -0.000001
+v 0.980785 -1.000001 0.195090
+v 0.923880 -1.000001 0.382683
+v 0.831470 -1.000001 0.555570
+v 0.707107 -1.000001 0.707106
+v 0.555570 -1.000001 0.831469
+v 0.382683 -1.000001 0.923879
+v 0.195090 -1.000001 0.980785
+v -0.000000 -1.000001 0.999999
+v -0.195091 -1.000001 0.980785
+v -0.382684 -1.000001 0.923879
+v -0.555571 -1.000001 0.831469
+v -0.707107 -1.000001 0.707106
+v -0.831470 -1.000001 0.555569
+v -0.923880 -1.000001 0.382682
+v -0.980785 -1.000001 0.195089
+v -1.000000 -1.000001 -0.000002
+v -0.980785 -1.000001 -0.195092
+v -0.923879 -1.000001 -0.382685
+v -0.831469 -1.000000 -0.555572
+v -0.707106 -1.000000 -0.707108
+v -0.555569 -1.000000 -0.831471
+v -0.382682 -1.000000 -0.923881
+v -0.195089 -1.000000 -0.980786
+v 0.000002 -1.000000 -1.000001
+v 0.195092 -1.000000 -0.980786
+v 0.382685 -1.000000 -0.923880
+v 0.555572 -1.000000 -0.831469
+v 0.707108 0.999999 -0.707106
+v 0.831471 0.999999 -0.555569
+v 0.923880 0.999999 -0.382682
+v 0.980786 0.999999 -0.195089
+v 1.000000 0.999999 0.000002
+v 0.980785 0.999999 0.195092
+v 0.923879 0.999999 0.382684
+v 0.831469 0.999999 0.555571
+v 0.707106 0.999999 0.707107
+v 0.555570 0.999999 0.831469
+v 0.382684 0.999999 0.923879
+v 0.195091 0.999999 0.980785
+v 0.000001 0.999999 0.999999
+v -0.195089 0.999999 0.980785
+v -0.382682 0.999999 0.923880
+v -0.555568 0.999999 0.831470
+v -0.707105 0.999999 0.707108
+v -0.831468 0.999999 0.555572
+v -0.923878 0.999999 0.382686
+v -0.980785 0.999999 0.195093
+v -1.000000 0.999999 0.000004
+v -0.980786 0.999999 -0.195086
+v -0.923881 0.999999 -0.382679
+v -0.831473 0.999999 -0.555566
+v -0.707111 0.999999 -0.707103
+v -0.555575 1.000000 -0.831467
+v -0.382689 1.000000 -0.923878
+v -0.195097 1.000000 -0.980784
+v -0.000007 1.000000 -1.000000
+v 0.195083 1.000000 -0.980787
+v 0.382676 1.000000 -0.923883
+v 0.555563 1.000000 -0.831475
+v 0.000000 -1.000001 -0.000001
+v 0.000000 0.999999 -0.000001
+s 1
+f 65 1 2
+f 66 34 33
+f 65 2 3
+f 66 35 34
+f 65 3 4
+f 66 36 35
+f 65 4 5
+f 66 37 36
+f 65 5 6
+f 66 38 37
+f 65 6 7
+f 66 39 38
+f 65 7 8
+f 66 40 39
+f 65 8 9
+f 66 41 40
+f 65 9 10
+f 66 42 41
+f 65 10 11
+f 66 43 42
+f 65 11 12
+f 66 44 43
+f 65 12 13
+f 66 45 44
+f 65 13 14
+f 66 46 45
+f 65 14 15
+f 66 47 46
+f 65 15 16
+f 66 48 47
+f 65 16 17
+f 66 49 48
+f 65 17 18
+f 66 50 49
+f 65 18 19
+f 66 51 50
+f 65 19 20
+f 66 52 51
+f 65 20 21
+f 66 53 52
+f 65 21 22
+f 66 54 53
+f 65 22 23
+f 66 55 54
+f 65 23 24
+f 66 56 55
+f 65 24 25
+f 66 57 56
+f 65 25 26
+f 66 58 57
+f 65 26 27
+f 66 59 58
+f 65 27 28
+f 66 60 59
+f 65 28 29
+f 66 61 60
+f 65 29 30
+f 66 62 61
+f 65 30 31
+f 66 63 62
+f 65 31 32
+f 66 64 63
+f 32 1 65
+f 66 33 64
+f 1 33 34 2
+f 2 34 35 3
+f 3 35 36 4
+f 4 36 37 5
+f 5 37 38 6
+f 6 38 39 7
+f 7 39 40 8
+f 8 40 41 9
+f 9 41 42 10
+f 10 42 43 11
+f 11 43 44 12
+f 12 44 45 13
+f 13 45 46 14
+f 14 46 47 15
+f 15 47 48 16
+f 16 48 49 17
+f 17 49 50 18
+f 18 50 51 19
+f 19 51 52 20
+f 20 52 53 21
+f 21 53 54 22
+f 22 54 55 23
+f 23 55 56 24
+f 24 56 57 25
+f 25 57 58 26
+f 26 58 59 27
+f 27 59 60 28
+f 28 60 61 29
+f 29 61 62 30
+f 30 62 63 31
+f 31 63 64 32
+f 33 1 32 64
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|