Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
*/
public interface HostSystem extends SessionFactory {

String NAMESPACE_SUPPORT = "namespace-support";

/**
* Add a user for testing.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.name.Names;

public class CassandraMailboxTestModule extends AbstractModule {

@Override
protected void configure() {
bind(HostSystem.class).to(ImapHostSystem.class);
bindConstant().annotatedWith(Names.named(HostSystem.NAMESPACE_SUPPORT)).to(true);
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@
import javax.inject.Inject;

import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mpt.api.HostSystem;
import org.apache.james.mpt.api.ImapHostSystem;
import org.apache.james.mpt.imapmailbox.suite.base.BaseAuthenticatedState;
import org.junit.Assume;
import org.junit.Test;

import com.google.inject.name.Named;

public class AuthenticatedState extends BaseAuthenticatedState {

@Inject
private static ImapHostSystem system;
@Inject @Named(HostSystem.NAMESPACE_SUPPORT)
private Boolean namespaceSupport;


public AuthenticatedState() throws Exception {
super(system);
Expand Down Expand Up @@ -324,18 +331,21 @@ public void testNamespaceKOREA() throws Exception {

@Test
public void listShouldNotListMailboxWithOtherNamspaceUS() throws Exception {
Assume.assumeTrue(namespaceSupport);
system.createMailbox(new MailboxPath("#namespace", USER, "Other"));
scriptTest("ListMailboxes", Locale.US);
}

@Test
public void listShouldNotListMailboxWithOtherNamspaceITALY() throws Exception {
Assume.assumeTrue(namespaceSupport);
system.createMailbox(new MailboxPath("#namespace", USER, "Other"));
scriptTest("ListMailboxes", Locale.ITALY);
}

@Test
public void listShouldNotListMailboxWithOtherNamspaceKOREA() throws Exception {
Assume.assumeTrue(namespaceSupport);
system.createMailbox(new MailboxPath("#namespace", USER, "Other"));
scriptTest("ListMailboxes", Locale.KOREA);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import org.apache.james.mpt.imapmailbox.cyrus.host.Docker;

import com.google.inject.AbstractModule;
import com.google.inject.name.Names;
import com.spotify.docker.client.messages.ContainerCreation;

import org.apache.james.mpt.imapmailbox.cyrus.host.GrantRightsOnCyrusHost;
import org.apache.james.mpt.imapmailbox.cyrus.host.MailboxMessageAppenderOnCyrusHost;

Expand All @@ -27,5 +29,6 @@ protected void configure() {
bind(UserAdder.class).to(CyrusUserAdder.class);
bind(GrantRightsOnHost.class).to(GrantRightsOnCyrusHost.class);
bind(MailboxMessageAppender.class).to(MailboxMessageAppenderOnCyrusHost.class);
bindConstant().annotatedWith(Names.named(HostSystem.NAMESPACE_SUPPORT)).to(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
package org.apache.james.mpt.imapmailbox.elasticsearch;

import com.google.inject.AbstractModule;
import com.google.inject.name.Names;

import org.apache.james.mpt.api.HostSystem;
import org.apache.james.mpt.api.ImapHostSystem;
import org.apache.james.mpt.imapmailbox.elasticsearch.host.ElasticSearchHostSystem;
Expand All @@ -29,5 +31,6 @@ public class ElasticSearchMailboxTestModule extends AbstractModule {
protected void configure() {
bind(ImapHostSystem.class).to(ElasticSearchHostSystem.class);
bind(HostSystem.class).to(ElasticSearchHostSystem.class);
bindConstant().annotatedWith(Names.named(HostSystem.NAMESPACE_SUPPORT)).to(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
package org.apache.james.mpt.imapmailbox.external.james;

import com.google.inject.AbstractModule;
import com.google.inject.name.Names;

import org.apache.james.mpt.api.HostSystem;
import org.apache.james.mpt.api.ImapHostSystem;
import org.apache.james.mpt.api.UserAdder;
Expand All @@ -35,6 +37,7 @@ protected void configure() {
bind(HostSystem.class).to(ExternalJamesHostSystem.class);
bind(ExternalHostSystem.class).to(ExternalJamesHostSystem.class);
bind(UserAdder.class).to(ExternalJamesUserAdder.class);
bindConstant().annotatedWith(Names.named(HostSystem.NAMESPACE_SUPPORT)).to(true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.name.Names;

public class HBaseMailboxTestModule extends AbstractModule {

@Override
protected void configure() {
bind(HostSystem.class).to(ImapHostSystem.class);
bindConstant().annotatedWith(Names.named(HostSystem.NAMESPACE_SUPPORT)).to(true);
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.name.Names;

public class InMemoryMailboxTestModule extends AbstractModule {

@Override
protected void configure() {
bind(HostSystem.class).to(ImapHostSystem.class);
bindConstant().annotatedWith(Names.named(HostSystem.NAMESPACE_SUPPORT)).to(true);
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.name.Names;

public class JcrMailboxTestModule extends AbstractModule {

@Override
protected void configure() {
bind(HostSystem.class).to(ImapHostSystem.class);
bindConstant().annotatedWith(Names.named(HostSystem.NAMESPACE_SUPPORT)).to(true);
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.name.Names;

public class JpaMailboxTestModule extends AbstractModule {

@Override
protected void configure() {
bind(HostSystem.class).to(ImapHostSystem.class);
bindConstant().annotatedWith(Names.named(HostSystem.NAMESPACE_SUPPORT)).to(true);
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.name.Names;

public class MaildirMailboxTestModule extends AbstractModule {

@Override
protected void configure() {
bind(HostSystem.class).to(ImapHostSystem.class);
bindConstant().annotatedWith(Names.named(HostSystem.NAMESPACE_SUPPORT)).to(false);
}

@Provides
Expand Down