Package com.capra.integration.asana.utils

Source Code of com.capra.integration.asana.utils.TestDataCleanUp

package com.capra.integration.asana.utils;

import com.capra.integration.asana.AsanaClient;
import com.capra.integration.asana.http.AsanaHttpClient;
import com.capra.integration.asana.http.SimpleAsanaUrlGenerator;

import java.util.HashSet;
import java.util.Set;

/**
* @author lka@capraconsulting.no
* @since 11-11-2013 09:49
*/
public class TestDataCleanUp {

    private final AsanaClient asanaClient;

    private final Set<Long> taskIds = new HashSet<Long>();

    private final Set<Long> projectIds = new HashSet<Long>();

    public TestDataCleanUp(AsanaHttpClient asanaHttpClient) {
        this.asanaClient = new AsanaClient(asanaHttpClient);
    }

    public TestDataCleanUp(AsanaClient asanaClient) {
        this.asanaClient = asanaClient;
    }

    public void addTask(Long taskId) {
        taskIds.add(taskId);
    }

    public void addProject(Long id) {
        projectIds.add(id);
    }

    public void clean() {
        for (Long taskId : taskIds) {
            asanaClient.deleteTask(taskId);
        }
        for (Long projectId : projectIds) {
            asanaClient.deleteProject(projectId);
        }
    }
}
TOP

Related Classes of com.capra.integration.asana.utils.TestDataCleanUp

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.