{"action":"created","comment":{"url":"https://api.github.com/repos/Talend/data-prep/pulls/comments/182681772","pull_request_review_id":113523998,"id":182681772,"diff_hunk":"@@ -0,0 +1,169 @@\n+package org.talend.dataprep.transformation.actions.delete;\n+\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.talend.dataprep.api.action.ActionDefinition;\n+import org.talend.dataprep.api.dataset.ColumnMetadata;\n+import org.talend.dataprep.api.dataset.RowMetadata;\n+import org.talend.dataprep.api.dataset.row.DataSetRow;\n+import org.talend.dataprep.api.dataset.statistics.DataFrequency;\n+import org.talend.dataprep.api.dataset.statistics.Statistics;\n+import org.talend.dataprep.api.type.Type;\n+import org.talend.dataprep.transformation.actions.AbstractMetadataBaseTest;\n+import org.talend.dataprep.transformation.actions.ActionMetadataTestUtils;\n+import org.talend.dataprep.transformation.actions.category.ActionCategory;\n+import org.talend.dataprep.transformation.api.action.ActionTestWorkbench;\n+\n+import java.io.IOException;\n+import java.util.*;\n+\n+import static org.hamcrest.CoreMatchers.is;\n+import static org.junit.Assert.*;\n+import static org.talend.dataprep.api.dataset.ColumnMetadata.Builder.column;\n+import static org.talend.dataprep.transformation.actions.ActionMetadataTestUtils.getColumn;\n+\n+public class DeleteAllEmptyColumnsTest extends AbstractMetadataBaseTest<DeleteAllEmptyColumns> {\n+\n+    /** the action to test. */\n+    private DeleteAllEmptyColumns action = new DeleteAllEmptyColumns();\n+\n+    private Map<String, String> parameters;\n+\n+    private RowMetadata rowMetadata;\n+\n+    public DeleteAllEmptyColumnsTest() {\n+        super(new DeleteAllEmptyColumns());\n+    }\n+\n+    @Override\n+    protected CreateNewColumnPolicy getCreateNewColumnPolicy() {\n+        return CreateNewColumnPolicy.NA;\n+    }\n+\n+    @Before\n+    public void init() throws IOException {\n+        List<ColumnMetadata> columns = new ArrayList<>();\n+        Statistics statistics1 = new Statistics();\n+        statistics1.setDataFrequencies(Arrays.asList(new DataFrequency(\"blip\", 10)));\n+        ColumnMetadata columnMetadata = ColumnMetadata.Builder.column() //\n+                .type(Type.INTEGER) //\n+                .computedId(\"0000\") //\n+                .valid(10) //\n+                .statistics(statistics1) //\n+                .build();\n+        columns.add(columnMetadata);\n+        Statistics statistics2 = new Statistics();\n+        statistics2.setDataFrequencies(Arrays.asList(new DataFrequency(\"\", 10)));\n+        columnMetadata = ColumnMetadata.Builder.column() //\n+                .type(Type.STRING) //\n+                .computedId(\"0001\") //\n+                .valid(0) //\n+                .empty(10) //\n+                .invalid(0) //\n+                .statistics(statistics2) //\n+                .build();\n+        columns.add(columnMetadata);\n+        Statistics statistics3 = new Statistics();\n+        statistics3.setDataFrequencies(Arrays.asList(new DataFrequency(\"blop\", 10)));\n+        columnMetadata = ColumnMetadata.Builder.column() //\n+                .type(Type.STRING) //\n+                .statistics(statistics3) //\n+                .computedId(\"0002\") //\n+                .valid(10) //\n+                .build();\n+        columns.add(columnMetadata);\n+        Statistics statistics4 = new Statistics();\n+        statistics4.setDataFrequencies(Arrays.asList(new DataFrequency(\"\", 4), new DataFrequency(\" \", 6)));\n+        columnMetadata = ColumnMetadata.Builder.column() //\n+            .type(Type.STRING) //\n+            .computedId(\"0003\") //\n+            .empty(10) //\n+            .statistics(statistics4)\n+            .build();\n+        columns.add(columnMetadata);\n+        rowMetadata = new RowMetadata();\n+        rowMetadata.setColumns(columns);\n+\n+        parameters = ActionMetadataTestUtils\n+                .parseParameters(DeleteAllEmptyColumns.class.getResourceAsStream(\"deleteAllEmptyColumnsAction.json\"));\n+    }\n+\n+    @Test\n+    public void testAdapt() throws Exception {\n+        assertThat(action.adapt((ColumnMetadata) null), is(action));\n+        ColumnMetadata column = column().name(\"myColumn\").id(0).type(Type.STRING).build();\n+        assertThat(action.adapt(column), is(action));\n+    }\n+\n+    @Test\n+    public void testCategory() throws Exception {\n+        assertThat(action.getCategory(Locale.US), is(ActionCategory.DATA_CLEANSING.getDisplayName(Locale.US)));\n+    }\n+\n+    @Test\n+    public void should_accept_column() {\n+        assertTrue(action.acceptField(getColumn(Type.STRING)));\n+        assertTrue(action.acceptField(getColumn(Type.NUMERIC)));\n+        assertTrue(action.acceptField(getColumn(Type.FLOAT)));\n+        assertTrue(action.acceptField(getColumn(Type.DATE)));\n+        assertTrue(action.acceptField(getColumn(Type.BOOLEAN)));\n+        assertTrue(action.acceptField(getColumn(Type.ANY)));\n+    }\n+\n+    /**\n+     * Next tests only use column metadatas and not the column content\n+     */\n+    @Test\n+    public void should_delete_column() {\n+        // given\n+        final Map<String, String> values = new HashMap<>();\n+        values.put(\"0001\", \"1\");\n+        values.put(\"0002\", \"\");\n+        values.put(\"0003\", \"blop\");\n+        values.put(\"0004\", \" \");\n+        final DataSetRow row = new DataSetRow(rowMetadata, values);\n+        parameters.put(DeleteAllEmptyColumns.ACTION_PARAMETER, DeleteAllEmptyColumns.DELETE);\n+\n+        // when\n+        ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));\n+\n+        // then\n+        final int rowSize = row.getRowMetadata().getColumns().size();\n+        assertEquals(2, rowSize);\n+        assertNotNull(row.getRowMetadata().getById(\"0000\"));\n+        assertNull(row.getRowMetadata().getById(\"0001\"));\n+        assertNotNull(row.getRowMetadata().getById(\"0002\"));\n+        assertNull(row.getRowMetadata().getById(\"0003\"));\n+    }\n+","path":"dataprep-actions/src/test/java/org/talend/dataprep/transformation/actions/delete/DeleteAllEmptyColumnsTest.java","position":138,"original_position":138,"commit_id":"2506e21e84011812db8c2e74ee69548bcd542c15","original_commit_id":"2506e21e84011812db8c2e74ee69548bcd542c15","user":{"login":"smallet","id":809368,"avatar_url":"https://avatars1.githubusercontent.com/u/809368?v=4","gravatar_id":"","url":"https://api.github.com/users/smallet","html_url":"https://github.com/smallet","followers_url":"https://api.github.com/users/smallet/followers","following_url":"https://api.github.com/users/smallet/following{/other_user}","gists_url":"https://api.github.com/users/smallet/gists{/gist_id}","starred_url":"https://api.github.com/users/smallet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smallet/subscriptions","organizations_url":"https://api.github.com/users/smallet/orgs","repos_url":"https://api.github.com/users/smallet/repos","events_url":"https://api.github.com/users/smallet/events{/privacy}","received_events_url":"https://api.github.com/users/smallet/received_events","type":"User","site_admin":false},"body":"It could be nice to add tests that delete multiple columns, like 4 or more","created_at":"2018-04-19T09:13:12Z","updated_at":"2018-04-19T09:14:49Z","html_url":"https://github.com/Talend/data-prep/pull/1250#discussion_r182681772","pull_request_url":"https://api.github.com/repos/Talend/data-prep/pulls/1250","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Talend/data-prep/pulls/comments/182681772"},"html":{"href":"https://github.com/Talend/data-prep/pull/1250#discussion_r182681772"},"pull_request":{"href":"https://api.github.com/repos/Talend/data-prep/pulls/1250"}}},"pull_request":{"url":"https://api.github.com/repos/Talend/data-prep/pulls/1250","id":179710449,"html_url":"https://github.com/Talend/data-prep/pull/1250","diff_url":"https://github.com/Talend/data-prep/pull/1250.diff","patch_url":"https://github.com/Talend/data-prep/pull/1250.patch","issue_url":"https://api.github.com/repos/Talend/data-prep/issues/1250","number":1250,"state":"open","locked":false,"title":"feat(TDP-1461): delete all empty columns","user":{"login":"tlnd-cgall","id":32335676,"avatar_url":"https://avatars1.githubusercontent.com/u/32335676?v=4","gravatar_id":"","url":"https://api.github.com/users/tlnd-cgall","html_url":"https://github.com/tlnd-cgall","followers_url":"https://api.github.com/users/tlnd-cgall/followers","following_url":"https://api.github.com/users/tlnd-cgall/following{/other_user}","gists_url":"https://api.github.com/users/tlnd-cgall/gists{/gist_id}","starred_url":"https://api.github.com/users/tlnd-cgall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlnd-cgall/subscriptions","organizations_url":"https://api.github.com/users/tlnd-cgall/orgs","repos_url":"https://api.github.com/users/tlnd-cgall/repos","events_url":"https://api.github.com/users/tlnd-cgall/events{/privacy}","received_events_url":"https://api.github.com/users/tlnd-cgall/received_events","type":"User","site_admin":false},"body":"**Link to the JIRA issue**\r\nhttps://jira.talendforge.org/browse/TDP-1461\r\n\r\n**Please check if the PR fulfills these requirements**\r\n- [ ] The commit(s) message(s) follows our [guidelines](https://github.com/talend/tools/blob/master/tools-root-github/CONTRIBUTING.md#commit-message-format)\r\n- [ ] Tests for the changes have been added (for bug fixes / features)\r\n- [ ] Docs have been added / updated (for bug fixes / features)\r\n- [ ] The code coverage on new code is > 75 % for backend and > 95% for frontend\r\n- [ ] The new code does not introduce new technical issues (sonar / eslint)\r\n- [ ] Functional tests have been performed\r\n- [ ] Docker configuration files for config-std or config-cloud profiles are impacted\r\n\r\n**Please check the browsers you've tested on**\r\n- [ ] Chrome, Firefox, Safari, Edge, IE11\r\n- [ ] No, that's bad, this PR should not be merged !\r\n- [ ] No, and no need to (backend changes only)\r\n","created_at":"2018-04-05T15:20:10Z","updated_at":"2018-04-19T09:14:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cede77b9f1fd2686cab90217b33d7933f3157039","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":463131803,"url":"https://api.github.com/repos/Talend/data-prep/labels/backend","name":"backend","color":"d4c5f9","default":false},{"id":447624534,"url":"https://api.github.com/repos/Talend/data-prep/labels/need%20review","name":"need review","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Talend/data-prep/pulls/1250/commits","review_comments_url":"https://api.github.com/repos/Talend/data-prep/pulls/1250/comments","review_comment_url":"https://api.github.com/repos/Talend/data-prep/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Talend/data-prep/issues/1250/comments","statuses_url":"https://api.github.com/repos/Talend/data-prep/statuses/2506e21e84011812db8c2e74ee69548bcd542c15","head":{"label":"Talend:cgall/feat/TDP-1461_delete_all_empty_columns","ref":"cgall/feat/TDP-1461_delete_all_empty_columns","sha":"2506e21e84011812db8c2e74ee69548bcd542c15","user":{"login":"Talend","id":459687,"avatar_url":"https://avatars2.githubusercontent.com/u/459687?v=4","gravatar_id":"","url":"https://api.github.com/users/Talend","html_url":"https://github.com/Talend","followers_url":"https://api.github.com/users/Talend/followers","following_url":"https://api.github.com/users/Talend/following{/other_user}","gists_url":"https://api.github.com/users/Talend/gists{/gist_id}","starred_url":"https://api.github.com/users/Talend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Talend/subscriptions","organizations_url":"https://api.github.com/users/Talend/orgs","repos_url":"https://api.github.com/users/Talend/repos","events_url":"https://api.github.com/users/Talend/events{/privacy}","received_events_url":"https://api.github.com/users/Talend/received_events","type":"Organization","site_admin":false},"repo":{"id":26644682,"name":"data-prep","full_name":"Talend/data-prep","owner":{"login":"Talend","id":459687,"avatar_url":"https://avatars2.githubusercontent.com/u/459687?v=4","gravatar_id":"","url":"https://api.github.com/users/Talend","html_url":"https://github.com/Talend","followers_url":"https://api.github.com/users/Talend/followers","following_url":"https://api.github.com/users/Talend/following{/other_user}","gists_url":"https://api.github.com/users/Talend/gists{/gist_id}","starred_url":"https://api.github.com/users/Talend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Talend/subscriptions","organizations_url":"https://api.github.com/users/Talend/orgs","repos_url":"https://api.github.com/users/Talend/repos","events_url":"https://api.github.com/users/Talend/events{/privacy}","received_events_url":"https://api.github.com/users/Talend/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Talend/data-prep","description":"OS code of Data-prep project","fork":false,"url":"https://api.github.com/repos/Talend/data-prep","forks_url":"https://api.github.com/repos/Talend/data-prep/forks","keys_url":"https://api.github.com/repos/Talend/data-prep/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Talend/data-prep/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Talend/data-prep/teams","hooks_url":"https://api.github.com/repos/Talend/data-prep/hooks","issue_events_url":"https://api.github.com/repos/Talend/data-prep/issues/events{/number}","events_url":"https://api.github.com/repos/Talend/data-prep/events","assignees_url":"https://api.github.com/repos/Talend/data-prep/assignees{/user}","branches_url":"https://api.github.com/repos/Talend/data-prep/branches{/branch}","tags_url":"https://api.github.com/repos/Talend/data-prep/tags","blobs_url":"https://api.github.com/repos/Talend/data-prep/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Talend/data-prep/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Talend/data-prep/git/refs{/sha}","trees_url":"https://api.github.com/repos/Talend/data-prep/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Talend/data-prep/statuses/{sha}","languages_url":"https://api.github.com/repos/Talend/data-prep/languages","stargazers_url":"https://api.github.com/repos/Talend/data-prep/stargazers","contributors_url":"https://api.github.com/repos/Talend/data-prep/contributors","subscribers_url":"https://api.github.com/repos/Talend/data-prep/subscribers","subscription_url":"https://api.github.com/repos/Talend/data-prep/subscription","commits_url":"https://api.github.com/repos/Talend/data-prep/commits{/sha}","git_commits_url":"https://api.github.com/repos/Talend/data-prep/git/commits{/sha}","comments_url":"https://api.github.com/repos/Talend/data-prep/comments{/number}","issue_comment_url":"https://api.github.com/repos/Talend/data-prep/issues/comments{/number}","contents_url":"https://api.github.com/repos/Talend/data-prep/contents/{+path}","compare_url":"https://api.github.com/repos/Talend/data-prep/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Talend/data-prep/merges","archive_url":"https://api.github.com/repos/Talend/data-prep/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Talend/data-prep/downloads","issues_url":"https://api.github.com/repos/Talend/data-prep/issues{/number}","pulls_url":"https://api.github.com/repos/Talend/data-prep/pulls{/number}","milestones_url":"https://api.github.com/repos/Talend/data-prep/milestones{/number}","notifications_url":"https://api.github.com/repos/Talend/data-prep/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Talend/data-prep/labels{/name}","releases_url":"https://api.github.com/repos/Talend/data-prep/releases{/id}","deployments_url":"https://api.github.com/repos/Talend/data-prep/deployments","created_at":"2014-11-14T15:32:38Z","updated_at":"2018-04-19T08:34:29Z","pushed_at":"2018-04-19T08:34:41Z","git_url":"git://github.com/Talend/data-prep.git","ssh_url":"git@github.com:Talend/data-prep.git","clone_url":"https://github.com/Talend/data-prep.git","svn_url":"https://github.com/Talend/data-prep","homepage":"","size":63340,"stargazers_count":42,"watchers_count":42,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"archived":false,"open_issues_count":18,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":22,"open_issues":18,"watchers":42,"default_branch":"master"}},"base":{"label":"Talend:master","ref":"master","sha":"f454b87bdc860734d2b7753c063132864d2859e4","user":{"login":"Talend","id":459687,"avatar_url":"https://avatars2.githubusercontent.com/u/459687?v=4","gravatar_id":"","url":"https://api.github.com/users/Talend","html_url":"https://github.com/Talend","followers_url":"https://api.github.com/users/Talend/followers","following_url":"https://api.github.com/users/Talend/following{/other_user}","gists_url":"https://api.github.com/users/Talend/gists{/gist_id}","starred_url":"https://api.github.com/users/Talend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Talend/subscriptions","organizations_url":"https://api.github.com/users/Talend/orgs","repos_url":"https://api.github.com/users/Talend/repos","events_url":"https://api.github.com/users/Talend/events{/privacy}","received_events_url":"https://api.github.com/users/Talend/received_events","type":"Organization","site_admin":false},"repo":{"id":26644682,"name":"data-prep","full_name":"Talend/data-prep","owner":{"login":"Talend","id":459687,"avatar_url":"https://avatars2.githubusercontent.com/u/459687?v=4","gravatar_id":"","url":"https://api.github.com/users/Talend","html_url":"https://github.com/Talend","followers_url":"https://api.github.com/users/Talend/followers","following_url":"https://api.github.com/users/Talend/following{/other_user}","gists_url":"https://api.github.com/users/Talend/gists{/gist_id}","starred_url":"https://api.github.com/users/Talend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Talend/subscriptions","organizations_url":"https://api.github.com/users/Talend/orgs","repos_url":"https://api.github.com/users/Talend/repos","events_url":"https://api.github.com/users/Talend/events{/privacy}","received_events_url":"https://api.github.com/users/Talend/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Talend/data-prep","description":"OS code of Data-prep project","fork":false,"url":"https://api.github.com/repos/Talend/data-prep","forks_url":"https://api.github.com/repos/Talend/data-prep/forks","keys_url":"https://api.github.com/repos/Talend/data-prep/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Talend/data-prep/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Talend/data-prep/teams","hooks_url":"https://api.github.com/repos/Talend/data-prep/hooks","issue_events_url":"https://api.github.com/repos/Talend/data-prep/issues/events{/number}","events_url":"https://api.github.com/repos/Talend/data-prep/events","assignees_url":"https://api.github.com/repos/Talend/data-prep/assignees{/user}","branches_url":"https://api.github.com/repos/Talend/data-prep/branches{/branch}","tags_url":"https://api.github.com/repos/Talend/data-prep/tags","blobs_url":"https://api.github.com/repos/Talend/data-prep/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Talend/data-prep/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Talend/data-prep/git/refs{/sha}","trees_url":"https://api.github.com/repos/Talend/data-prep/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Talend/data-prep/statuses/{sha}","languages_url":"https://api.github.com/repos/Talend/data-prep/languages","stargazers_url":"https://api.github.com/repos/Talend/data-prep/stargazers","contributors_url":"https://api.github.com/repos/Talend/data-prep/contributors","subscribers_url":"https://api.github.com/repos/Talend/data-prep/subscribers","subscription_url":"https://api.github.com/repos/Talend/data-prep/subscription","commits_url":"https://api.github.com/repos/Talend/data-prep/commits{/sha}","git_commits_url":"https://api.github.com/repos/Talend/data-prep/git/commits{/sha}","comments_url":"https://api.github.com/repos/Talend/data-prep/comments{/number}","issue_comment_url":"https://api.github.com/repos/Talend/data-prep/issues/comments{/number}","contents_url":"https://api.github.com/repos/Talend/data-prep/contents/{+path}","compare_url":"https://api.github.com/repos/Talend/data-prep/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Talend/data-prep/merges","archive_url":"https://api.github.com/repos/Talend/data-prep/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Talend/data-prep/downloads","issues_url":"https://api.github.com/repos/Talend/data-prep/issues{/number}","pulls_url":"https://api.github.com/repos/Talend/data-prep/pulls{/number}","milestones_url":"https://api.github.com/repos/Talend/data-prep/milestones{/number}","notifications_url":"https://api.github.com/repos/Talend/data-prep/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Talend/data-prep/labels{/name}","releases_url":"https://api.github.com/repos/Talend/data-prep/releases{/id}","deployments_url":"https://api.github.com/repos/Talend/data-prep/deployments","created_at":"2014-11-14T15:32:38Z","updated_at":"2018-04-19T08:34:29Z","pushed_at":"2018-04-19T08:34:41Z","git_url":"git://github.com/Talend/data-prep.git","ssh_url":"git@github.com:Talend/data-prep.git","clone_url":"https://github.com/Talend/data-prep.git","svn_url":"https://github.com/Talend/data-prep","homepage":"","size":63340,"stargazers_count":42,"watchers_count":42,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"archived":false,"open_issues_count":18,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":22,"open_issues":18,"watchers":42,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Talend/data-prep/pulls/1250"},"html":{"href":"https://github.com/Talend/data-prep/pull/1250"},"issue":{"href":"https://api.github.com/repos/Talend/data-prep/issues/1250"},"comments":{"href":"https://api.github.com/repos/Talend/data-prep/issues/1250/comments"},"review_comments":{"href":"https://api.github.com/repos/Talend/data-prep/pulls/1250/comments"},"review_comment":{"href":"https://api.github.com/repos/Talend/data-prep/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Talend/data-prep/pulls/1250/commits"},"statuses":{"href":"https://api.github.com/repos/Talend/data-prep/statuses/2506e21e84011812db8c2e74ee69548bcd542c15"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"smallet"}}