/*
* 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.
*/
package org.apache.ftpserver.ftpletcontainer;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
import org.apache.ftpserver.ftplet.DefaultFtpReply;
import org.apache.ftpserver.ftplet.FileSystemFactory;
import org.apache.ftpserver.ftplet.FtpException;
import org.apache.ftpserver.ftplet.FtpRequest;
import org.apache.ftpserver.ftplet.FtpSession;
import org.apache.ftpserver.ftplet.FtpStatistics;
import org.apache.ftpserver.ftplet.Ftplet;
import org.apache.ftpserver.ftplet.FtpletContext;
import org.apache.ftpserver.ftplet.FtpletResult;
import org.apache.ftpserver.ftplet.UserManager;
import org.apache.ftpserver.impl.DefaultFtpRequest;
import org.apache.ftpserver.impl.DefaultFtpSession;
/**
* @author <a href="http://mina.apache.org">Apache MINA Project</a>*
*/
public abstract class FtpLetContainerTestTemplate extends TestCase {
private final List<String> calls = new ArrayList<String>();
protected void setUp() throws Exception {
MockFtplet.callback = new MockFtpletCallback();
MockFtpletCallback.returnValue = FtpletResult.DEFAULT;
}
protected abstract FtpletContainer createFtpletContainer(Map<String, Ftplet> ftplets);
private static class MockFtpletContext implements FtpletContext {
public FileSystemFactory getFileSystemManager() {
return null;
}
public FtpStatistics getFtpStatistics() {
return null;
}
public Ftplet getFtplet(String name) {
return null;
}
public UserManager getUserManager() {
return null;
}
}
public void testAddAndGetFtplet() throws FtpException {
MockFtplet ftplet1 = new MockFtplet();
MockFtplet ftplet2 = new MockFtplet();
Map<String, Ftplet> ftplets = new LinkedHashMap<String, Ftplet>();
ftplets.put("ftplet1", ftplet1);
ftplets.put("ftplet2", ftplet2);
FtpletContainer container = createFtpletContainer(ftplets);
assertSame(ftplet1, container.getFtplet("ftplet1"));
assertSame(ftplet2, container.getFtplet("ftplet2"));
}
public void testFtpletLifecyclePreContainerInit() throws FtpException {
MockFtplet ftplet = new MockFtplet();
Map<String, Ftplet> ftplets = new LinkedHashMap<String, Ftplet>();
ftplets.put("ftplet1", ftplet);
FtpletContainer container = createFtpletContainer(ftplets);
// ftplet should be initialized before the container is
assertNull(ftplet.context);
container.init(new MockFtpletContext());
assertNotNull(ftplet.context);
// make sure ftplets get's destroyed
assertFalse(ftplet.destroyed);
container.destroy();
assertTrue(ftplet.destroyed);
}
public void testOnConnect() throws FtpException, IOException {
MockFtplet ftplet1 = new MockFtplet() {
public FtpletResult onConnect(FtpSession session)
throws FtpException, IOException {
calls.add("ftplet1");
return super.onConnect(session);
}
};
MockFtplet ftplet2 = new MockFtplet() {
public FtpletResult onConnect(FtpSession session)
throws FtpException, IOException {
calls.add("ftplet2");
return super.onConnect(session);
}
};
Map<String, Ftplet> ftplets = new LinkedHashMap<String, Ftplet>();
ftplets.put("ftplet1", ftplet1);
ftplets.put("ftplet2", ftplet2);
FtpletContainer container = createFtpletContainer(ftplets);
container.onConnect(new DefaultFtpSession(null));
assertEquals(2, calls.size());
assertEquals("ftplet1", calls.get(0));
assertEquals("ftplet2", calls.get(1));
}
public void testOnDisconnect() throws FtpException, IOException {
MockFtplet ftplet1 = new MockFtplet() {
public FtpletResult onDisconnect(FtpSession session)
throws FtpException, IOException {
calls.add("ftplet1");
return super.onDisconnect(session);
}
};
MockFtplet ftplet2 = new MockFtplet() {
public FtpletResult onDisconnect(FtpSession session)
throws FtpException, IOException {
calls.add("ftplet2");
return super.onDisconnect(session);
}
};
Map<String, Ftplet> ftplets = new LinkedHashMap<String, Ftplet>();
ftplets.put("ftplet1", ftplet1);
ftplets.put("ftplet2", ftplet2);
FtpletContainer container = createFtpletContainer(ftplets);
container.onDisconnect(new DefaultFtpSession(null));
assertEquals(2, calls.size());
assertEquals("ftplet1", calls.get(0));
assertEquals("ftplet2", calls.get(1));
}
public void testOnLogin() throws FtpException, IOException {
MockFtplet ftplet1 = new MockFtplet() {
public FtpletResult onLogin(FtpSession session, FtpRequest request)
throws FtpException, IOException {
calls.add("ftplet1");
return super.onLogin(session, request);
}
};
MockFtplet ftplet2 = new MockFtplet() {
public FtpletResult onLogin(FtpSession session, FtpRequest request)
throws FtpException, IOException {
calls.add("ftplet2");
return super.onLogin(session, request);
}
};
Map<String, Ftplet> ftplets = new LinkedHashMap<String, Ftplet>();
ftplets.put("ftplet1", ftplet1);
ftplets.put("ftplet2", ftplet2);
FtpletContainer container = createFtpletContainer(ftplets);
container.afterCommand(new DefaultFtpSession(null), new DefaultFtpRequest(
"PASS"), null);
assertEquals(2, calls.size());
assertEquals("ftplet1", calls.get(0));
assertEquals("ftplet2", calls.get(1));
}
public void testOnDeleteStart() throws FtpException, IOException {
MockFtplet ftplet1 = new MockFtplet() {
public FtpletResult onDeleteStart(FtpSession session,
FtpRequest request) throws FtpException, IOException {
calls.add("ftplet1");
return super.onDeleteStart(session, request);
}
};
MockFtplet ftplet2 = new MockFtplet() {
public FtpletResult onDeleteStart(FtpSession session,
FtpRequest request) throws FtpException, IOException {
calls.add("ftplet2");
return super.onDeleteStart(session, request);
}
};
Map<String, Ftplet> ftplets = new LinkedHashMap<String, Ftplet>();
ftplets.put("ftplet1", ftplet1);
ftplets.put("ftplet2", ftplet2);
FtpletContainer container = createFtpletContainer(ftplets);
container.beforeCommand(new DefaultFtpSession(null), new D
没有合适的资源?快使用搜索试试~ 我知道了~
apache ftpserver
共739个文件
class:398个
java:290个
html:18个
4星 · 超过85%的资源 需积分: 9 41 下载量 57 浏览量
2009-08-30
22:11:18
上传
评论
收藏 829KB RAR 举报
温馨提示
apache ftpserver project
资源推荐
资源详情
资源评论
收起资源包目录
apache ftpserver (739个子文件)
users.properties.bak 1KB
FtpIoSession.class 17KB
FtpLetContainerTestTemplate.class 15KB
DbUserManager.class 13KB
CustomPropertiesUserManager.class 12KB
PropertiesUserManager.class 12KB
ListenerBeanDefinitionParser.class 10KB
LocalizedFtpReply.class 10KB
BasePropertiesTest.class 9KB
DefaultFtpStatistics.class 9KB
NioListener.class 9KB
NativeFtpFile.class 9KB
FtpLetReturnDisconnectTest.class 9KB
IODataConnectionFactory.class 9KB
DefaultFtpHandler.class 9KB
UserManagerTestTemplate.class 9KB
BaseProperties.class 9KB
ServerBeanDefinitionParser.class 8KB
FtpLetReturnSkipTest.class 8KB
PASS.class 8KB
DefaultFtpServerContext.class 7KB
SslConfigurationFactory.class 7KB
StoreTest.class 7KB
ClientTestTemplate.class 7KB
IODataConnection.class 6KB
CommandFactoryFactory.class 6KB
ListTest.class 6KB
DefaultMessageResource.class 6KB
NativeFileObjectTest.class 6KB
STOU.class 6KB
RETR.class 6KB
USER.class 5KB
UserManagerBeanDefinitionParser.class 5KB
IoUtils.class 5KB
SpringUtil.class 5KB
AddUser.class 5KB
FtpMd5Test.class 5KB
LIST.class 5KB
STOR.class 5KB
NLST.class 5KB
APPE.class 5KB
SSLTestTemplate.class 5KB
TestUtil.class 5KB
SpringConfigTest.class 5KB
MD5.class 5KB
FtpLetReturnDefaultTest.class 5KB
MLSD.class 5KB
DefaultFtpServer.class 5KB
DataConnectionConfigurationFactory.class 5KB
DefaultFtpSession.class 5KB
DefaultFtpletContainer.class 5KB
PassivePorts.class 4KB
RenameTest.class 4KB
StringUtils.class 4KB
ExplicitSecurityTestTemplate.class 4KB
SITE_DESCUSER.class 4KB
LoginTest.class 4KB
FtpServerFactory.class 4KB
PropertiesUserManagerTest.class 4KB
CommandFactoryBeanDefinitionParser.class 4KB
ListenerFactory.class 4KB
AUTH.class 4KB
DirectoryLister.class 4KB
SiteTest.class 4KB
DbUserManagerFactory.class 4KB
EPRT.class 4KB
SITE_STAT.class 4KB
BaseUser.class 4KB
PassivePortsTest.class 4KB
MFMTTest.class 4KB
OS.class 4KB
SITE_WHO.class 4KB
MockFtplet.class 4KB
CommandLine.class 4KB
PORT.class 4KB
RetrieveTest.class 4KB
BindExceptionParallelTest.class 4KB
FtpHandlerAdapter.class 3KB
RMD.class 3KB
MinaImplicitDataChannelTest.class 3KB
NativeFileSystemView.class 3KB
RegularExprTest.class 3KB
MKD.class 3KB
MFMT.class 3KB
PASV.class 3KB
PasvTest.class 3KB
DirectoryListerTest.class 3KB
SITE.class 3KB
Daemon.class 3KB
DELE.class 3KB
MinaClientAuthTest.class 3KB
DateUtils.class 3KB
MockFtpletCallback.class 3KB
ExtendedAliasKeymanagerTest.class 3KB
RmDirTest.class 3KB
FtpLetOnConnectTest.class 3KB
ListArgumentParserTest.class 3KB
OPTS.class 3KB
RNTO.class 3KB
Server.class 3KB
共 739 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
- wout3692013-01-07还可以,可以使用!
乔老爷子
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于微信小程序的通用订票系统设计源码
- 基于ThinkPHP的轻量级PHP开发框架设计源码
- 基于CSS的响应式鲜花网站全屏效果设计源码
- 基于JavaScript的访客预约系统设计源码
- 基于Vue和ECharts的工作租房数据可视化系统设计源码
- 1040g0cg310ravpiu6ibg5pg00tsipsln3ju2d0g 2
- 基于Python的SAR图像去噪CNN-NLM设计源码
- redhat6升级到redhat7,过程redhat6.x-> redhat6.10->rehat7.9 主版本最高版本
- 基于Django的流程引擎设计源码
- 基于Node.js的Express框架与MySQL的后台管理系统设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功