You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@taverna.apache.org by Hiteshgautam01 <gi...@git.apache.org> on 2018/06/17 11:50:58 UTC

[GitHub] incubator-taverna-mobile pull request #87: Added WorkflowPresenter Test

GitHub user Hiteshgautam01 opened a pull request:

    https://github.com/apache/incubator-taverna-mobile/pull/87

    Added WorkflowPresenter Test

    Please make sure these boxes are checked before submitting your pull request - thanks!
    
    - [ ] Apply the `AndroidStyle.xml` style template to your code in Android Studio.
    
    - [ ] Run the checks with `./gradlew check` to make sure you didn't break anything
    
    - [ ] If you have multiple commits please combine them into one commit by squashing them.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Hiteshgautam01/incubator-taverna-mobile Test_1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-taverna-mobile/pull/87.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #87
    
----
commit deff7b1f84f43bb99dd51658f15f8660f32a7000
Author: Hitesh Gautam <ga...@...>
Date:   2018-06-17T11:47:14Z

    Added WorkflowPresenter Test

----


---

[GitHub] incubator-taverna-mobile pull request #87: Added WorkflowPresenter Test

Posted by Hiteshgautam01 <gi...@git.apache.org>.
Github user Hiteshgautam01 commented on a diff in the pull request:

    https://github.com/apache/incubator-taverna-mobile/pull/87#discussion_r195927632
  
    --- Diff: app/src/main/res/values/strings.xml ---
    @@ -166,6 +166,7 @@ limitations under the License.
         <string name="err_login_email">Enter valid email</string>
         <string name="err_login_password">Enter valid password</string>
         <string name="error_failed_to_fetch_workflow">Failed to fetch Workflow</string>
    +    <string name="no_workflows_avialable">No workflows avialable</string>
    --- End diff --
    
    I am using this when there is no workflow is created by any user on myExperiment. Then this is for empty workflows.


---

[GitHub] incubator-taverna-mobile pull request #87: Added WorkflowPresenter Test

Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:

    https://github.com/apache/incubator-taverna-mobile/pull/87#discussion_r195927973
  
    --- Diff: app/src/main/res/values/strings.xml ---
    @@ -166,6 +166,7 @@ limitations under the License.
         <string name="err_login_email">Enter valid email</string>
         <string name="err_login_password">Enter valid password</string>
         <string name="error_failed_to_fetch_workflow">Failed to fetch Workflow</string>
    +    <string name="no_workflows_avialable">No workflows avialable</string>
    --- End diff --
    
    check it by page no if `pageNumber==0` then show this otherwise show what have I suggested to you.


---

[GitHub] incubator-taverna-mobile pull request #87: Added WorkflowPresenter Test

Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:

    https://github.com/apache/incubator-taverna-mobile/pull/87#discussion_r196769637
  
    --- Diff: app/src/test/java/org/apache/taverna/mobile/ui/workflow/WorkflowPresenterTest.java ---
    @@ -0,0 +1,131 @@
    +package org.apache.taverna.mobile.ui.workflow;
    +
    +import org.apache.taverna.mobile.FakeRemoteDataSource;
    +import org.apache.taverna.mobile.R;
    +import org.apache.taverna.mobile.data.DataManager;
    +import org.apache.taverna.mobile.data.model.Workflows;
    +import org.apache.taverna.mobile.utils.RxSchedulersOverrideRule;
    +import org.junit.After;
    +import org.junit.Before;
    +import org.junit.Rule;
    +import org.junit.Test;
    +import org.junit.runner.RunWith;
    +import org.mockito.Mock;
    +import org.mockito.runners.MockitoJUnitRunner;
    +
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +import io.reactivex.Observable;
    +
    +import static org.mockito.Mockito.never;
    +import static org.mockito.Mockito.verify;
    +import static org.mockito.Mockito.when;
    +
    +@RunWith(MockitoJUnitRunner.class)
    +public class WorkflowPresenterTest {
    +
    +    @Rule
    +    public final RxSchedulersOverrideRule rxSchedulersOverrideRule = new
    +            RxSchedulersOverrideRule();
    +
    +    @Mock
    +    DataManager dataManager;
    +
    +    @Mock
    +    WorkflowMvpView workflowMvpView;
    +
    +    private Workflows workflows;
    +    private WorkflowPresenter workflowPresenter;
    +    private Map<String, String> option_pg1;
    +    private Map<String, String> option_pg2;
    +
    +    @Before
    +    public void setUp() {
    +
    +        workflowPresenter = new WorkflowPresenter(dataManager);
    +        workflowPresenter.attachView(workflowMvpView);
    +
    +        workflows = FakeRemoteDataSource.getWorkflowList();
    +
    +        option_pg1 = new HashMap<>();
    +        option_pg1.put("elements", "title,type,uploader,preview,created-at");
    +        option_pg1.put("page", String.valueOf(1));
    +        option_pg1.put("num", String.valueOf(10));
    +        option_pg1.put("order", "reverse");
    +
    +        option_pg2 = new HashMap<>();
    --- End diff --
    
    use `optionPage2` in place of `option_pg2`


---

[GitHub] incubator-taverna-mobile pull request #87: Added WorkflowPresenter Test

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-taverna-mobile/pull/87


---

[GitHub] incubator-taverna-mobile pull request #87: Added WorkflowPresenter Test

Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:

    https://github.com/apache/incubator-taverna-mobile/pull/87#discussion_r196769553
  
    --- Diff: app/src/test/java/org/apache/taverna/mobile/ui/workflow/WorkflowPresenterTest.java ---
    @@ -0,0 +1,131 @@
    +package org.apache.taverna.mobile.ui.workflow;
    +
    +import org.apache.taverna.mobile.FakeRemoteDataSource;
    +import org.apache.taverna.mobile.R;
    +import org.apache.taverna.mobile.data.DataManager;
    +import org.apache.taverna.mobile.data.model.Workflows;
    +import org.apache.taverna.mobile.utils.RxSchedulersOverrideRule;
    +import org.junit.After;
    +import org.junit.Before;
    +import org.junit.Rule;
    +import org.junit.Test;
    +import org.junit.runner.RunWith;
    +import org.mockito.Mock;
    +import org.mockito.runners.MockitoJUnitRunner;
    +
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +import io.reactivex.Observable;
    +
    +import static org.mockito.Mockito.never;
    +import static org.mockito.Mockito.verify;
    +import static org.mockito.Mockito.when;
    +
    +@RunWith(MockitoJUnitRunner.class)
    +public class WorkflowPresenterTest {
    +
    +    @Rule
    +    public final RxSchedulersOverrideRule rxSchedulersOverrideRule = new
    +            RxSchedulersOverrideRule();
    +
    +    @Mock
    +    DataManager dataManager;
    +
    +    @Mock
    +    WorkflowMvpView workflowMvpView;
    +
    +    private Workflows workflows;
    +    private WorkflowPresenter workflowPresenter;
    +    private Map<String, String> option_pg1;
    +    private Map<String, String> option_pg2;
    +
    +    @Before
    +    public void setUp() {
    +
    +        workflowPresenter = new WorkflowPresenter(dataManager);
    +        workflowPresenter.attachView(workflowMvpView);
    +
    +        workflows = FakeRemoteDataSource.getWorkflowList();
    +
    +        option_pg1 = new HashMap<>();
    --- End diff --
    
    use `optionPage1` in place of `option_pg1`


---

[GitHub] incubator-taverna-mobile pull request #87: Added WorkflowPresenter Test

Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:

    https://github.com/apache/incubator-taverna-mobile/pull/87#discussion_r196769008
  
    --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/workflow/WorkflowPresenter.java ---
    @@ -72,9 +72,17 @@ public void loadAllWorkflow(int pageNumber) {
                     .subscribeWith(new DisposableObserver<Workflows>() {
                         @Override
                         public void onNext(Workflows workflows) {
    -                        getMvpView().showProgressbar(false);
    -                        getMvpView().removeLoadMoreProgressbar();
    -                        getMvpView().showWorkflows(workflows);
    +                        if (workflows.getWorkflowList() != null) {
    +                            getMvpView().showProgressbar(false);
    +                            getMvpView().removeLoadMoreProgressbar();
    +                            getMvpView().showWorkflows(workflows);
    +                        } else if (workflows.getWorkflowList() == null && pageNumber == 1) {
    --- End diff --
    
    make the logic this way.
    ```
    else{
    	if(pageNumber == 1){
        	getMvpView().showSnackBar(R.string.no_workflows_found);
    	} else {
    	 getMvpView().showSnackBar(R.string.no_more_workflows_avialable);
    	}
        getMvpView().removeLoadMoreProgressbar();
    } 
    ```


---

[GitHub] incubator-taverna-mobile pull request #87: Added WorkflowPresenter Test

Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:

    https://github.com/apache/incubator-taverna-mobile/pull/87#discussion_r195927188
  
    --- Diff: app/src/main/res/values/strings.xml ---
    @@ -166,6 +166,7 @@ limitations under the License.
         <string name="err_login_email">Enter valid email</string>
         <string name="err_login_password">Enter valid password</string>
         <string name="error_failed_to_fetch_workflow">Failed to fetch Workflow</string>
    +    <string name="no_workflows_avialable">No workflows avialable</string>
    --- End diff --
    
    make it `More workflows not available`


---