Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
The Amazon Web Services SDK for Java provides Java APIs for building software on AWS' cost-effective, scalable, and reliable infrastructure products. The AWS Java SDK allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Amazon Relational Database Service, Amazon AutoScaling, etc).
/*
* Copyright 2012-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.simpleworkflow.flow.junit;
import org.junit.Assert;
import com.amazonaws.services.simpleworkflow.flow.core.Promise;
import com.amazonaws.services.simpleworkflow.flow.core.Task;
/**
* Similar to {@link Assert} which waits on {@link Promise} argument before
* calling correspondent Assert... function.
*
* To avoid overload conflicts "WaitFor" postfix is used for methods that define
* varargs "waitFor" argument.
*
* For example when
AsyncAssert.assertEquals("expected", "expected",
* waitForMe) is called Java resolves it to
* void assertEquals(final String message, final Object expected, final Promise> actual)
* when
* void assertEquals(final Object expected, final Object actual, Promise>... waitFor)
* was assumed.
*
*
* @see Assert
*/
public class AsyncAssert {
protected AsyncAssert() {
}
static public void assertReady(String message, Promise> condition) {
Assert.assertTrue(message, condition.isReady());
}
static public void assertReady(Promise> condition) {
Assert.assertTrue(condition.isReady());
}
static public void assertNotReady(String message, Promise> condition) {
Assert.assertFalse(message, condition.isReady());
}
static public void assertNotReady(Promise> condition) {
Assert.assertFalse(condition.isReady());
}
static public void assertTrueWaitFor(final String message, final boolean condition, Promise>... waitFor) {
new Task(waitFor) {
@Override
protected void doExecute() throws Throwable {
Assert.assertTrue(message, condition);
}
};
}
static public void assertTrue(final String message, final Promise condition) {
new Task(condition) {
@Override
protected void doExecute() throws Throwable {
Assert.assertTrue(message, condition.get());
}
};
}
static public void assertTrueWaitFor(final boolean condition, Promise>... waitFor) {
new Task(waitFor) {
@Override
protected void doExecute() throws Throwable {
Assert.assertTrue(condition);
}
};
}
static public void assertTrue(final Promise condition) {
new Task(condition) {
@Override
protected void doExecute() throws Throwable {
Assert.assertTrue(condition.get());
}
};
}
static public void assertFalseWaitFor(final String message, final boolean condition, Promise>... waitFor) {
new Task(waitFor) {
@Override
protected void doExecute() throws Throwable {
Assert.assertFalse(message, condition);
}
};
}
static public void assertFalse(final String message, final Promise condition) {
new Task(condition) {
@Override
protected void doExecute() throws Throwable {
Assert.assertFalse(message, condition.get());
}
};
}
static public void assertFalseWaitFor(final boolean condition, Promise>... waitFor) {
new Task(waitFor) {
@Override
protected void doExecute() throws Throwable {
Assert.assertFalse(condition);
}
};
}
static public void assertFalse(final Promise condition) {
new Task(condition) {
@Override
protected void doExecute() throws Throwable {
Assert.assertFalse(condition.get());
}
};
}
static public void assertEquals(final String message, final Object expected, final Promise> actual) {
new Task(actual) {
@Override
protected void doExecute() throws Throwable {
Assert.assertEquals(message, expected, actual.get());
}
};
}
static public void assertEqualsWaitFor(final String message, final Object expected, final Object actual,
Promise>... waitFor) {
new Task(waitFor) {
@Override
protected void doExecute() throws Throwable {
Assert.assertEquals(message, expected, actual);
}
};
}
static public void assertEquals(final Object expected, final Promise> actual) {
new Task(actual) {
@Override
protected void doExecute() throws Throwable {
Assert.assertEquals(expected, actual.get());
}
};
}
static public void assertEqualsWaitFor(final Object expected, final Object actual, Promise>... waitFor) {
new Task(waitFor) {
@Override
protected void doExecute() throws Throwable {
Assert.assertEquals(expected, actual);
}
};
}
public static void assertArrayEquals(final String message, final Object[] expected, final Object[] actual,
Promise>... waitFor) {
new Task(waitFor) {
@Override
protected void doExecute() throws Throwable {
Assert.assertArrayEquals(message, expected, actual);
}
};
}
public static void assertArrayEquals(final String message, final Object[] expected, final Promise