@Test public void getImapConfigurationShouldReturnSetValue() throws Exception { HierarchicalConfiguration<ImmutableNode> configurationBuilder = new BaseHierarchicalConfiguration(); configurationBuilder.addProperty("enableIdle", "false"); configurationBuilder.addProperty("idleTimeInterval", "1"); configurationBuilder.addProperty("idleTimeIntervalUnit", "MINUTES"); configurationBuilder.addProperty("disabledCaps", "ACL | MOVE"); ImapConfiguration imapConfiguration = IMAPServer.getImapConfiguration(configurationBuilder); ImapConfiguration expectImapConfiguration = ImapConfiguration.builder() .enableIdle(false) .idleTimeInterval(1) .idleTimeIntervalUnit(TimeUnit.MINUTES) .disabledCaps(ImmutableSet.of("ACL", "MOVE")) .build(); assertThat(imapConfiguration).isEqualTo(expectImapConfiguration); }
@VisibleForTesting static ImapConfiguration getImapConfiguration(HierarchicalConfiguration<ImmutableNode> configuration) { ImmutableSet<String> disabledCaps = ImmutableSet.copyOf(Splitter.on(CAPABILITY_SEPARATOR).split(configuration.getString("disabledCaps", ""))); return ImapConfiguration.builder() .enableIdle(configuration.getBoolean("enableIdle", ImapConfiguration.DEFAULT_ENABLE_IDLE)) .idleTimeInterval(configuration.getLong("idleTimeInterval", ImapConfiguration.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS)) .idleTimeIntervalUnit(getTimeIntervalUnit(configuration.getString("idleTimeIntervalUnit", DEFAULT_TIME_UNIT))) .disabledCaps(disabledCaps) .build(); }
IMAPServer extends AbstractConfigurableAsyncServer implements ImapConstants, IMAPServerMBean, NettyConstants { @VisibleForTesting static ImapConfiguration getImapConfiguration(HierarchicalConfiguration<ImmutableNode> configuration) { ImmutableSet<String> disabledCaps = ImmutableSet.copyOf(Splitter.on(CAPABILITY_SEPARATOR).split(configuration.getString("disabledCaps", ""))); return ImapConfiguration.builder() .enableIdle(configuration.getBoolean("enableIdle", ImapConfiguration.DEFAULT_ENABLE_IDLE)) .idleTimeInterval(configuration.getLong("idleTimeInterval", ImapConfiguration.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS)) .idleTimeIntervalUnit(getTimeIntervalUnit(configuration.getString("idleTimeIntervalUnit", DEFAULT_TIME_UNIT))) .disabledCaps(disabledCaps) .build(); } }
IMAPServer extends AbstractConfigurableAsyncServer implements ImapConstants, IMAPServerMBean, NettyConstants { @VisibleForTesting static ImapConfiguration getImapConfiguration(HierarchicalConfiguration<ImmutableNode> configuration) { ImmutableSet<String> disabledCaps = ImmutableSet.copyOf(Splitter.on(CAPABILITY_SEPARATOR).split(configuration.getString("disabledCaps", ""))); return ImapConfiguration.builder() .enableIdle(configuration.getBoolean("enableIdle", ImapConfiguration.DEFAULT_ENABLE_IDLE)) .idleTimeInterval(configuration.getLong("idleTimeInterval", ImapConfiguration.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS)) .idleTimeIntervalUnit(getTimeIntervalUnit(configuration.getString("idleTimeIntervalUnit", DEFAULT_TIME_UNIT))) .disabledCaps(disabledCaps) .build(); } IMAPServer(ImapDecoder decoder, ImapEncoder encoder, ImapProcessor processor, ImapMetrics imapMetrics); }
IMAPServer extends AbstractConfigurableAsyncServer implements ImapConstants, IMAPServerMBean, NettyConstants { @VisibleForTesting static ImapConfiguration getImapConfiguration(HierarchicalConfiguration<ImmutableNode> configuration) { ImmutableSet<String> disabledCaps = ImmutableSet.copyOf(Splitter.on(CAPABILITY_SEPARATOR).split(configuration.getString("disabledCaps", ""))); return ImapConfiguration.builder() .enableIdle(configuration.getBoolean("enableIdle", ImapConfiguration.DEFAULT_ENABLE_IDLE)) .idleTimeInterval(configuration.getLong("idleTimeInterval", ImapConfiguration.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS)) .idleTimeIntervalUnit(getTimeIntervalUnit(configuration.getString("idleTimeIntervalUnit", DEFAULT_TIME_UNIT))) .disabledCaps(disabledCaps) .build(); } IMAPServer(ImapDecoder decoder, ImapEncoder encoder, ImapProcessor processor, ImapMetrics imapMetrics); @Override void doConfigure(HierarchicalConfiguration<ImmutableNode> configuration); @Override int getDefaultPort(); @Override String getServiceType(); }
IMAPServer extends AbstractConfigurableAsyncServer implements ImapConstants, IMAPServerMBean, NettyConstants { @VisibleForTesting static ImapConfiguration getImapConfiguration(HierarchicalConfiguration<ImmutableNode> configuration) { ImmutableSet<String> disabledCaps = ImmutableSet.copyOf(Splitter.on(CAPABILITY_SEPARATOR).split(configuration.getString("disabledCaps", ""))); return ImapConfiguration.builder() .enableIdle(configuration.getBoolean("enableIdle", ImapConfiguration.DEFAULT_ENABLE_IDLE)) .idleTimeInterval(configuration.getLong("idleTimeInterval", ImapConfiguration.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS)) .idleTimeIntervalUnit(getTimeIntervalUnit(configuration.getString("idleTimeIntervalUnit", DEFAULT_TIME_UNIT))) .disabledCaps(disabledCaps) .build(); } IMAPServer(ImapDecoder decoder, ImapEncoder encoder, ImapProcessor processor, ImapMetrics imapMetrics); @Override void doConfigure(HierarchicalConfiguration<ImmutableNode> configuration); @Override int getDefaultPort(); @Override String getServiceType(); static final int DEFAULT_MAX_LINE_LENGTH; static final int DEFAULT_IN_MEMORY_SIZE_LIMIT; static final int DEFAULT_TIMEOUT; static final int DEFAULT_LITERAL_SIZE_LIMIT; }