Added: james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/mailrepositorystore.xml URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/mailrepositorystore.xml?rev=1719380&view=auto ============================================================================== --- james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/mailrepositorystore.xml (added) +++ james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/mailrepositorystore.xml Fri Dec 11 12:32:35 2015 @@ -0,0 +1,31 @@ +<?xml version="1.0"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<mailrepositorystore> + <mailrepositories> + <mailrepository class="org.apache.james.mailrepository.file.FileMailRepository"> + <protocols> + <protocol>file</protocol> + </protocols> + <config FIFO="false" CACHEKEYS="true"/> + </mailrepository> + </mailrepositories> +</mailrepositorystore>
Added: james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/pop3server.xml URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/pop3server.xml?rev=1719380&view=auto ============================================================================== --- james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/pop3server.xml (added) +++ james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/pop3server.xml Fri Dec 11 12:32:35 2015 @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + + +<pop3servers> + <pop3server enabled="true"> + <jmxName>pop3server</jmxName> + <bind>0.0.0.0:1110</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <!-- To create a new keystore execute: + keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore + --> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + </tls> + <connectiontimeout>1200</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <handlerchain> + <handler class="org.apache.james.pop3server.core.CoreCmdHandlerLoader"/> + </handlerchain> + </pop3server> +</pop3servers> Added: james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/smtpserver.xml URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/smtpserver.xml?rev=1719380&view=auto ============================================================================== --- james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/smtpserver.xml (added) +++ james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/smtpserver.xml Fri Dec 11 12:32:35 2015 @@ -0,0 +1,105 @@ +<?xml version="1.0"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<smtpservers> + <smtpserver enabled="true"> + <jmxName>smtpserver-global</jmxName> + <bind>0.0.0.0:1025</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <algorithm>SunX509</algorithm> + </tls> + <connectiontimeout>360</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <authRequired>false</authRequired> + <authorizedAddresses>0.0.0.0/0</authorizedAddresses> + <verifyIdentity>true</verifyIdentity> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting> + <handlerchain> + <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/> + <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </smtpserver> + <smtpserver enabled="true"> + <jmxName>smtpserver-TLS</jmxName> + <bind>0.0.0.0:10465</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <algorithm>SunX509</algorithm> + </tls> + <connectiontimeout>360</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <!-- + Authorize only local users + --> + <authRequired>true</authRequired> + <authorizedAddresses>0.0.0.0/0</authorizedAddresses> + <!-- Trust authenticated users --> + <verifyIdentity>false</verifyIdentity> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting> + <handlerchain> + <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/> + <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </smtpserver> + <smtpserver enabled="true"> + <jmxName>smtpserver-authenticated</jmxName> + <bind>0.0.0.0:1587</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <algorithm>SunX509</algorithm> + </tls> + <connectiontimeout>360</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <!-- + Authorize only local users + --> + <authRequired>true</authRequired> + <authorizedAddresses>0.0.0.0/0</authorizedAddresses> + <!-- Trust authenticated users --> + <verifyIdentity>false</verifyIdentity> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting> + <handlerchain> + <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/> + <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </smtpserver> +</smtpservers> + + Added: james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/test.properties URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/test.properties?rev=1719380&view=auto ============================================================================== --- james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/test.properties (added) +++ james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/test.properties Fri Dec 11 12:32:35 2015 @@ -0,0 +1,6 @@ +# Configuration file for cassandra mailbox + +cassandra.ip=127.0.0.1 +cassandra.port=9142 +cassandra.keyspace=apache_james +cassandra.replication.factor=1 \ No newline at end of file Added: james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/test.xml URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/test.xml?rev=1719380&view=auto ============================================================================== --- james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/test.xml (added) +++ james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/test.xml Fri Dec 11 12:32:35 2015 @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> +<test> + <test2>0</test2> + <james> + <property>awesome</property> + <internal> + <property>james</property> + </internal> + </james> +</test> \ No newline at end of file Modified: james/project/trunk/server/protocols/jmap/pom.xml URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap/pom.xml?rev=1719380&r1=1719379&r2=1719380&view=diff ============================================================================== --- james/project/trunk/server/protocols/jmap/pom.xml (original) +++ james/project/trunk/server/protocols/jmap/pom.xml Fri Dec 11 12:32:35 2015 @@ -204,12 +204,10 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> - <version>2.6.3</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jdk8</artifactId> - <version>2.6.3</version> </dependency> <dependency> <groupId>com.github.fge</groupId> @@ -219,7 +217,6 @@ <dependency> <groupId>com.jayway.restassured</groupId> <artifactId>rest-assured</artifactId> - <version>2.5.0</version> <scope>test</scope> </dependency> <dependency> @@ -262,13 +259,11 @@ <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> - <version>9.3.2.v20150730</version> <scope>test</scope> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> - <version>9.3.2.v20150730</version> <scope>test</scope> </dependency> <dependency> Copied: james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/DefaultPortConfiguration.java (from r1719379, james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java) URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/DefaultPortConfiguration.java?p2=james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/DefaultPortConfiguration.java&p1=james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java&r1=1719379&r2=1719380&rev=1719380&view=diff ============================================================================== --- james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java (original) +++ james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/DefaultPortConfiguration.java Fri Dec 11 12:32:35 2015 @@ -17,30 +17,17 @@ * under the License. * ****************************************************************/ -package org.apache.james.modules; +package org.apache.james.jmap; -import java.io.FileNotFoundException; +import java.util.Optional; -import javax.inject.Singleton; +public class DefaultPortConfiguration implements PortConfiguration { -import org.apache.commons.configuration.ConfigurationException; -import org.apache.james.jmap.JMAPConfiguration; -import org.apache.james.jmap.JMAPServer; - -import com.google.inject.AbstractModule; -import com.google.inject.Provides; -import com.google.inject.name.Names; - -public class TestJMAPServerModule extends AbstractModule{ + private static final int DEFAULT_PORT = 80; @Override - protected void configure() { - bindConstant().annotatedWith(Names.named(JMAPServer.DEFAULT_JMAP_PORT)).to(1080); + public Optional<Integer> getPort() { + return Optional.of(DEFAULT_PORT); } - @Provides - @Singleton - JMAPConfiguration provideConfiguration() throws FileNotFoundException, ConfigurationException{ - return new JMAPConfiguration("keystore", "james72laBalle"); - } } Modified: james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPServer.java URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPServer.java?rev=1719380&r1=1719379&r2=1719380&view=diff ============================================================================== --- james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPServer.java (original) +++ james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPServer.java Fri Dec 11 12:32:35 2015 @@ -21,12 +21,12 @@ package org.apache.james.jmap; import javax.annotation.PreDestroy; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.HierarchicalConfiguration; import org.apache.james.http.jetty.Configuration; +import org.apache.james.http.jetty.Configuration.Builder; import org.apache.james.http.jetty.JettyHttpServer; import org.apache.james.lifecycle.api.Configurable; @@ -36,23 +36,32 @@ import com.google.common.base.Throwables @Singleton public class JMAPServer implements Configurable { - public static final String DEFAULT_JMAP_PORT = "defaultJMAPPort"; - private final JettyHttpServer server; @Inject - private JMAPServer(@Named(DEFAULT_JMAP_PORT) int port, + private JMAPServer(PortConfiguration portConfiguration, AuthenticationServlet authenticationServlet, JMAPServlet jmapServlet, AuthenticationFilter authenticationFilter) { - server = JettyHttpServer.create(Configuration.builder() - .port(port) + server = JettyHttpServer.create( + configurationBuilderFor(portConfiguration) .serve("/authentication").with(authenticationServlet) .filter("/authentication").with(new BypassOnPostFilter(authenticationFilter)) .serve("/jmap").with(jmapServlet) .filter("/jmap").with(authenticationFilter) .build()); } + + private Builder configurationBuilderFor(PortConfiguration portConfiguration) { + Builder builder = Configuration.builder(); + if (portConfiguration.getPort().isPresent()) { + builder.port(portConfiguration.getPort().get()); + } else { + builder.randomPort(); + } + return builder; + } + @Override public void configure(HierarchicalConfiguration config) throws ConfigurationException { try { Copied: james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/PortConfiguration.java (from r1719379, james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java) URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/PortConfiguration.java?p2=james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/PortConfiguration.java&p1=james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java&r1=1719379&r2=1719380&rev=1719380&view=diff ============================================================================== --- james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java (original) +++ james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/PortConfiguration.java Fri Dec 11 12:32:35 2015 @@ -17,30 +17,11 @@ * under the License. * ****************************************************************/ -package org.apache.james.modules; +package org.apache.james.jmap; -import java.io.FileNotFoundException; +import java.util.Optional; -import javax.inject.Singleton; +public interface PortConfiguration { -import org.apache.commons.configuration.ConfigurationException; -import org.apache.james.jmap.JMAPConfiguration; -import org.apache.james.jmap.JMAPServer; - -import com.google.inject.AbstractModule; -import com.google.inject.Provides; -import com.google.inject.name.Names; - -public class TestJMAPServerModule extends AbstractModule{ - - @Override - protected void configure() { - bindConstant().annotatedWith(Names.named(JMAPServer.DEFAULT_JMAP_PORT)).to(1080); - } - - @Provides - @Singleton - JMAPConfiguration provideConfiguration() throws FileNotFoundException, ConfigurationException{ - return new JMAPConfiguration("keystore", "james72laBalle"); - } + Optional<Integer> getPort(); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
