Search in sources :

Example 71 with InSequence

use of org.jboss.arquillian.junit.InSequence in project bisq-api by mrosseel.

the class PaymentAccountIT method create_validChaseQuickPay_returnsCreatedAccount.

@InSequence(2)
@Test
public void create_validChaseQuickPay_returnsCreatedAccount() {
    final int alicePort = getAlicePort();
    final Faker faker = new Faker();
    final ChaseQuickPayPaymentAccount accountToCreate = new ChaseQuickPayPaymentAccount();
    ApiTestHelper.randomizeAccountPayload(accountToCreate);
    accountToCreate.email = faker.internet().emailAddress();
    accountToCreate.holderName = faker.name().fullName();
    final String expectedPaymentDetails = String.format("Chase QuickPay - Holder name: %s, email: %s", accountToCreate.holderName, accountToCreate.email);
    given().port(alicePort).contentType(ContentType.JSON).body(accountToCreate).when().post("/api/v1/payment-accounts").then().statusCode(200).and().body("id", isA(String.class)).and().body("paymentMethod", equalTo(accountToCreate.paymentMethod)).and().body("accountName", equalTo(accountToCreate.accountName)).and().body("paymentDetails", equalTo(expectedPaymentDetails)).and().body("selectedTradeCurrency", equalTo(accountToCreate.selectedTradeCurrency)).and().body("tradeCurrencies", equalTo(accountToCreate.tradeCurrencies)).and().body("email", equalTo(accountToCreate.email)).and().body("holderName", equalTo(accountToCreate.holderName)).and().body("size()", equalTo(8));
}
Also used : Faker(com.github.javafaker.Faker) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 72 with InSequence

use of org.jboss.arquillian.junit.InSequence in project bisq-api by mrosseel.

the class PaymentAccountIT method create_validSepaInstant_returnsCreatedAccount.

@InSequence(2)
@Test
public void create_validSepaInstant_returnsCreatedAccount() {
    final int alicePort = getAlicePort();
    final Faker faker = new Faker();
    final SepaInstantPaymentAccount accountToCreate = new SepaInstantPaymentAccount();
    ApiTestHelper.randomizeAccountPayload(accountToCreate);
    accountToCreate.accountName = faker.commerce().productName();
    accountToCreate.bic = faker.finance().bic();
    accountToCreate.iban = faker.finance().iban();
    accountToCreate.holderName = faker.name().fullName();
    accountToCreate.countryCode = faker.address().countryCode();
    accountToCreate.acceptedCountries = Arrays.asList("PL", "GB");
    accountToCreate.selectedTradeCurrency = faker.options().option("PLN", "USD", "EUR", "GBP");
    accountToCreate.tradeCurrencies = Collections.singletonList(accountToCreate.selectedTradeCurrency);
    final String expectedPaymentDetails = String.format("SEPA Instant - Holder name: %s, IBAN: %s, BIC: %s, Country code: %s", accountToCreate.holderName, accountToCreate.iban, accountToCreate.bic, accountToCreate.countryCode);
    given().port(alicePort).contentType(ContentType.JSON).body(accountToCreate).when().post("/api/v1/payment-accounts").then().statusCode(200).and().body("id", isA(String.class)).and().body("paymentMethod", equalTo(accountToCreate.paymentMethod)).and().body("accountName", equalTo(accountToCreate.accountName)).and().body("paymentDetails", equalTo(expectedPaymentDetails)).and().body("holderName", equalTo(accountToCreate.holderName)).and().body("countryCode", equalTo(accountToCreate.countryCode)).and().body("bic", equalTo(accountToCreate.bic)).and().body("iban", equalTo(accountToCreate.iban)).and().body("selectedTradeCurrency", equalTo(accountToCreate.selectedTradeCurrency)).and().body("tradeCurrencies", equalTo(accountToCreate.tradeCurrencies)).and().body("acceptedCountries", equalTo(accountToCreate.acceptedCountries)).and().body("size()", equalTo(11));
}
Also used : Faker(com.github.javafaker.Faker) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 73 with InSequence

use of org.jboss.arquillian.junit.InSequence in project bisq-api by mrosseel.

the class TradeResourceIT method getTrades_returnsTrade.

@InSequence(1)
@Test
public void getTrades_returnsTrade() throws Exception {
    final int alicePort = getAlicePort();
    final SepaPaymentAccount alicePaymentAccount = OfferResourceIT.alicePaymentAccount;
    final SepaPaymentAccount bobPaymentAccount = OfferResourceIT.bobPaymentAccount;
    given().port(getBobPort()).when().get("/api/v1/trades").then().statusCode(200).and().body("trades[0].id", isA(String.class)).and().body("trades[0].offer.id", isA(String.class)).and().body("trades[0].offer.acceptedCountryCodes", equalTo(alicePaymentAccount.acceptedCountries)).and().body("trades[0].offer.amount", equalTo(1)).and().body("trades[0].offer.arbitratorNodeAddresses", equalTo(ApiTestHelper.getAcceptedArbitrators(alicePort))).and().body("trades[0].offer.baseCurrencyCode", equalTo("BTC")).and().body("trades[0].offer.bankId", equalTo(alicePaymentAccount.bic)).and().body("trades[0].offer.blockHeightAtOfferCreation", isA(Integer.class)).and().body("trades[0].offer.buyerSecurityDeposit", equalTo((int) OfferResourceIT.createdOffer.buyerSecurityDeposit)).and().body("trades[0].offer.counterCurrencyCode", equalTo(alicePaymentAccount.selectedTradeCurrency)).and().body("trades[0].offer.countryCode", equalTo(alicePaymentAccount.countryCode)).and().body("trades[0].offer.currencyCode", equalTo(alicePaymentAccount.selectedTradeCurrency)).and().body("trades[0].offer.date", isA(Long.class)).and().body("trades[0].offer.direction", equalTo(OfferPayload.Direction.BUY.name())).and().body("trades[0].offer.id", isA(String.class)).and().body("trades[0].offer.isCurrencyForMakerFeeBtc", equalTo(true)).and().body("trades[0].offer.isPrivateOffer", equalTo(false)).and().body("trades[0].offer.lowerClosePrice", equalTo(0)).and().body("trades[0].offer.makerFee", equalTo(5000)).and().body("trades[0].offer.makerPaymentAccountId", equalTo(alicePaymentAccount.id)).and().body("trades[0].offer.marketPriceMargin", equalTo(10f)).and().body("trades[0].offer.maxTradeLimit", equalTo(25000000)).and().body("trades[0].offer.maxTradePeriod", equalTo(518400000)).and().body("trades[0].offer.minAmount", equalTo(1)).and().body("trades[0].offer.offerFeePaymentTxId", isA(String.class)).and().body("trades[0].offer.ownerNodeAddress", equalTo(ApiTestHelper.getP2PNetworkStatus(alicePort).address)).and().body("trades[0].offer.paymentMethodId", equalTo(alicePaymentAccount.paymentMethod)).and().body("trades[0].offer.price", equalTo(10)).and().body("trades[0].offer.protocolVersion", equalTo(1)).and().body("trades[0].offer.sellerSecurityDeposit", equalTo(300000)).and().body("trades[0].offer.state", equalTo(Offer.State.AVAILABLE.name())).and().body("trades[0].offer.txFee", equalTo(6000)).and().body("trades[0].offer.upperClosePrice", equalTo(0)).and().body("trades[0].offer.useAutoClose", equalTo(false)).and().body("trades[0].offer.useMarketBasedPrice", equalTo(false)).and().body("trades[0].offer.useReOpenAfterAutoClose", equalTo(false)).and().body("trades[0].offer.versionNr", isA(String.class)).and().body("trades[0].buyerPaymentAccount.paymentMethod", equalTo(alicePaymentAccount.paymentMethod)).and().body("trades[0].buyerPaymentAccount.paymentDetails", isA(String.class)).and().body("trades[0].buyerPaymentAccount.countryCode", equalTo(alicePaymentAccount.countryCode)).and().body("trades[0].buyerPaymentAccount.holderName", equalTo(alicePaymentAccount.holderName)).and().body("trades[0].buyerPaymentAccount.bic", equalTo(alicePaymentAccount.bic)).and().body("trades[0].buyerPaymentAccount.iban", equalTo(alicePaymentAccount.iban)).and().body("trades[0].buyerPaymentAccount.acceptedCountries", equalTo(alicePaymentAccount.acceptedCountries)).and().body("trades[0].sellerPaymentAccount.paymentMethod", equalTo(bobPaymentAccount.paymentMethod)).and().body("trades[0].sellerPaymentAccount.paymentDetails", isA(String.class)).and().body("trades[0].sellerPaymentAccount.countryCode", equalTo(bobPaymentAccount.countryCode)).and().body("trades[0].sellerPaymentAccount.holderName", equalTo(bobPaymentAccount.holderName)).and().body("trades[0].sellerPaymentAccount.bic", equalTo(bobPaymentAccount.bic)).and().body("trades[0].sellerPaymentAccount.iban", equalTo(bobPaymentAccount.iban)).and().body("trades[0].sellerPaymentAccount.acceptedCountries", equalTo(bobPaymentAccount.acceptedCountries)).and().body("trades[0].isCurrencyForTakerFeeBtc", equalTo(true)).and().body("trades[0].txFee", isA(Integer.class)).and().body("trades[0].takerFee", isA(Integer.class)).and().body("trades[0].takeOfferDate", isA(Long.class)).and().body("trades[0].takerFeeTxId", isA(String.class)).and().body("trades[0].payoutTxId", isEmptyOrNullString()).and().body("trades[0].tradeAmount", equalTo(1)).and().body("trades[0].tradePrice", equalTo(10)).and().body("trades[0].state", isOneOf(ApiTestHelper.toString(Trade.State.values()))).and().body("trades[0].disputeState", equalTo(Trade.DisputeState.NO_DISPUTE.name())).and().body("trades[0].tradePeriodState", equalTo(Trade.TradePeriodState.FIRST_HALF.name())).and().body("trades[0].arbitratorBtcPubKey", isA(String.class)).and().body("trades[0].contractHash", isA(String.class)).and().body("trades[0].mediatorNodeAddress", isA(String.class)).and().body("trades[0].takerContractSignature", isA(String.class)).and().body("trades[0].makerContractSignature", isEmptyOrNullString()).and().body("trades[0].arbitratorNodeAddress", isA(String.class)).and().body("trades[0].tradingPeerNodeAddress", isA(String.class)).and().body("trades[0].takerPaymentAccountId", equalTo(bobPaymentAccount.id)).and().body("trades[0].counterCurrencyTxId", isEmptyOrNullString());
}
Also used : SepaPaymentAccount(io.bisq.api.model.payment.SepaPaymentAccount) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 74 with InSequence

use of org.jboss.arquillian.junit.InSequence in project quickstart by wildfly.

the class RESTTest method testGetContact.

@Test
@InSequence(1)
public void testGetContact() throws Exception {
    HttpResponse response = httpClient.execute(new HttpGet(contextPath.toString() + API_PATH + DEFAULT_CONTACT_ID));
    assertEquals(200, response.getStatusLine().getStatusCode());
    String responseBody = EntityUtils.toString(response.getEntity());
    JSONObject contact = new JSONObject(responseBody);
    assertEquals(DEFAULT_CONTACT_ID, contact.getInt("id"));
    assertEquals(DEFAULT_CONTACT_FIRSTNAME, contact.getString("firstName"));
    assertEquals(DEFAULT_CONTACT_LASTNAME, contact.getString("lastName"));
}
Also used : JSONObject(org.json.JSONObject) HttpGet(org.apache.http.client.methods.HttpGet) HttpResponse(org.apache.http.HttpResponse) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 75 with InSequence

use of org.jboss.arquillian.junit.InSequence in project quickstart by wildfly.

the class ContactRegistrationIT method testInvalidRegister.

@SuppressWarnings("unchecked")
@Test
@InSequence(2)
public void testInvalidRegister() throws Exception {
    Contact contact = createContactInstance("", "", "", "", date);
    Response response = contactRESTService.createContact(contact);
    assertEquals("Unexpected response status", 400, response.getStatus());
    assertNotNull("response.getEntity() should not be null", response.getEntity());
    assertEquals("Unexpected response.getEntity(). It contains " + response.getEntity(), 3, ((Map<String, String>) response.getEntity()).size());
    log.info("Invalid contact register attempt failed with return code " + response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) Contact(org.jboss.quickstarts.contact.Contact) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Aggregations

InSequence (org.jboss.arquillian.junit.InSequence)157 Test (org.junit.Test)157 Faker (com.github.javafaker.Faker)21 Simple (org.apache.deltaspike.data.test.ee7.domain.Simple)18 ModelNode (org.jboss.dmr.ModelNode)14 URL (java.net.URL)13 HttpResponse (org.apache.http.HttpResponse)10 TakeOffer (io.bisq.api.model.TakeOffer)9 HttpGet (org.apache.http.client.methods.HttpGet)8 ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)8 OfferToCreate (io.bisq.api.model.OfferToCreate)7 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)7 PartitionManager (org.picketlink.idm.PartitionManager)7 Response (javax.ws.rs.core.Response)6 IdentityManager (org.picketlink.idm.IdentityManager)6 StringTokenizer (java.util.StringTokenizer)5 RouteBuilder (org.apache.camel.builder.RouteBuilder)5 House (org.apache.deltaspike.data.test.ee7.domain.House)5 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)5 ManagementClient (org.jboss.as.arquillian.container.ManagementClient)5