Skip to content

Commit

Permalink
Merge pull request #1 from seedstack/refactor-packages
Browse files Browse the repository at this point in the history
Refactor packages
  • Loading branch information
adrienlauer committed Nov 3, 2015
2 parents 4430fc1 + 1118c84 commit f7c8a4c
Show file tree
Hide file tree
Showing 29 changed files with 80 additions and 111 deletions.
4 changes: 1 addition & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
<javamail.version>1.4.7</javamail.version>
<subethamail.version>3.1.7</subethamail.version>

<compatibility.groupId>org.seedstack.seed</compatibility.groupId>
<compatibility.artifactId>seed-mail-support-core</compatibility.artifactId>
<compatibility.version>2.0.0</compatibility.version>
<compatibility.skip>true</compatibility.skip>
</properties>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail;
package org.seedstack.javamail;

import org.seedstack.seed.core.api.Logging;
import org.seedstack.seed.it.AbstractSeedIT;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.seedstack.javamail.fixtures.TestConstantsValues;
import org.seedstack.seed.Logging;
import org.seedstack.seed.it.AbstractSeedIT;
import org.slf4j.Logger;

import javax.inject.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail;
package org.seedstack.javamail;

import com.google.common.base.Predicate;
import org.seedstack.seed.it.AbstractSeedIT;
import org.seedstack.seed.mail.api.MessageRetriever;
import org.seedstack.seed.mail.api.WithMailServer;
import org.junit.Test;
import org.seedstack.seed.mail.assertions.MockMailServerAssertions;
import org.seedstack.javamail.fixtures.TestConstantsValues;
import org.seedstack.javamail.test.MessageRetriever;
import org.seedstack.javamail.test.MockMailServerAssertions;
import org.seedstack.javamail.test.WithMailServer;
import org.seedstack.seed.it.AbstractSeedIT;

import javax.annotation.Nullable;
import javax.inject.Inject;
Expand All @@ -27,7 +28,6 @@
import java.util.Collection;
import java.util.Date;

import static org.seedstack.seed.mail.assertions.MockMailServerAssertions.assertThat;
import static org.assertj.core.api.Assertions.fail;

@WithMailServer(host = "localhost", port = 6457)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail;
package org.seedstack.javamail;

import org.seedstack.seed.it.AbstractSeedIT;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.seedstack.javamail.fixtures.TestConstantsValues;
import org.seedstack.seed.it.AbstractSeedIT;

import javax.inject.Inject;
import javax.inject.Named;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail;
package org.seedstack.javamail;

import org.seedstack.seed.it.AbstractSeedIT;
import org.seedstack.seed.mail.api.MessageRetriever;
import org.seedstack.seed.mail.api.WithMailServer;
import org.seedstack.seed.mail.assertions.MockMailServerAssertions;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.seedstack.javamail.fixtures.MailPreparator;
import org.seedstack.javamail.fixtures.TestConstantsValues;
import org.seedstack.javamail.test.MessageRetriever;
import org.seedstack.javamail.test.MockMailServerAssertions;
import org.seedstack.javamail.test.WithMailServer;
import org.seedstack.seed.it.AbstractSeedIT;

import javax.inject.Inject;
import javax.inject.Named;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail;
package org.seedstack.javamail.fixtures;

import javax.mail.Message;
import javax.mail.MessagingException;
Expand All @@ -14,14 +14,14 @@
import javax.mail.internet.MimeMessage;
import java.util.Date;

class MailPreparator {
public class MailPreparator {
private Session session;

MailPreparator(Session session) {
public MailPreparator(Session session) {
this.session = session;
}

Message prepareMessageToBeSent(String to, String from, String subject, String text) throws MessagingException {
public Message prepareMessageToBeSent(String to, String from, String subject, String text) throws MessagingException {
Message m = new MimeMessage(session);
m.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
m.setFrom(new InternetAddress(from));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Contains assertions about the mail features.
*
* @author Pierre Thirouin
*/
package org.seedstack.seed.mail.assertions;
package org.seedstack.javamail.fixtures;

public interface TestConstantsValues {
String DEFAULT_USERNAME = "testuser";
String DEFAULT_PASSWORD = "testpw";
String DEFAULT_RECIPIENT = "aymen.benhmida@ext.mpsa.com";
String DEFAULT_FROM = "testFrom@test.com";
}
15 changes: 0 additions & 15 deletions src/it/java/org/seedstack/seed/mail/TestConstantsValues.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
org.seedstack.seed.mail.internal.JavaMailITRunnerPlugin
org.seedstack.javamail.internal.JavaMailITRunnerPlugin
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail.internal;
package org.seedstack.javamail.internal;

import org.junit.rules.ExternalResource;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.seedstack.seed.mail.api.WithMailServer;
import org.seedstack.javamail.test.WithMailServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.subethamail.wiser.Wiser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail.internal;
package org.seedstack.javamail.internal;

import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
import org.seedstack.seed.mail.api.MessageRetriever;
import org.seedstack.seed.mail.assertions.MailMessagesAssertions;
import org.seedstack.javamail.test.MailMessagesAssertions;
import org.seedstack.javamail.test.MessageRetriever;
import org.subethamail.wiser.Wiser;

class JavaMailITModule extends AbstractModule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail.internal;
package org.seedstack.javamail.internal;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.junit.runners.model.FrameworkMethod;
import org.seedstack.seed.it.spi.ITKernelMode;
import org.seedstack.seed.it.spi.ITRunnerPlugin;
import org.seedstack.seed.mail.api.WithMailServer;
import org.junit.rules.MethodRule;
import org.junit.rules.TestRule;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.TestClass;
import org.seedstack.javamail.test.WithMailServer;
import org.seedstack.seed.it.spi.ITKernelMode;
import org.seedstack.seed.it.spi.ITRunnerPlugin;

import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail.internal;
package org.seedstack.javamail.internal;

import com.google.inject.PrivateModule;
import com.google.inject.name.Names;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail.internal;
package org.seedstack.javamail.internal;

import com.google.common.collect.Maps;
import com.google.inject.AbstractModule;
import org.seedstack.seed.core.internal.application.ApplicationPlugin;
import org.seedstack.seed.core.utils.SeedReflectionUtils;
import org.seedstack.seed.mail.spi.SessionConfigurer;
import io.nuun.kernel.api.Plugin;
import io.nuun.kernel.api.plugin.InitState;
import io.nuun.kernel.api.plugin.PluginException;
import io.nuun.kernel.api.plugin.context.InitContext;
import io.nuun.kernel.core.AbstractPlugin;
import org.apache.commons.configuration.Configuration;
import org.seedstack.javamail.spi.SessionConfigurer;
import org.seedstack.seed.core.internal.application.ApplicationPlugin;
import org.seedstack.seed.core.utils.SeedReflectionUtils;

import javax.mail.Session;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail.internal;
package org.seedstack.javamail.internal;

import com.google.common.collect.Maps;
import org.seedstack.seed.mail.spi.SessionConfigurer;
import org.apache.commons.configuration.Configuration;
import org.seedstack.javamail.spi.SessionConfigurer;

import javax.mail.Session;
import java.util.Iterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail.internal;
package org.seedstack.javamail.internal;

import com.google.common.collect.Lists;
import org.seedstack.seed.mail.api.MessageRetriever;
import org.seedstack.javamail.test.MessageRetriever;
import org.subethamail.wiser.Wiser;
import org.subethamail.wiser.WiserMessage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail.spi;
package org.seedstack.javamail.spi;

import javax.mail.Session;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

/**
* Provides classes for extending the mail support.
*
* @author Pierre Thirouin
*/
package org.seedstack.seed.mail.spi;
package org.seedstack.javamail.spi;
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail.assertions;
package org.seedstack.javamail.test;

import org.seedstack.seed.core.api.ErrorCode;
import org.seedstack.seed.ErrorCode;

enum MailAssertionsErrorCodes implements ErrorCode {
NO_MAIL_PROVIDER_FOUND,
NO_SUCH_PROVIDER_FOUND,
NO_MAIL_SUBJECT_SPECIFIED,
NO_RECIPIENTS_SPECIFIED,
NOT_SAME_RECIPIENTS_SIZE,
ERROR_OCCURED_WHILE_EXTRACTING_MESSAGE_FROM_SERVER,
ERROR_OCCURRED_WHILE_EXTRACTING_MESSAGE_FROM_SERVER,
NO_SENT_DATE_FOUND
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.mail.assertions;
package org.seedstack.javamail.test;

import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.FluentIterable;
import org.seedstack.seed.core.api.SeedException;
import org.assertj.core.api.AbstractAssert;
import org.seedstack.seed.SeedException;
import org.subethamail.wiser.Wiser;
import org.subethamail.wiser.WiserMessage;

Expand All @@ -25,14 +25,10 @@
import java.util.Collection;
import java.util.List;

import static org.seedstack.seed.mail.assertions.MailAssertionsErrorCodes.ERROR_OCCURED_WHILE_EXTRACTING_MESSAGE_FROM_SERVER;
import static org.seedstack.seed.mail.assertions.MailAssertionsErrorCodes.NOT_SAME_RECIPIENTS_SIZE;
import static org.seedstack.seed.mail.assertions.MailAssertionsErrorCodes.NO_MAIL_SUBJECT_SPECIFIED;
import static org.seedstack.seed.mail.assertions.MailAssertionsErrorCodes.NO_RECIPIENTS_SPECIFIED;
import static org.seedstack.seed.mail.assertions.MailAssertionsErrorCodes.NO_SENT_DATE_FOUND;
import static javax.mail.Message.RecipientType;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.seedstack.javamail.test.MailAssertionsErrorCodes.*;

/**
* Assertion class over messages received by the mock server in order to verify their integrity
Expand Down Expand Up @@ -149,7 +145,7 @@ public Message apply(@Nullable WiserMessage input) {
try {
return input.getMimeMessage();
} catch (MessagingException e) {
throwException(e, ERROR_OCCURED_WHILE_EXTRACTING_MESSAGE_FROM_SERVER);
throwException(e, ERROR_OCCURRED_WHILE_EXTRACTING_MESSAGE_FROM_SERVER);
}
return null;
}
Expand All @@ -172,7 +168,7 @@ protected Collection<Message> getMessages() {
/**
* Utility method to throw exceptions.
*
* @param e The throwable to wrap.
* @param e The throwable to wrap.
* @param errorCode The error code to use for wrapping.
*/
protected void throwException(Throwable e, MailAssertionsErrorCodes errorCode) {
Expand Down
Loading

0 comments on commit f7c8a4c

Please sign in to comment.