From: cvs@openprivacy.orgCVS update: sierra/src/java/org/openprivacy/sierra/tests
Date: Wednesday March 21, 19101 @ 21:44
Author: burton
CVSWEB Options: -------------------
Main CVSWeb: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi
View this module: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/tests
-----------------------------------
Update of /usr/local/cvs/public/sierra/src/java/org/openprivacy/sierra/tests
In directory giga:/tmp/cvs-serv28845/src/java/org/openprivacy/sierra/tests
Modified Files:
Test9.java
Log Message:
step 2 works
*****************************************************************
File: sierra/src/java/org/openprivacy/sierra/tests/Test9.java
CVSWEB Options: -------------------
CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/tests/Test9.java?annotate=1.16
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/tests/Test9.java?rev=1.16&content-type=text/x-cvsweb-markup
CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/tests/Test9.java.diff?r1=1.16&r2=1.15
-----------------------------------
Index: sierra/src/java/org/openprivacy/sierra/tests/Test9.java
diff -u sierra/src/java/org/openprivacy/sierra/tests/Test9.java:1.15 sierra/src/java/org/openprivacy/sierra/tests/Test9.java:1.16
--- sierra/src/java/org/openprivacy/sierra/tests/Test9.java:1.15 Wed Mar 21 12:59:38 2001
+++ sierra/src/java/org/openprivacy/sierra/tests/Test9.java Wed Mar 21 21:44:05 2001
@@ -1,7 +1,7 @@
/*
* ----
*
- * $Id: Test9.java,v 1.15 2001/03/21 20:59:38 burton Exp $
+ * $Id: Test9.java,v 1.16 2001/03/22 05:44:05 burton Exp $
* $Project: http://sierra.openprivacy.org $
* $CVSROOT: :pserver:anoncvs@sierra.openprivacy.org:/usr/local/cvs/public $
* $WebCVS: http://www.openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/ $
@@ -54,7 +54,7 @@
* <p>
* <b>Definitions:</b>
* <ul>
- * <li><b>JS1:</b> JetsPeek agent 1. Backend engine/server which is an
+ * <li><b>R1:</b> Reptile agent 1. Backend engine/server which is an
* intermediary betwen A1 and A2.
*
* <li><b>A1:</b> Agent 1. First peer into the system. Sets up initial
@@ -68,17 +68,17 @@
* <p>
* <ul>
*
- * <li><i>JS1:</i> Fetches some RSS channels and creates reputations with
+ * <li><i>R1:</i> Fetches some RSS channels and creates reputations with
* these URLs.
*
- * <li><i>A1:</i> Does a getReputation request for the RSS channels added byte JS1.
+ * <li><i>A1:</i> Does a getReputation request for the RSS channels added byte R1.
*
* <li><i>A2:</i> Does a getReputation request for the RSS channels..
*
* </ul>
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Test9.java,v 1.15 2001/03/21 20:59:38 burton Exp $
+ * @version $Id: Test9.java,v 1.16 2001/03/22 05:44:05 burton Exp $
*/
public class Test9 extends BaseTest {
@@ -92,7 +92,7 @@
private NymBuilder a2 = null;
- private NymBuilder js1 = null;
+ private NymBuilder r1 = null;
public void initialize( TestletContext context ) throws Exception {
@@ -106,47 +106,50 @@
this.a2 = getNymBuilder( "urn:fen" );
- this.js1 = getNymBuilder( "urn:jetspeek" );
+ this.r1 = getNymBuilder( "urn:reptile" );
- Reputation reputation = SierraResources.getReputation();
+ step_one();
- Reference reference = SierraResources.getReference();
+ step_two();
- reference.setURI( new URI( "http://www.openprivacy.org" ) );
+ ((org.openprivacy.sierra.store.talon.implementations.simple.SimpleStoreEngine)se).dump();
- reputation.setReference( reference );
+ //step_three();
+
+ }
- PropertyManagerPayload pmp1 = (PropertyManagerPayload)ComponentFactory
- .getInstance( PropertyManagerPayload.class.getName() );
+ /**
+ * Pretend to be Reptile and pull down some RSS channels.
+ *
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: Test9.java,v 1.16 2001/03/22 05:44:05 burton Exp $
+ */
+ public void step_one() throws Exception {
+
+ Reputation channel_one = SierraResources.getReputation();
- //openprivacy:///reserved-properties/reputations/quality
+ channel_one.setReference( "http://www.slashdot.org/slashdot.rdf" );
- pmp1.setString( "foo", "bar" );
- pmp1.setString( "Free Software Foundation", "good" );
+ PropertyManagerPayload pmp = getPayload();
+ pmp.setString( "openprivacy:///reserved-properties/ontology", "rss" );
+ channel_one.addPayload( pmp );
- reputation.addPayload( pmp1 );
-
- ReputationConstrainer.constrain( reputation, js1 );
+ ReputationConstrainer.constrain( channel_one, r1 );
- se.put( reputation );
+ se.put( channel_one );
- executeQuery( se );
- }
-
- public void run_test() throws Exception {
-
}
/**
- * Test out a query execution...
+ * A1 runs a query to try to find
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Test9.java,v 1.15 2001/03/21 20:59:38 burton Exp $
+ * @version $Id: Test9.java,v 1.16 2001/03/22 05:44:05 burton Exp $
*/
- private void executeQuery( StoreEngine se ) throws Exception {
-
+ public void step_two() throws Exception {
+
//get its QueryManager
QueryManager qm = se.getQueryManager();
@@ -154,10 +157,62 @@
PropertyManagerTargetedQuery query = (PropertyManagerTargetedQuery)ComponentFactory
.getInstance( PropertyManagerTargetedQuery.class );
- query.setString( "foo", "bar" );
+ query.setString( "openprivacy:///reserved-properties/ontology", "rss" );
//execute a Query.
Result result = qm.execute( query );
+
+ //dump the result:
+ URI[] reputationURIs = result.getReputations();
+
+ for ( int i = 0; i < reputationURIs.length; ++i ) {
+
+ URI current = reputationURIs[i];
+
+
+ Reputation reputation = se.get( current );
+
+ if ( reputation != null ) {
+ System.out.println( "StepTwo: Found reputation URI: " + current );
+ }
+
+
+ //create a nw reputation via A1 which says that this reputation is "GOOD"
+
+ //createGoodReputation( current.getReference() );
+
+ }
+
+ }
+
+ /**
+ * Used with step_two to create a GOOD reptuation for this object.
+ *
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: Test9.java,v 1.16 2001/03/22 05:44:05 burton Exp $
+ */
+ private void createGoodReputation( Reference reference ) throws Exception {
+
+ Reputation opinion = SierraResources.getReputation();
+
+ opinion.setReference( reference );
+
+ PropertyManagerPayload pmp = getPayload();
+
+ pmp.setString( "openprivacy:///reserved-properties/quality", "GOOD" );
+
+ opinion.addPayload( pmp );
+
+ ReputationConstrainer.constrain( opinion, a1 );
+
+ se.put( opinion );
+
+ }
+
+ private PropertyManagerPayload getPayload() throws Exception {
+
+ return (PropertyManagerPayload)ComponentFactory
+ .getInstance( PropertyManagerPayload.class.getName() );
}
This archive was generated by hypermail 2b30 : Wed Mar 21 2001 - 21:46:07 PST