|
1 |
| -# Topcoder - Legacy Groups Processor |
| 1 | +# Topcoder - Legacy Challenge Processor |
2 | 2 |
|
3 | 3 | ## Verification
|
4 |
| -start Kafka server, start mock api server and start the processor |
| 4 | +start Kafka server, start Informix database, start mock api server and start the processor |
5 | 5 |
|
6 | 6 | 1. start kafka-console-producer to write messages to `challenge.notification.create` topic:
|
7 | 7 | `bin/kafka-console-producer.sh --broker-list localhost:9092 --topic challenge.notification.create`
|
8 | 8 | 2. write message:
|
9 |
| - `{ "topic": "challenge.notification.create","originator": "challenge-api","timestamp": "2019-05-14T00:00:00.000Z","mime-type": "application/json","payload": { "id": "1a4ef3a8-ed35-40d1-b8a6-7371a700d011","typeId": "2f4ef3a8-ed35-40d1-b8a6-7371a700d098","track": "CODE","name": "test-for-legacy-challenge-processor","description": "<p>test</p>","phases": [{ "id": "id-1","name": "registration","isActive": true, "duration": 345600000 }, { "id": "id-2","name": "submission","isActive": true, "duration": 345600000 }, { "id": "id-3","name": "checkpoint","isActive": true, "duration": 172800000 } ], "prizeSets": [{ "type": "Code","prizes": [{ "type": "first-place", "value": 1000 }, { "type": "second-place","value": 500 }] }, { "type": "Check Point", "prizes": [{ "type": "first-place","value": 200 }, { "type": "second-place","value": 200 }, { "type": "third-place","value": 200 }] }],"reviewType": "COMMUNITY","markdown": false,"tags": ["Node.js","NodeJS","MongoDB","AWS"],"projectId": 5087,"forumId": 33059 } }` |
10 |
| -3. Watch the app console, It will show message successfully handled. And has info log `Create challenge entity in legacy system, the legacy id is XXX`. Now mark down the legacy id. |
11 |
| -4. Wait for a short period(1 minute), Then go to `https://api.topcoder-dev.com/v4/challenges/<legacy_id>` to verify the challenge has been created in legacy system. Note CODE challenge doesn't have checkpoint prize/phase, so the checkpoint prize is 0 in the legacy system. |
| 9 | + `{ "topic": "challenge.notification.create","originator": "challenge-api","timestamp": "2019-05-14T00:00:00.000Z","mime-type": "application/json","payload": { "id": "1a4ef3a8-ed35-40d1-b8a6-7371a700d011","typeId": "2f4ef3a8-ed35-40d1-b8a6-7371a700d098","track": "CODE","name": "test-for-legacy-challenge-processor","description": "<p>test</p>","phases": [{ "id": "id-1","name": "registration","isActive": true, "duration": 345600000 }, { "id": "id-2","name": "submission","isActive": true, "duration": 345600000 }, { "id": "id-3","name": "checkpoint","isActive": true, "duration": 172800000 } ], "prizeSets": [{ "type": "Code","prizes": [{ "type": "first-place", "value": 1000 }, { "type": "second-place","value": 500 }] }, { "type": "Check Point", "prizes": [{ "type": "first-place","value": 200 }, { "type": "second-place","value": 200 }, { "type": "third-place","value": 200 }] }],"reviewType": "COMMUNITY","markdown": false,"tags": ["Java","JUnit","MongoDB","AWS"],"projectId": 5087,"forumId": 33059 } }` |
| 10 | +3. Use database GUI tool to execute following statements to verify AssetDTO data. |
| 11 | + ```sql |
| 12 | + select * from tcs_catalog:comp_catalog where component_id >= 2010; |
| 13 | + select * from tcs_catalog:comp_categories where comp_categories_id >= 2010; |
| 14 | + select * from tcs_catalog:comp_versions where comp_vers_id >= 2010; |
| 15 | + select * from tcs_catalog:comp_version_dates where comp_version_dates_id >= 3000; |
| 16 | + select * from tcs_catalog:comp_technology where comp_tech_id >= 2200; |
| 17 | + ``` |
| 18 | +4. Use database GUI tool to insert the following test data(Only AssetDTO data has been persisted right now, so you can't retrieve the corresponding AssetDTO using the legacyId provided by message payload). project_info table will contain component version id of challenge, you can use the comp_vers_id retrieve from step 3 to replace the `value` column. |
| 19 | + ```sql |
| 20 | + insert into tcs_catalog:project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date) values(2000, 2, 39, 132456, current, 132456, current); |
| 21 | + insert into tcs_catalog:project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) values(2000, 1, 2020, 132456, current, 132456, current); |
| 22 | + ``` |
12 | 23 | 5. start kafka-console-producer to write messages to `challenge.notification.update` topic:
|
13 | 24 | `bin/kafka-console-producer.sh --broker-list localhost:9092 --topic challenge.notification.update`
|
14 |
| -6. write message(Use the legacy id you mark down in step 3, as a number): |
15 |
| - `{ "topic": "challenge.notification.update","originator": "challenge-api","timestamp": "2019-05-14T00:00:00.000Z","mime-type": "application/json","payload": { "legacyId": <legacy_id>, "id": "1a4ef3a8-ed35-40d1-b8a6-7371a700d011","typeId": "2f4ef3a8-ed35-40d1-b8a6-7371a700d098","track": "CODE","name": "update-for-legacy-challenge-processor","description": "#Title\n##sub title 1\ntext\n##sub title2\nanother text\n","phases": [{ "id": "id-1","name": "registration","isActive": true, "duration": 345600000 }, { "id": "id-2","name": "submission","isActive": true, "duration": 345600000 }], "prizeSets": [{ "type": "Code","prizes": [{ "type": "first-place", "value": 800 }, { "type": "second-place","value": 400 }]}],"reviewType": "COMMUNITY","markdown":true,"tags": ["Node.js","NodeJS"],"projectId": 5087,"forumId": 33059 } }` |
16 |
| -7. Wait for a short period(1 minute), Then go to `https://api.topcoder-dev.com/v4/challenges/<legacy_id>` to verify the challenge has been updated in legacy system. |
17 |
| -8. Repeat step 1 to 7, to create other type of challenge. Here is the message payload for creating a Design challenge with checkpoint prizes: |
18 |
| - `{ "topic": "challenge.notification.create","originator": "challenge-api","timestamp": "2019-05-14T00:00:00.000Z","mime-type": "application/json","payload": { "id": "1a4ef3a8-ed35-40d1-b8a6-7371a700d011","typeId": "3f4ef3a8-ed35-40d1-b8a6-7371a700d098","track": "WEB_DESIGNS","name": "test-design-demo","description": "<p>test design</p>","phases": [{ "id": "id-1","name": "registration","isActive": true, "duration": 345600000 }, { "id": "id-2","name": "submission","isActive": true, "duration": 345600000 }, { "id": "id-3","name": "checkpoint","isActive": true, "duration": 172800000 } ], "prizeSets": [{ "type": "Code","prizes": [{ "type": "first-place", "value": 1000 }, { "type": "second-place","value": 500 }] }, { "type": "Check Point", "prizes": [{ "type": "first-place","value": 200 }, { "type": "second-place","value": 200 }, { "type": "third-place","value": 200 }] }],"reviewType": "COMMUNITY","markdown": false,"tags": ["Node.js","NodeJS","MongoDB","AWS"],"projectId": 5087,"forumId": 33059 } }` |
19 |
| - |
| 25 | +6. write message |
| 26 | + `{ "topic": "challenge.notification.update","originator": "challenge-api","timestamp": "2019-05-14T00:00:00.000Z","mime-type": "application/json","payload": { "legacyId": 2000, "id": "1a4ef3a8-ed35-40d1-b8a6-7371a700d011","typeId": "2f4ef3a8-ed35-40d1-b8a6-7371a700d098","track": "CODE","name": "update-for-legacy-challenge-processor","description": "#Title\n##sub title 1\ntext\n##sub title2\nanother text\n","phases": [{ "id": "id-1","name": "registration","isActive": true, "duration": 345600000 }, { "id": "id-2","name": "submission","isActive": true, "duration": 345600000 }], "prizeSets": [{ "type": "Code","prizes": [{ "type": "first-place", "value": 800 }, { "type": "second-place","value": 400 }]}],"reviewType": "COMMUNITY","markdown":true,"tags": ["Node.js","NodeJS", "PostgreSQL"],"projectId": 5087,"forumId": 33059 } }` |
| 27 | +7. Use database GUI tool to execute following statements to verify AssetDTO data. |
| 28 | + ```sql |
| 29 | + select * from tcs_catalog:comp_catalog where component_id >= 2010; |
| 30 | + select * from tcs_catalog:comp_technology where comp_tech_id >= 2200; |
| 31 | + ``` |
| 32 | +8. Try to change track, write the following message |
| 33 | + `{ "topic": "challenge.notification.update","originator": "challenge-api","timestamp": "2019-05-14T00:00:00.000Z","mime-type": "application/json","payload": { "legacyId": 2000, "id": "1a4ef3a8-ed35-40d1-b8a6-7371a700d011","typeId": "2f4ef3a8-ed35-40d1-b8a6-7371a700d098","track": "WEB_DESIGNS","name": "update-for-legacy-challenge-processor","description": "#Title\n##sub title 1\ntext\n##sub title2\nanother text\n","phases": [{ "id": "id-1","name": "registration","isActive": true, "duration": 345600000 }, { "id": "id-2","name": "submission","isActive": true, "duration": 345600000 }], "prizeSets": [{ "type": "Code","prizes": [{ "type": "first-place", "value": 800 }, { "type": "second-place","value": 400 }]}],"reviewType": "COMMUNITY","markdown":true,"tags": ["Node.js","NodeJS", "PostgreSQL"],"projectId": 5087,"forumId": 33059 } }` |
| 34 | +9. You would see error message in app console. |
20 | 35 |
|
21 | 36 | ## Unit test Coverage
|
22 |
| - 51 passing (23s) |
23 |
| - |
24 |
| -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | |
25 |
| -----------------------|----------|----------|----------|----------|-------------------| |
26 |
| -All files | 94.05 | 86.21 | 96.67 | 93.75 | | |
27 |
| - config | 100 | 100 | 100 | 100 | | |
28 |
| - default.js | 100 | 100 | 100 | 100 | | |
29 |
| - test.js | 100 | 100 | 100 | 100 | | |
30 |
| - src | 100 | 100 | 100 | 100 | | |
31 |
| - bootstrap.js | 100 | 100 | 100 | 100 | | |
32 |
| - constants.js | 100 | 100 | 100 | 100 | | |
33 |
| - src/common | 87.34 | 50 | 94.74 | 87.34 | | |
34 |
| - helper.js | 73.33 | 0 | 83.33 | 73.33 | 16,17,18,20 | |
35 |
| - logger.js | 90.63 | 60 | 100 | 90.63 |32,55,60,84,98,118 | |
36 |
| - src/services | 100 | 100 | 100 | 100 | | |
37 |
| - ProcessorService.js | 100 | 100 | 100 | 100 | | |
| 37 | + It is not available right now |
38 | 38 |
|
39 | 39 | ## E2E test Coverage
|
40 |
| - |
41 |
| - 54 passing (2m) |
42 |
| - |
43 |
| -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | |
44 |
| -----------------------|----------|----------|----------|----------|-------------------| |
45 |
| -All files | 95.37 | 87.88 | 97.5 | 95.17 | | |
46 |
| - config | 100 | 100 | 100 | 100 | | |
47 |
| - default.js | 100 | 100 | 100 | 100 | | |
48 |
| - test.js | 100 | 100 | 100 | 100 | | |
49 |
| - src | 94.12 | 66.67 | 90 | 94 | | |
50 |
| - app.js | 93.75 | 66.67 | 90 | 93.62 | 48,61,86 | |
51 |
| - bootstrap.js | 100 | 100 | 100 | 100 | | |
52 |
| - constants.js | 100 | 100 | 100 | 100 | | |
53 |
| - src/common | 91.14 | 66.67 | 100 | 91.14 | | |
54 |
| - helper.js | 93.33 | 50 | 100 | 93.33 | 18 | |
55 |
| - logger.js | 90.63 | 70 | 100 | 90.63 |32,55,60,84,98,118 | |
56 |
| - src/services | 100 | 100 | 100 | 100 | | |
57 |
| - ProcessorService.js | 100 | 100 | 100 | 100 | | |
| 40 | + It is not available right now |
0 commit comments