Skip to content

Commit

Permalink
Merge pull request #86 from pyeremenko/v3
Browse files Browse the repository at this point in the history
fix tests
  • Loading branch information
arschles committed Sep 14, 2015
2 parents 4b09d16 + bfa6e94 commit 6446c5b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/test/java/io/iron/ironmq/IronMQTest.java
Expand Up @@ -509,7 +509,7 @@ public void testCreateQueueWithParams() throws IOException {
QueueModel payload = new QueueModel();
payload.setMessageTimeout(69);
payload.setMessageExpiration(404);
QueueModel info = queue.update(payload);
QueueModel info = queue.create(payload);

Assert.assertEquals(69, info.getMessageTimeout());
Assert.assertEquals(404, info.getMessageExpiration());
Expand Down Expand Up @@ -572,6 +572,7 @@ public void testCreateQueueOverload3() throws IOException {
*/
@Test
public void testUpdateQueue() throws IOException {
queue.create();
QueueModel payload = new QueueModel();
payload.setMessageTimeout(69);
QueueModel info = queue.update(payload);
Expand All @@ -591,7 +592,7 @@ public void testReplaceQueueSubscribers() throws IOException {
payload.addSubscriber(new Subscriber("http://localhost:3000", "test01"));
payload.addSubscriber(new Subscriber("http://localhost:3030", "test02"));
payload.addSubscriber(new Subscriber("http://localhost:3333", "test03"));
QueueModel info = queue.update(payload);
QueueModel info = queue.create(payload);

Assert.assertEquals(3, info.getPushInfo().getSubscribers().size());

Expand All @@ -617,7 +618,7 @@ public void testUpdateQueueSubscribers() throws IOException {
payload.addSubscriber(new Subscriber("http://localhost:3000", "test01"));
payload.addSubscriber(new Subscriber("http://localhost:3030", "test02"));
payload.addSubscriber(new Subscriber("http://localhost:3333", "test03"));
QueueModel info = queue.update(payload);
QueueModel info = queue.create(payload);

Assert.assertEquals(3, info.getPushInfo().getSubscribers().size());

Expand All @@ -639,11 +640,12 @@ public void testUpdateQueueSubscribers() throws IOException {
*/
@Test
public void testUpdateQueuePushParameters() throws IOException {
// TODO: perform real udate
final String url = "http://localhost:3000";

ArrayList<Subscriber> subscribers = new ArrayList<Subscriber>() {{ add(new Subscriber(url, "test")); }};
QueueModel payload = new QueueModel(new QueuePushModel(subscribers, 4, 7, "test_err"));
QueueModel info = queue.update(payload);
QueueModel info = queue.create(payload);

Assert.assertEquals("test_err", info.getPushInfo().getErrorQueue());
Assert.assertEquals("multicast", info.getType());
Expand All @@ -662,6 +664,7 @@ public void testUpdateQueuePushParameters() throws IOException {
*/
@Test
public void testUpdateQueueAlerts() throws IOException {
queue.create();
ArrayList<Alert> alerts = new ArrayList<Alert>();
alerts.add(new Alert(Alert.typeProgressive, Alert.directionAscending, 5, "some_q"));
QueueModel info = queue.updateAlerts(alerts);
Expand Down Expand Up @@ -697,7 +700,7 @@ public void testDeleteQueue() throws IOException, InterruptedException {
public void testAddSubscribers() throws IOException {
QueueModel payload = new QueueModel();
payload.addSubscriber(new Subscriber("http://localhost:3001", "test01"));
queue.update(payload);
queue.create(payload);
queue.addSubscribers(new Subscriber[]{new Subscriber("http://localhost:3002", "test02")});

QueueModel info = queue.getInfoAboutQueue();
Expand All @@ -720,7 +723,7 @@ public void testAddSubscribers() throws IOException {
public void testReplaceSubscribers() throws IOException {
QueueModel payload = new QueueModel();
payload.addSubscriber(new Subscriber("http://localhost:3001", "test01"));
queue.update(payload);
queue.create(payload);
queue.replaceSubscribers(new Subscriber[]{new Subscriber("http://localhost:3002", "test02")});

QueueModel info = queue.getInfoAboutQueue();
Expand Down Expand Up @@ -763,4 +766,6 @@ private Queue createQueueWithMessage(String queueName) throws IOException {
private String repeatString(String s, int times) {
return new String(new char[times]).replace("\0", s);
}
//
// private void createAQueue()
}

0 comments on commit 6446c5b

Please sign in to comment.