Skip to content

Commit

Permalink
(citrusframework/citrus-db#28) Migrated tests to CitrusTestRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
svettwer committed Apr 17, 2019
1 parent fe97f18 commit 6c6a326
Showing 1 changed file with 40 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.consol.citrus.annotations.CitrusTest;
import com.consol.citrus.context.TestContext;
import com.consol.citrus.db.driver.JdbcDriver;
import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;
import com.consol.citrus.dsl.testng.TestNGCitrusTestRunner;
import com.consol.citrus.exceptions.CitrusRuntimeException;
import com.consol.citrus.jdbc.config.annotation.JdbcServerConfig;
import com.consol.citrus.jdbc.message.JdbcMessage;
Expand Down Expand Up @@ -52,7 +52,7 @@

@SuppressWarnings({"SqlDialectInspection", "SqlNoDataSourceInspection"})
@Test
public class JdbcExecutionsIT extends TestNGCitrusTestDesigner{
public class JdbcExecutionsIT extends TestNGCitrusTestRunner {

private static final int ROWS_UPDATED = 42;
private static final String TEST_COLUMN_LABEL = "foo";
Expand Down Expand Up @@ -99,12 +99,14 @@ public void doExecute(final TestContext context) {
}
);

receive(jdbcServer)
.message(JdbcMessage.execute(sql));

send(jdbcServer)

receive(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.message(JdbcMessage.execute(sql)));

send(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.messageType(MessageType.JSON)
.message(JdbcMessage.success().dataSet(testDataset));
.message(JdbcMessage.success().dataSet(testDataset)));
}

@CitrusTest
Expand Down Expand Up @@ -133,12 +135,12 @@ public void doExecute(final TestContext context) {
}
});

receive(jdbcServer)
.message(JdbcMessage.execute(sql + " - (5)"));
receive(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.message(JdbcMessage.execute(sql + " - (5)")));

send(jdbcServer)
send(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.messageType(MessageType.JSON)
.message(JdbcMessage.success().dataSet(testDataset));
.message(JdbcMessage.success().dataSet(testDataset)));
}

@CitrusTest
Expand All @@ -161,12 +163,12 @@ public void doExecute(final TestContext context) {
}
);

receive(jdbcServer)
.message(JdbcMessage.execute(SAMPLE_UPDATE_SQL));
receive(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.message(JdbcMessage.execute(SAMPLE_UPDATE_SQL)));

send(jdbcServer)
send(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.messageType(MessageType.JSON)
.message(JdbcMessage.success().rowsUpdated(ROWS_UPDATED));
.message(JdbcMessage.success().rowsUpdated(ROWS_UPDATED)));
}

@CitrusTest
Expand All @@ -190,12 +192,12 @@ public void doExecute(final TestContext context) {
}
);

receive(jdbcServer)
.message(JdbcMessage.execute(SAMPLE_UPDATE_SQL));
receive(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.message(JdbcMessage.execute(SAMPLE_UPDATE_SQL)));

send(jdbcServer)
send(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.messageType(MessageType.JSON)
.message(JdbcMessage.success().rowsUpdated(ROWS_UPDATED));
.message(JdbcMessage.success().rowsUpdated(ROWS_UPDATED)));
}

@CitrusTest
Expand Down Expand Up @@ -225,19 +227,19 @@ public void doExecute(final TestContext context) {
}
);

receive(jdbcServer)
.message(JdbcMessage.execute(sqlOne));
receive(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.message(JdbcMessage.execute(sqlOne)));

send(jdbcServer)
send(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.messageType(MessageType.JSON)
.message(JdbcMessage.success().rowsUpdated(ROWS_UPDATED));
.message(JdbcMessage.success().rowsUpdated(ROWS_UPDATED)));

receive(jdbcServer)
.message(JdbcMessage.execute(sqlTwo));
receive(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.message(JdbcMessage.execute(sqlTwo)));

send(jdbcServer)
send(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.messageType(MessageType.JSON)
.message(JdbcMessage.success().rowsUpdated(ROWS_UPDATED * 2));
.message(JdbcMessage.success().rowsUpdated(ROWS_UPDATED * 2)));
}

@CitrusTest
Expand Down Expand Up @@ -265,12 +267,12 @@ public void doExecute(final TestContext context) {
}
);

receive(jdbcServer)
.message(JdbcMessage.execute(sqlOne));
receive(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.message(JdbcMessage.execute(sqlOne)));

send(jdbcServer)
send(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.messageType(MessageType.JSON)
.message(JdbcMessage.success().rowsUpdated(ROWS_UPDATED));
.message(JdbcMessage.success().rowsUpdated(ROWS_UPDATED)));
}

@CitrusTest
Expand Down Expand Up @@ -312,17 +314,17 @@ public void doExecute(final TestContext context) {
}
);

receive(jdbcServer)
.message(JdbcMessage.execute("{? = CALL someClobFunction(?)} - ("+clobRequestValue+")"));
receive(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.message(JdbcMessage.execute("{? = CALL someClobFunction(?)} - ("+clobRequestValue+")")));

send(jdbcServer)
send(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.messageType(MessageType.XML)
.message(JdbcMessage.success().dataSet("" +
"<dataset>" +
"<row>" +
"<RETURN_CLOB>"+clobReturnValue+"</RETURN_CLOB>"+
"</row>" +
"</dataset>"));
"</dataset>")));
}

@CitrusTest
Expand Down Expand Up @@ -365,16 +367,16 @@ public void doExecute(final TestContext context) {
}
);

receive(jdbcServer)
.message(JdbcMessage.execute("{? = CALL someClobFunction(?)} - ("+requestBlobContent+")"));
receive(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.message(JdbcMessage.execute("{? = CALL someClobFunction(?)} - ("+requestBlobContent+")")));

send(jdbcServer)
send(jdbcMessage -> jdbcMessage.endpoint(jdbcServer)
.messageType(MessageType.XML)
.message(JdbcMessage.success().dataSet("" +
"<dataset>" +
"<row>" +
"<RETURN_BLOB>"+responseBlobContent+"</RETURN_BLOB>"+
"</row>" +
"</dataset>"));
"</dataset>")));
}
}

0 comments on commit 6c6a326

Please sign in to comment.