New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit dictionary doesn't override message values in case of global dictionary presence #167

Closed
olha-bastieieva opened this Issue Nov 21, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@olha-bastieieva

olha-bastieieva commented Nov 21, 2016

I have two dictionaries, global and not global, and it seems that at the beginning explicit one is applied, and after that - global (while from user guide I understood that explicit should be the final).

Dictionaries at citrus-context.xml:

 <citrus:json-data-dictionary id="jsonCreateIssueGitHubDictionary" global-scope="true">
    <citrus:mappings>
        <citrus:mapping path="title" value="citrus:concat('Dictionary1_', citrus:randomNumber(4))"/>
        <citrus:mapping path="body" value="${body}"/>
        <citrus:mapping path="labels[0]" value="dictionary1.test"/>
        <citrus:mapping path="labels[1]" value="dictionary1.bug"/>
        <citrus:mapping path="labels[2]" value="dictionary1.feature"/>
    </citrus:mappings>
</citrus:json-data-dictionary>
<citrus:json-data-dictionary id="jsonCreateIssueGitHubDictionary2" global-scope="false">
    <citrus:mapping-file path="classpath:com/revenue/integration/sample.dictionary"/>
</citrus:json-data-dictionary>`

Test case:

@CitrusTest
public void TestDictionary_test2(){
    String user = "olha-bastieieva";
    http()
            .client(jsonClientLogged)
            .send()
            .post("/repos/" + user + "/Citrus_test/issues")
            .contentType("application/json")
            .messageType(MessageType.JSON)
            .payload(new ClassPathResource("create_issue_payload.json", getClass()))
            .dictionary("jsonCreateIssueGitHubDictionary2");
    http()
            .client(jsonClientLogged)
            .receive()
            .response(HttpStatus.CREATED)
            .statusCode(201)
            .messageType(MessageType.JSON);
}

Content of sample.dictionary:

title = citrus:concat('Title', citrus:randomNumber(4))
labels[0] = dictionary2.test
labels[1] = dictionary2.bug`

Part of log where message values assignment is tracked:

14:48:07,709 DEBUG        citrus.Citrus| TEST STEP 1/2: send
14:48:07,804 DEBUG appingDataDictionary| Data dictionary setting element 'title' with value: citrus:concat('Title', citrus:randomNumber(4))
14:48:07,806 DEBUG appingDataDictionary| Data dictionary setting element 'labels[0]' with value: dictionary2.test
14:48:07,808 DEBUG appingDataDictionary| Data dictionary setting element 'title' with value: citrus:concat('Dictionary1_', citrus:randomNumber(4))
14:48:07,808 DEBUG appingDataDictionary| Data dictionary setting element 'body' with value: Body
14:48:07,809 DEBUG appingDataDictionary| Data dictionary setting element 'labels[0]' with value: dictionary1.test
14:48:08,135 DEBUG ltCorrelationManager| Saving correlation key for 'citrus_message_correlator_gitHubLogged'
14:48:08,135 DEBUG  context.TestContext| Setting variable: citrus_message_correlator_gitHubLogged with value: 'citrus_message_id = '69207068-7bb1-44c1-b04b-8fab59e06d26''
14:48:08,135 DEBUG    client.HttpClient| Sending HTTP message to: 'https://api.github.com/repos/olha-bastieieva/Citrus_test/issues'
14:48:08,135 DEBUG    client.HttpClient| Message to send:

{"title":"Dictionary1_2515","body":"Body","labels":["dictionary1.test"]}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment