Author: manaRH
Date: 2012-02-07 09:40:58 -0500 (Tue, 07 Feb 2012)
New Revision: 14303
Removed:
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mail/Meldware.java
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mail/MeldwareUser.java
Modified:
branches/community/Seam_2_3/jboss-seam-jsf2/src/test/java/org/jboss/seam/test/unit/MailTest.java
Log:
Removed Meldware from code
Deleted:
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mail/Meldware.java
===================================================================
---
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mail/Meldware.java 2012-02-07
14:40:37 UTC (rev 14302)
+++
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mail/Meldware.java 2012-02-07
14:40:58 UTC (rev 14303)
@@ -1,79 +0,0 @@
-package org.jboss.seam.mail;
-
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
-import java.util.List;
-
-import org.buni.meldware.mail.management.AdminTool;
-import org.buni.meldware.mail.util.MMJMXUtil;
-import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.log.Log;
-import org.jboss.seam.log.Logging;
-
-/**
- * Creates meldware users, mailboxes and aliases
- *
- */
-(a)Name("org.jboss.seam.mail.meldware")
-@Startup
-@Scope(APPLICATION)
-@BypassInterceptors
-@Install(precedence=BUILT_IN,
classDependencies="org.buni.meldware.mail.mailbox.Mailbox", value=false)
-public class Meldware
-{
-
- private List<MeldwareUser> users;
-
- private List<String> domains;
-
- private Log log = Logging.getLog(Meldware.class);
-
- @Create
- public void create()
- {
- // TODO Support domain creation as well. Currently they are written out to file.
-
- log.debug("Creating users and mailboxes");
- //MailboxService ms =
MMJMXUtil.getMBean("meldware.mail:type=MailboxManager,name=MailboxManager",
MailboxService.class);
- AdminTool at =
MMJMXUtil.getMBean("meldware.mail:type=MailServices,name=AdminTool",
AdminTool.class);
-
- for (MeldwareUser meldwareUser : getUsers())
- {
- at.createUser(meldwareUser.getUsername(), meldwareUser.getPassword(),
meldwareUser.getRoles());
- // TODO This won't work on AS 4.2
- /*Mailbox mbox = ms.createMailbox(meldwareUser.getUsername());
- for (String alias : meldwareUser.getAliases())
- {
- ms.createAlias(mbox.getId(), alias);
- }*/
- log.debug("Created #0 #1 #2", meldwareUser.isAdministrator() ?
"administrator" : "user", meldwareUser.getUsername(),
meldwareUser.getAliases() == null || meldwareUser.getAliases().size() == 0 ? ""
: "with aliases " + meldwareUser.getAliases());
- }
- }
-
- public List<MeldwareUser> getUsers()
- {
- return users;
- }
-
- public void setUsers(List<MeldwareUser> users)
- {
- this.users = users;
- }
-
- public List<String> getDomains()
- {
- return domains;
- }
-
- public void setDomains(List<String> domains)
- {
- this.domains = domains;
- }
-
-}
Deleted:
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mail/MeldwareUser.java
===================================================================
---
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mail/MeldwareUser.java 2012-02-07
14:40:37 UTC (rev 14302)
+++
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mail/MeldwareUser.java 2012-02-07
14:40:58 UTC (rev 14303)
@@ -1,84 +0,0 @@
-package org.jboss.seam.mail;
-
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-
-(a)Name("org.jboss.seam.mail.meldwareUser")
-@Scope(APPLICATION)
-@BypassInterceptors
-@Install(precedence=BUILT_IN, dependencies="org.jboss.seam.mail.meldware",
value=false)
-public class MeldwareUser
-{
-
- private String username;
- private String password;
-
- private boolean administrator;
-
- private List<String> aliases = new ArrayList<String>();
-
- public boolean isAdministrator()
- {
- return administrator;
- }
-
- public void setAdministrator(boolean admin)
- {
- this.administrator = admin;
- }
-
- public List<String> getAliases()
- {
- return aliases;
- }
-
- public void setAliases(List<String> aliases)
- {
- this.aliases = aliases;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- public String getUsername()
- {
- return username;
- }
-
- public void setUsername(String username)
- {
- this.username = username;
- }
-
- public List<String> getRoles()
- {
- return getRoles(this);
- }
-
- private static List<String> getRoles(MeldwareUser user)
- {
- List<String> roles = new ArrayList<String>();
- roles.add("calendaruser");
- if (user.isAdministrator())
- {
- roles.add("adminuser");
- }
- return roles;
- }
-
-}
Modified:
branches/community/Seam_2_3/jboss-seam-jsf2/src/test/java/org/jboss/seam/test/unit/MailTest.java
===================================================================
---
branches/community/Seam_2_3/jboss-seam-jsf2/src/test/java/org/jboss/seam/test/unit/MailTest.java 2012-02-07
14:40:37 UTC (rev 14302)
+++
branches/community/Seam_2_3/jboss-seam-jsf2/src/test/java/org/jboss/seam/test/unit/MailTest.java 2012-02-07
14:40:58 UTC (rev 14303)
@@ -1,13 +1,10 @@
package org.jboss.seam.test.unit;
-import java.util.ArrayList;
-
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.naming.NamingException;
import org.jboss.seam.mail.MailSession;
-import org.jboss.seam.mail.MeldwareUser;
import org.testng.annotations.Test;
import com.sun.mail.smtp.SMTPSSLTransport;
@@ -366,36 +363,5 @@
assert failure;
}
-
- @Test
- public void testMeldwareUser()
- {
- MeldwareUser meldwareUser = new MeldwareUser();
- meldwareUser.setUsername(USERNAME);
- meldwareUser.setPassword(PASSWORD);
- meldwareUser.getAliases().add(EMAIL);
-
- assert USERNAME.equals(meldwareUser.getUsername());
- assert PASSWORD.equals(meldwareUser.getPassword());
- assert meldwareUser.getAliases() != null;
- assert meldwareUser.getAliases().contains(EMAIL);
- assert meldwareUser.getRoles().contains("calendaruser");
- assert !meldwareUser.getRoles().contains("adminuser");
-
- meldwareUser.setAliases(new ArrayList<String>());
- assert meldwareUser.getAliases().isEmpty();
- }
-
- @Test
- public void testAdminMeldwareUser()
- {
- MeldwareUser meldwareUser = new MeldwareUser();
- meldwareUser.setAdministrator(true);
-
- assert meldwareUser.getRoles().contains("calendaruser");
- assert meldwareUser.getRoles().contains("adminuser");
- }
-
- // TODO Write tests for Meldware
}
Show replies by date