Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Commit

Permalink
Working reply example in Main class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martín Schonaker committed Jul 26, 2010
1 parent ca1b4fa commit 9cca73b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
9 changes: 9 additions & 0 deletions wave-api/src/main/java/com/google/wave/api/AbstractWave.java
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,15 @@ private List<JsonRpcResponse> makeRpc(OperationQueue opQueue,
}
return responses;
}

public void send(Wavelet wavelet, String rpcServerUrl) {
try {
makeRpc(wavelet.getOperationQueue(), rpcServerUrl);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

/**
* Serializes the given outgoing operations into a JSON string, and put it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public OAuthMessage send(String url, String contentType, String body) {

// Make the HTTP call.
OAuthMessage response = authClient.access(message,
ParameterStyle.BODY);
ParameterStyle.AUTHORIZATION_HEADER);

return response;

Expand Down
22 changes: 19 additions & 3 deletions wave-api/src/test/java/net/processone/wave/api/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import net.processone.oauth.Token;

import org.junit.Ignore;
import org.waveprotocol.wave.model.id.WaveId;
import org.waveprotocol.wave.model.id.WaveletId;

import com.google.wave.api.Wavelet;
import com.google.wave.api.SearchResult.Digest;

@Ignore
Expand Down Expand Up @@ -40,9 +43,22 @@ public static void main(String[] args) throws Exception {
.getRequestToken().getSecret());

// Search.
List<Digest> digests = api.search("in:inbox");
List<Digest> digests = api.search("title:\"solo para ir probando\"");

for (Digest digest : digests)
System.out.println(digest.getTitle());
if (digests.size() != 1) {
for (Digest digest : digests)
System.out.println(digest.getTitle());
return;
}

Digest digest = digests.get(0);

Wavelet wavelet = api.fetchWavelet(WaveId.deserialise(digest
.getWaveId()), new WaveletId("googlewave.com", "conv+root"),
settings.getRpcHandler());

wavelet.reply("\nhola!");

api.send(wavelet, settings.getRpcHandler());
}
}

0 comments on commit 9cca73b

Please sign in to comment.