src/test/java/edu/ucla/library/bucketeer/verticles/SlackMessageVerticleTest.java
@Test
    public final void testSlackFileUpload(final TestContext aContext)
            throws FileNotFoundException, ProcessingException, IOException {
        final Job job = JobFactory.getInstance().createJob(TEST_JOB, LIVE_TEST_CSV);
        final String iiifURL = "unit.test.not.real.please.disregard.com";
        final String slackMessage =
                LOGGER.getMessage(MessageCodes.BUCKETEER_111, mySlackUserHandle, job.size(),
                                  job.failedItems(), job.missingItems(), iiifURL);
        final Vertx vertx = myRunTestOnContextRule.vertx();
        final JsonObject message = new JsonObject();
        final Async asyncTask = aContext.async();

        message.put(Constants.SLACK_MESSAGE_TEXT, slackMessage);
        message.put(Config.SLACK_CHANNEL_ID, mySlackChannelID);
        message.put(Constants.JOB_NAME, TEST_JOB);
        message.put(Constants.BATCH_METADATA, job.toJSON());

        vertx.eventBus().request(VERTICLE_NAME, message, send -> {
            if (send.failed()) {
                final Throwable details = send.cause();

                if (details != null) {
                    LOGGER.error(details, details.getMessage());
                }

                aContext.fail();
            } else {
                TestUtils.complete(asyncTask);
            }
        });
    }
/**
     * Tests being able to upload a metadata file to Slack.
     *
     * @param aContext A test context
     */
Tests being able to upload a metadata file to Slack.
@param aContext A test context
Tests being able to upload a metadata file to Slack . @param aContext A test context
@Test
    public final void testSlackFileUpload(final TestContext aContext)
            throws FileNotFoundException, ProcessingException, IOException {
        final Job job = JobFactory.getInstance().createJob(TEST_JOB, LIVE_TEST_CSV);
        final String iiifURL = "unit.test.not.real.please.disregard.com";
        final String slackMessage =
                LOGGER.getMessage(MessageCodes.BUCKETEER_111, mySlackUserHandle, job.size(),
                                  job.failedItems(), job.missingItems(), iiifURL);
        final Vertx vertx = myRunTestOnContextRule.vertx();
        final JsonObject message = new JsonObject();
        final Async asyncTask = aContext.async();
        message.put(Constants.SLACK_MESSAGE_TEXT, slackMessage);
        message.put(Config.SLACK_CHANNEL_ID, mySlackChannelID);
        message.put(Constants.JOB_NAME, TEST_JOB);
        message.put(Constants.BATCH_METADATA, job.toJSON());
        vertx.eventBus().request(VERTICLE_NAME, message, send -> {
            if (send.failed()) {
                final Throwable details = send.cause();
                if (details != null) {
                    LOGGER.error(details, details.getMessage());
                }
                aContext.fail();
            } else {
                TestUtils.complete(asyncTask);
            }
        });
    }
@ Test public final void testSlackFileUpload ( final TestContext aContext ) throws FileNotFoundException , ProcessingException , IOException { final Job job = JobFactory . getInstance ( ) . createJob ( TEST_JOB , LIVE_TEST_CSV ) ; final String iiifURL = "unit.test.not.real.please.disregard.com" ; final String slackMessage = LOGGER . getMessage ( MessageCodes . BUCKETEER_111 , mySlackUserHandle , job . size ( ) , job . failedItems ( ) , job . missingItems ( ) , iiifURL ) ; final Vertx vertx = myRunTestOnContextRule . vertx ( ) ; final JsonObject message = new JsonObject ( ) ; final Async asyncTask = aContext . async ( ) ; message . put ( Constants . SLACK_MESSAGE_TEXT , slackMessage ) ; message . put ( Config . SLACK_CHANNEL_ID , mySlackChannelID ) ; message . put ( Constants . JOB_NAME , TEST_JOB ) ; message . put ( Constants . BATCH_METADATA , job . toJSON ( ) ) ; vertx . eventBus ( ) . request ( VERTICLE_NAME , message , send -> { if ( send . failed ( ) ) { final Throwable details = send . cause ( ) ; if ( details != null ) { LOGGER . error ( details , details . getMessage ( ) ) ; } aContext . fail ( ) ; } else { TestUtils . complete ( asyncTask ) ; } } ) ; }
Tests being able to upload a metadata file to Slack.
Tests being able to upload a metadata file to Slack .