use of ch.aaap.harvestclient.core.Harvest in project harvest-client by 3AP-AG.
the class ExceptionsTest method startServer.
private void startServer() throws IOException {
server.start();
HttpUrl baseUrl = server.url("");
Config config = ConfigFactory.defaultReference();
config = config.withValue("harvest.baseUrl", ConfigValueFactory.fromAnyRef(baseUrl.toString()));
new Harvest(config);
}
use of ch.aaap.harvestclient.core.Harvest in project harvest-client by 3AP-AG.
the class DeleteAllData method main.
/**
* Delete all available data in an Harvest account apart from the currently
* authenticated User
*/
public static void main(String[] args) {
Harvest harvest = TestSetupUtil.getAnotherAdminAccess();
log.debug("Deleting all data in account {}", harvest.getAccountId());
harvest.projects().list(new ProjectFilter()).forEach(harvest.projects()::delete);
List<ClientContact> clientContacts = harvest.clientContacts().list(new ClientContactFilter());
deleteAll(clientContacts, harvest.clientContacts());
harvest.estimates().list(new EstimateFilter()).forEach(harvest.estimates()::delete);
harvest.estimateItemCategories().list(null).forEach(harvest.estimateItemCategories()::delete);
List<Client> clients = harvest.clients().list(new ClientFilter());
deleteAll(clients, harvest.clients());
harvest.timesheets().list(new TimeEntryFilter()).forEach(harvest.timesheets()::delete);
harvest.tasks().list(new TaskFilter()).forEach(harvest.tasks()::delete);
harvest.roles().list().forEach(harvest.roles()::delete);
User self = harvest.users().getSelf();
harvest.users().list().stream().filter(user -> !user.getId().equals(self.getId())).forEach(harvest.users()::delete);
}
Aggregations