Skip to content
Permalink
Browse files
Naming methods consistently in the MarconiApi.
  • Loading branch information
Everett Toews committed Dec 19, 2013
1 parent 23d8fa3 commit c64cd4a85007a12a7f2aed3d597d865a47acd26e
Showing 7 changed files with 55 additions and 55 deletions.
@@ -57,24 +57,24 @@ public interface MarconiApi extends Closeable {
* are not echoed back to the client that posted them, unless the client explicitly requests this.
*/
@Delegate
QueueApi getQueueApiForZone(
QueueApi getQueueApiForZoneAndClient(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone,
@HeaderParam("Client-ID") UUID clientId);

/**
* Provides access to Message features.
*
* @param zone The zone where this queue lives.
* @param zone The zone where this queue lives.
* @param clientId A UUID for each client instance. The UUID must be submitted in its canonical form (for example,
* 3381af92-2b9e-11e3-b191-71861300734c). The client generates the Client-ID once. Client-ID
* persists between restarts of the client so the client should reuse that same Client-ID. All
* message-related operations require the use of Client-ID in the headers to ensure that messages
* are not echoed back to the client that posted them, unless the client explicitly requests this.
* @param name Name of the queue.
* @param name Name of the queue.
*/
@Delegate
@Path("/queues/{name}")
MessageApi getMessageApiForZoneAndQueue(
MessageApi getMessageApiForZoneAndClientAndQueue(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone,
@HeaderParam("Client-ID") UUID clientId,
@PathParam("name") String name);
@@ -52,7 +52,7 @@ protected Function<Object, IterableWithMarker<Queue>> markerToNextForArgs(List<O
String zone = String.class.cast(args.get(0));
UUID clientId = UUID.class.cast(args.get(1));

return new ListQueuesAtMarker(api.getQueueApiForZone(zone, clientId));
return new ListQueuesAtMarker(api.getQueueApiForZoneAndClient(zone, clientId));
}

private static class ListQueuesAtMarker implements Function<Object, IterableWithMarker<Queue>> {
@@ -42,7 +42,7 @@ public class ClaimApiLiveTest extends BaseMarconiApiLiveTest {

public void createQueues() throws Exception {
for (String zoneId : zones) {
QueueApi queueApi = api.getQueueApiForZone(zoneId, CLIENT_ID);
QueueApi queueApi = api.getQueueApiForZoneAndClient(zoneId, CLIENT_ID);
boolean success = queueApi.create("jclouds-test");

assertTrue(success);
@@ -52,7 +52,7 @@ public void createQueues() throws Exception {
@Test(dependsOnMethods = { "createQueues" })
public void createMessages() throws Exception {
for (String zoneId : zones) {
MessageApi messageApi = api.getMessageApiForZoneAndQueue(zoneId, CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

String json1 = "{\"event\":{\"name\":\"Austin Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
CreateMessage message1 = CreateMessage.builder().ttl(86400).body(json1).build();
@@ -133,7 +133,7 @@ public void releaseClaim() throws Exception {
@Test(dependsOnMethods = { "releaseClaim" })
public void delete() throws Exception {
for (String zoneId : zones) {
QueueApi queueApi = api.getQueueApiForZone(zoneId, CLIENT_ID);
QueueApi queueApi = api.getQueueApiForZoneAndClient(zoneId, CLIENT_ID);
boolean success = queueApi.delete("jclouds-test");

assertTrue(success);
@@ -47,7 +47,7 @@ public class MessageApiLiveTest extends BaseMarconiApiLiveTest {

public void createQueues() throws Exception {
for (String zoneId : zones) {
QueueApi queueApi = api.getQueueApiForZone(zoneId, CLIENT_ID);
QueueApi queueApi = api.getQueueApiForZoneAndClient(zoneId, CLIENT_ID);
boolean success = queueApi.create("jclouds-test");

assertTrue(success);
@@ -57,7 +57,7 @@ public void createQueues() throws Exception {
@Test(dependsOnMethods = { "createQueues" })
public void streamZeroPagesOfMessages() throws Exception {
for (String zoneId : zones) {
MessageApi messageApi = api.getMessageApiForZoneAndQueue(zoneId, CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

MessageStream messageStream = messageApi.stream(echo(true));

@@ -69,7 +69,7 @@ public void streamZeroPagesOfMessages() throws Exception {
@Test(dependsOnMethods = { "streamZeroPagesOfMessages" })
public void createMessage() throws Exception {
for (String zoneId : zones) {
MessageApi messageApi = api.getMessageApiForZoneAndQueue(zoneId, CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

String json1 = "{\"event\":{\"name\":\"Edmonton Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
CreateMessage message1 = CreateMessage.builder().ttl(120).body(json1).build();
@@ -85,7 +85,7 @@ public void createMessage() throws Exception {
@Test(dependsOnMethods = { "createMessage" })
public void streamOnePageOfMessages() throws Exception {
for (String zoneId : zones) {
MessageApi messageApi = api.getMessageApiForZoneAndQueue(zoneId, CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

MessageStream messageStream = messageApi.stream(echo(true));

@@ -102,7 +102,7 @@ public void streamOnePageOfMessages() throws Exception {
@Test(dependsOnMethods = { "streamOnePageOfMessages" })
public void createMessages() throws Exception {
for (String zoneId : zones) {
MessageApi messageApi = api.getMessageApiForZoneAndQueue(zoneId, CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

String json1 = "{\"event\":{\"name\":\"Austin Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
CreateMessage message1 = CreateMessage.builder().ttl(120).body(json1).build();
@@ -122,7 +122,7 @@ public void createMessages() throws Exception {
@Test(dependsOnMethods = { "createMessages" })
public void streamManyPagesOfMessages() throws Exception {
for (String zoneId : zones) {
MessageApi messageApi = api.getMessageApiForZoneAndQueue(zoneId, CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");
messageIds.put(zoneId, new ArrayList<String>());

MessageStream messageStream = messageApi.stream(echo(true).limit(2));
@@ -144,7 +144,7 @@ public void streamManyPagesOfMessages() throws Exception {
@Test(dependsOnMethods = { "streamManyPagesOfMessages" })
public void listMessagesByIds() throws Exception {
for (String zoneId : zones) {
MessageApi messageApi = api.getMessageApiForZoneAndQueue(zoneId, CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

List<Message> messages = messageApi.list(messageIds.get(zoneId));

@@ -160,7 +160,7 @@ public void listMessagesByIds() throws Exception {
@Test(dependsOnMethods = { "listMessagesByIds" })
public void getMessage() throws Exception {
for (String zoneId : zones) {
MessageApi messageApi = api.getMessageApiForZoneAndQueue(zoneId, CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

Message message = messageApi.get(getLast(messageIds.get(zoneId)));

@@ -173,7 +173,7 @@ public void getMessage() throws Exception {
public void deleteMessagesByClaimId() throws Exception {
for (String zoneId : zones) {
UUID clientId = UUID.fromString("3381af92-2b9e-11e3-b191-71861300734c");
MessageApi messageApi = api.getMessageApiForZoneAndQueue(zoneId, CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");
ClaimApi claimApi = api.getClaimApiForZoneAndClientAndQueue(zoneId, clientId, "jclouds-test");
Message message = getOnlyElement(claimApi.claim(300, 100, 1));

@@ -186,7 +186,7 @@ public void deleteMessagesByClaimId() throws Exception {
@Test(dependsOnMethods = { "deleteMessagesByClaimId" })
public void deleteMessages() throws Exception {
for (String zoneId : zones) {
MessageApi messageApi = api.getMessageApiForZoneAndQueue(zoneId, CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

boolean success = messageApi.delete(messageIds.get(zoneId));

@@ -197,7 +197,7 @@ public void deleteMessages() throws Exception {
@Test(dependsOnMethods = { "deleteMessages" })
public void delete() throws Exception {
for (String zoneId : zones) {
QueueApi queueApi = api.getQueueApiForZone(zoneId, CLIENT_ID);
QueueApi queueApi = api.getQueueApiForZoneAndClient(zoneId, CLIENT_ID);
boolean success = queueApi.delete("jclouds-test");

assertTrue(success);
@@ -51,7 +51,7 @@ public void createMessage() throws Exception {

try {
MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
MessageApi messageApi = api.getMessageApiForZoneAndQueue("DFW", CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");

String json1 = "{\"event\":{\"name\":\"Edmonton Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
CreateMessage createMessage1 = CreateMessage.builder().ttl(120).body(json1).build();
@@ -79,7 +79,7 @@ public void createMessages() throws Exception {

try {
MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
MessageApi messageApi = api.getMessageApiForZoneAndQueue("DFW", CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");

String json1 = "{\"event\":{\"name\":\"Austin Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
CreateMessage createMessage1 = CreateMessage.builder().ttl(120).body(json1).build();
@@ -113,7 +113,7 @@ public void streamZeroPagesOfMessages() throws Exception {

try {
MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
MessageApi messageApi = api.getMessageApiForZoneAndQueue("DFW", CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");

MessageStream messageStream = messageApi.stream();

@@ -137,7 +137,7 @@ public void streamOnePageOfMessages() throws Exception {

try {
MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
MessageApi messageApi = api.getMessageApiForZoneAndQueue("DFW", CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");

MessageStream messageStream = messageApi.stream();

@@ -169,7 +169,7 @@ public void streamManyPagesOfMessages() throws Exception {

try {
MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
MessageApi messageApi = api.getMessageApiForZoneAndQueue("DFW", CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");

MessageStream messageStream = messageApi.stream(limit(2));

@@ -200,7 +200,7 @@ public void listMessagesByIds() throws Exception {

try {
MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
MessageApi messageApi = api.getMessageApiForZoneAndQueue("DFW", CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");
List<String> ids = ImmutableList.of("52928896b04a584f24883227", "52928896b04a584f24883228", "52928896b04a584f24883229");

List<Message> messages = messageApi.list(ids);
@@ -230,7 +230,7 @@ public void getMessage() throws Exception {

try {
MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
MessageApi messageApi = api.getMessageApiForZoneAndQueue("DFW", CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");

Message message = messageApi.get("5292b30cef913e6d026f4dec");

@@ -255,7 +255,7 @@ public void deleteMessages() throws Exception {

try {
MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
MessageApi messageApi = api.getMessageApiForZoneAndQueue("DFW", CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");
List<String> ids = ImmutableList.of("52936b8a3ac24e6ef4c067dd", "5292b30cef913e6d026f4dec");

boolean success = messageApi.delete(ids);
@@ -278,7 +278,7 @@ public void deleteMessageByClaimId() throws Exception {

try {
MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
MessageApi messageApi = api.getMessageApiForZoneAndQueue("DFW", CLIENT_ID, "jclouds-test");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");

boolean success = messageApi.deleteByClaim("52936b8a3ac24e6ef4c067dd", "5292b30cef913e6d026f4dec");

0 comments on commit c64cd4a

Please sign in to comment.