Skip to content

Commit

Permalink
JAMES-1842: Remove Generics on Cucumber stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine Duprat authored and Quynh Nguyen committed Nov 18, 2016
1 parent f11fa61 commit e849d6e
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 43 deletions.
Expand Up @@ -40,13 +40,13 @@
@ScenarioScoped
public class CassandraStepdefs {

private final MainStepdefs<CassandraJamesServer> mainStepdefs;
private final MainStepdefs mainStepdefs;
private TemporaryFolder temporaryFolder = new TemporaryFolder();
private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();

@Inject
private CassandraStepdefs(MainStepdefs<CassandraJamesServer> mainStepdefs) {
private CassandraStepdefs(MainStepdefs mainStepdefs) {
this.mainStepdefs = mainStepdefs;
}

Expand Down
Expand Up @@ -37,9 +37,6 @@
import org.apache.http.client.fluent.Request;
import org.apache.http.client.fluent.Response;
import org.apache.http.client.utils.URIBuilder;
import org.apache.james.GuiceJamesServerImpl;
import org.apache.james.JmapServer;
import org.apache.james.WebAdminServer;
import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.jmap.model.AttachmentAccessToken;
import org.apache.james.mailbox.model.MailboxConstants;
Expand All @@ -59,7 +56,7 @@
import cucumber.runtime.java.guice.ScenarioScoped;

@ScenarioScoped
public class DownloadStepdefs <T extends GuiceJamesServerImpl & JmapServer & WebAdminServer> {
public class DownloadStepdefs {

private static final String ONE_ATTACHMENT_EML_ATTACHEMENT_BLOB_ID = "4000c5145f633410b80be368c44e1c394bff9437";
private static final String EXPIRED_ATTACHMENT_TOKEN = "usera@domain.tld_"
Expand All @@ -70,15 +67,15 @@ public class DownloadStepdefs <T extends GuiceJamesServerImpl & JmapServer & Web
+ "DiZa0O14MjLWrAA8P6MG35Gt5CBp7mt5U1EH/M++rIoZK7nlGJ4dPW0dvZD7h4m3o5b/Yd8DXU5x2x4+s0HOOKzD7X0RMlsU7JHJMNLvTvRGWF/C+MUyC8Zce7DtnRVPEQX2uAZhL2PBABV07Vpa8kH+NxoS9CL955Bc1Obr4G+KN2JorADlocFQA6ElXryF5YS/HPZSvq1MTC6aJIP0ku8WRpRnbwgwJnn26YpcHXcJjbkCBtd9/BhlMV6xNd2hTBkfZmYdoNo+UKBaXWzLxAlbLuxjpxwvDNJfOEyWFPgHDoRvzP+G7KzhVWjanHAHrhF0GilEa/MKpOI1qHBSwA==";
private static final String UTF8_CONTENT_DIPOSITION_START = "Content-Disposition: attachment; filename*=\"";

private final UserStepdefs<T> userStepdefs;
private final MainStepdefs<T> mainStepdefs;
private final UserStepdefs userStepdefs;
private final MainStepdefs mainStepdefs;
private HttpResponse response;
private Multimap<String, String> attachmentsByMessageId;
private Map<String, String> blobIdByAttachmentId;
private Map<AttachmentAccessTokenKey, AttachmentAccessToken> attachmentAccessTokens;

@Inject
private DownloadStepdefs(MainStepdefs<T> mainStepdefs, UserStepdefs<T> userStepdefs) {
private DownloadStepdefs(MainStepdefs mainStepdefs, UserStepdefs userStepdefs) {
this.mainStepdefs = mainStepdefs;
this.userStepdefs = userStepdefs;
this.attachmentsByMessageId = ArrayListMultimap.create();
Expand Down
Expand Up @@ -38,9 +38,6 @@
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.fluent.Request;
import org.apache.james.GuiceJamesServerImpl;
import org.apache.james.JmapServer;
import org.apache.james.WebAdminServer;
import org.apache.james.jmap.methods.integration.cucumber.util.TableRow;
import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxPath;
Expand All @@ -60,7 +57,7 @@
import cucumber.runtime.java.guice.ScenarioScoped;

@ScenarioScoped
public class GetMessagesMethodStepdefs <T extends GuiceJamesServerImpl & JmapServer & WebAdminServer> {
public class GetMessagesMethodStepdefs {

private static final Optional<Map<String, String>> NO_HEADERS = Optional.empty();
private static final String NAME = "[0][0]";
Expand All @@ -71,14 +68,14 @@ public class GetMessagesMethodStepdefs <T extends GuiceJamesServerImpl & JmapSer
private static final String SECOND_ATTACHMENT = ATTACHMENTS + "[1]";


private final MainStepdefs<T> mainStepdefs;
private final UserStepdefs<T> userStepdefs;
private final MainStepdefs mainStepdefs;
private final UserStepdefs userStepdefs;

private HttpResponse response;
private DocumentContext jsonPath;

@Inject
private GetMessagesMethodStepdefs(MainStepdefs<T> mainStepdefs, UserStepdefs<T> userStepdefs) {
private GetMessagesMethodStepdefs(MainStepdefs mainStepdefs, UserStepdefs userStepdefs) {
this.mainStepdefs = mainStepdefs;
this.userStepdefs = userStepdefs;
}
Expand Down
Expand Up @@ -20,18 +20,16 @@
package org.apache.james.jmap.methods.integration.cucumber;

import org.apache.http.client.utils.URIBuilder;
import org.apache.james.GuiceJamesServerImpl;
import org.apache.james.JmapServer;
import org.apache.james.WebAdminServer;
import org.apache.james.JmapJamesServer;

import com.google.common.base.Charsets;

import cucumber.runtime.java.guice.ScenarioScoped;

@ScenarioScoped
public class MainStepdefs<T extends GuiceJamesServerImpl & JmapServer & WebAdminServer> {
public class MainStepdefs {

public T jmapServer;
public JmapJamesServer jmapServer;
public Runnable awaitMethod = () -> {};

public void init() throws Exception {
Expand Down
Expand Up @@ -32,9 +32,6 @@
import org.apache.http.HttpResponse;
import org.apache.http.client.fluent.Request;
import org.apache.http.entity.ContentType;
import org.apache.james.GuiceJamesServerImpl;
import org.apache.james.JmapServer;
import org.apache.james.WebAdminServer;
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxPath;
Expand All @@ -50,16 +47,16 @@
import cucumber.runtime.java.guice.ScenarioScoped;

@ScenarioScoped
public class SetMailboxesMethodStepdefs <T extends GuiceJamesServerImpl & JmapServer & WebAdminServer> {
public class SetMailboxesMethodStepdefs {

private static final String NAME = "[0][0]";
private static final String ARGUMENTS = "[0][1]";

private final MainStepdefs<T> mainStepdefs;
private final UserStepdefs<T> userStepdefs;
private final MainStepdefs mainStepdefs;
private final UserStepdefs userStepdefs;

@Inject
private SetMailboxesMethodStepdefs(MainStepdefs<T> mainStepdefs, UserStepdefs<T> userStepdefs) {
private SetMailboxesMethodStepdefs(MainStepdefs mainStepdefs, UserStepdefs userStepdefs) {
this.mainStepdefs = mainStepdefs;
this.userStepdefs = userStepdefs;
}
Expand Down
Expand Up @@ -32,9 +32,6 @@
import org.apache.http.client.fluent.Executor;
import org.apache.http.client.fluent.Request;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.james.GuiceJamesServerImpl;
import org.apache.james.JmapServer;
import org.apache.james.WebAdminServer;
import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.util.ZeroedInputStream;

Expand All @@ -47,18 +44,18 @@
import cucumber.runtime.java.guice.ScenarioScoped;

@ScenarioScoped
public class UploadStepdefs <T extends GuiceJamesServerImpl & JmapServer & WebAdminServer>{
public class UploadStepdefs {
private static final String _1M_ZEROED_FILE_BLOB_ID = "3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3";
private static final int _1M = 1024 * 1024;
private static final int _10M = 10 * _1M;

private final UserStepdefs<T> userStepdefs;
private final MainStepdefs<T> mainStepdefs;
private final UserStepdefs userStepdefs;
private final MainStepdefs mainStepdefs;
private final URI uploadUri;
private HttpResponse response;

@Inject
private UploadStepdefs(UserStepdefs<T> userStepdefs, MainStepdefs<T> mainStepdefs) throws URISyntaxException {
private UploadStepdefs(UserStepdefs userStepdefs, MainStepdefs mainStepdefs) throws URISyntaxException {
this.userStepdefs = userStepdefs;
this.mainStepdefs = mainStepdefs;
uploadUri = mainStepdefs.baseUri().setPath("/upload").build();
Expand Down
Expand Up @@ -27,9 +27,6 @@

import javax.inject.Inject;

import org.apache.james.GuiceJamesServerImpl;
import org.apache.james.JmapServer;
import org.apache.james.WebAdminServer;
import org.apache.james.jmap.HttpJmapAuthentication;
import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.mailbox.model.MailboxConstants;
Expand All @@ -44,17 +41,17 @@
import cucumber.runtime.java.guice.ScenarioScoped;

@ScenarioScoped
public class UserStepdefs <T extends GuiceJamesServerImpl & JmapServer & WebAdminServer>{
public class UserStepdefs {

private final MainStepdefs<T> mainStepdefs;
private final MainStepdefs mainStepdefs;

protected Map<String, String> passwordByUser;
protected Set<String> domains;
protected Map<String, AccessToken> tokenByUser;
protected String lastConnectedUser;

@Inject
private UserStepdefs(MainStepdefs<T> mainStepdefs) {
private UserStepdefs(MainStepdefs mainStepdefs) {
this.mainStepdefs = mainStepdefs;
this.domains = new HashSet<>();
this.passwordByUser = new HashMap<>();
Expand Down
Expand Up @@ -34,11 +34,11 @@
@ScenarioScoped
public class MemoryStepdefs {

private final MainStepdefs<MemoryJamesServer> mainStepdefs;
private final MainStepdefs mainStepdefs;
private final TemporaryFolder temporaryFolder;

@Inject
private MemoryStepdefs(MainStepdefs<MemoryJamesServer> mainStepdefs) {
private MemoryStepdefs(MainStepdefs mainStepdefs) {
this.mainStepdefs = mainStepdefs;
this.temporaryFolder = new TemporaryFolder();
}
Expand Down

0 comments on commit e849d6e

Please sign in to comment.