You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2003/03/02 19:27:41 UTC
cvs commit: jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser EnterpriseUnixFTPEntryParserTest.java FTPParseTestFramework.java NTFTPEntryParserTest.java OS2FTPEntryParserTest.java UnixFTPEntryParserTest.java VMSFTPEntryParserTest.java
scohen 2003/03/02 10:27:41
Added: net/src/test/org/apache/commons/net/ftp/parser
EnterpriseUnixFTPEntryParserTest.java
FTPParseTestFramework.java
NTFTPEntryParserTest.java
OS2FTPEntryParserTest.java
UnixFTPEntryParserTest.java
VMSFTPEntryParserTest.java
Log:
tests for new FTPFileEntryParsers, formerly in ftp2
Revision Changes Path
1.1 jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParserTest.java
Index: EnterpriseUnixFTPEntryParserTest.java
===================================================================
package org.apache.commons.net.ftp.parser;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Commons" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import junit.framework.TestSuite;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPFileEntryParser;
/**
* Tests the EnterpriseUnixFTPEntryParser
*
* @version $Id: EnterpriseUnixFTPEntryParserTest.java,v 1.1 2003/03/02 18:27:41 scohen Exp $
* @author <a href="mailto:Winston.Ojeda@qg.com">Winston Ojeda</a>
*/
public class EnterpriseUnixFTPEntryParserTest extends FTPParseTestFramework
{
private static final String[] BADSAMPLES =
{
"zrwxr-xr-x 2 root root 4096 Mar 2 15:13 zxbox",
"dxrwr-xr-x 2 root root 4096 Aug 24 2001 zxjdbc",
"drwxr-xr-x 2 root root 4096 Jam 4 00:03 zziplib",
"drwxr-xr-x 2 root 99 4096 Feb 23 30:01 zzplayer",
"drwxr-xr-x 2 root root 4096 Aug 36 2001 zztpp",
"-rw-r--r-- 1 14 staff 80284 Aug 22 zxJDBC-1.2.3.tar.gz",
"-rw-r--r-- 1 14 staff 119:26 Aug 22 2000 zxJDBC-1.2.3.zip",
"-rw-r--r-- 1 ftp no group 83853 Jan 22 2001 zxJDBC-1.2.4.tar.gz",
"-rw-r--r-- 1ftp nogroup 126552 Jan 22 2001 zxJDBC-1.2.4.zip",
"-rw-r--r-- 1 root root 111325 Apr -7 18:79 zxJDBC-2.0.1b1.tar.gz",
"drwxr-xr-x 2 root root 4096 Mar 2 15:13 zxbox",
"drwxr-xr-x 2 root root 4096 Aug 24 2001 zxjdbc",
"drwxr-xr-x 2 root root 4096 Jan 4 00:03 zziplib",
"drwxr-xr-x 2 root 99 4096 Feb 23 2001 zzplayer",
"drwxr-xr-x 2 root root 4096 Aug 6 2001 zztpp",
"-rw-r--r-- 1 14 staff 80284 Aug 22 2000 zxJDBC-1.2.3.tar.gz",
"-rw-r--r-- 1 14 staff 119926 Aug 22 2000 zxJDBC-1.2.3.zip",
"-rw-r--r-- 1 ftp nogroup 83853 Jan 22 2001 zxJDBC-1.2.4.tar.gz",
"-rw-r--r-- 1 ftp nogroup 126552 Jan 22 2001 zxJDBC-1.2.4.zip",
"-rw-r--r-- 1 root root 111325 Apr 27 2001 zxJDBC-2.0.1b1.tar.gz",
"-rw-r--r-- 1 root root 190144 Apr 27 2001 zxJDBC-2.0.1b1.zip"
};
private static final String[] GOODSAMPLES =
{
"-C--E-----FTP B QUA1I1 18128 41 Aug 12 13:56 QUADTEST",
"-C--E-----FTP A QUA1I1 18128 41 Aug 12 13:56 QUADTEST2"
};
/**
* Creates a new EnterpriseUnixFTPEntryParserTest object.
*
* @param name Test name.
*/
public EnterpriseUnixFTPEntryParserTest(String name)
{
super(name);
}
/**
* Method suite.
*
* @return TestSuite
*/
public static TestSuite suite()
{
return (new TestSuite(EnterpriseUnixFTPEntryParserTest.class));
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnDirectory()
*/
public void testParseFieldsOnDirectory() throws Exception
{
// Everything is a File for now.
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnFile()
*/
public void testParseFieldsOnFile() throws Exception
{
FTPFile file = getParser().parseFTPEntry("-C--E-----FTP B QUA1I1 18128 41 Aug 12 13:56 QUADTEST");
assertTrue("Should be a file.",
file.isFile());
assertEquals("QUADTEST",
file.getName());
assertEquals(41,
file.getSize());
assertEquals("QUA1I1",
file.getUser());
assertEquals("18128",
file.getGroup());
assertEquals("Mon Aug 12 13:56:00 2002",
df.format(file.getTimestamp().getTime()));
checkPermisions(file);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getBadListing()
*/
protected String[] getBadListing()
{
return (BADSAMPLES);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getGoodListing()
*/
protected String[] getGoodListing()
{
return (GOODSAMPLES);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getParser()
*/
protected FTPFileEntryParser getParser()
{
return (new EnterpriseUnixFTPEntryParser());
}
/**
* Method checkPermisions. Verify that the parser does NOT set the
* permissions.
*
* @param dir
*/
private void checkPermisions(FTPFile dir)
{
assertTrue("Owner should not have read permission.",
!dir.hasPermission(FTPFile.USER_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("Owner should not have write permission.",
!dir.hasPermission(FTPFile.USER_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("Owner should not have execute permission.",
!dir.hasPermission(FTPFile.USER_ACCESS,
FTPFile.EXECUTE_PERMISSION));
assertTrue("Group should not have read permission.",
!dir.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("Group should not have write permission.",
!dir.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("Group should not have execute permission.",
!dir.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.EXECUTE_PERMISSION));
assertTrue("World should not have read permission.",
!dir.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("World should not have write permission.",
!dir.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("World should not have execute permission.",
!dir.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.EXECUTE_PERMISSION));
}
}
1.1 jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/FTPParseTestFramework.java
Index: FTPParseTestFramework.java
===================================================================
package org.apache.commons.net.ftp.parser;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Commons" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import junit.framework.TestCase;
import java.text.SimpleDateFormat;
import java.util.Locale;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPFileEntryParser;
/**
* @author <a href="mailto:stevecoh1@attbi.com">Steve Cohen</a>
* @version $Id: FTPParseTestFramework.java,v 1.1 2003/03/02 18:27:41 scohen Exp $
*/
public abstract class FTPParseTestFramework extends TestCase
{
private FTPFileEntryParser parser = null;
protected SimpleDateFormat df = null;
/**
* @see junit.framework.TestCase#TestCase(String)
*/
public FTPParseTestFramework(String name)
{
super(name);
}
/**
* Method testBadListing.
* Tests that parser provided failures actually fail.
* @throws Exception
*/
public void testBadListing() throws Exception
{
String[] badsamples = getBadListing();
for (int i = 0; i < badsamples.length; i++)
{
String test = badsamples[i];
FTPFile f = parser.parseFTPEntry(test);
assertNull("Should have Failed to parse " + test,
f);
}
}
/**
* Method testGoodListing.
* Test that parser provided listings pass.
* @throws Exception
*/
public void testGoodListing() throws Exception
{
String[] goodsamples = getGoodListing();
for (int i = 0; i < goodsamples.length; i++)
{
String test = goodsamples[i];
FTPFile f = parser.parseFTPEntry(test);
assertNotNull("Failed to parse " + test,
f);
}
}
/**
* Method getBadListing.
* Implementors must provide a listing that contains failures.
* @return String[]
*/
protected abstract String[] getBadListing();
/**
* Method getGoodListing.
* Implementors must provide a listing that passes.
* @return String[]
*/
protected abstract String[] getGoodListing();
/**
* Method getParser.
* Provide the parser to use for testing.
* @return FTPFileEntryParser
*/
protected abstract FTPFileEntryParser getParser();
/**
* Method testParseFieldsOnDirectory.
* Provide a test to show that fields on a directory entry are parsed correctly.
* @throws Exception
*/
public abstract void testParseFieldsOnDirectory() throws Exception;
/**
* Method testParseFieldsOnFile.
* Provide a test to show that fields on a file entry are parsed correctly.
* @throws Exception
*/
public abstract void testParseFieldsOnFile() throws Exception;
/**
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception
{
super.setUp();
parser = getParser();
df = new SimpleDateFormat("EEE MMM dd kk:mm:ss yyyy", Locale.US);
}
}
1.1 jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java
Index: NTFTPEntryParserTest.java
===================================================================
package org.apache.commons.net.ftp.parser;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Commons" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPFileEntryParser;
import junit.framework.TestSuite;
/**
* @author <a href="mailto:scohen@stevecoh1@attbi.com">Steve Cohen</a>
* @versionn $Id: NTFTPEntryParserTest.java,v 1.1 2003/03/02 18:27:41 scohen Exp $
*/
public class NTFTPEntryParserTest extends FTPParseTestFramework
{
private static final String [] goodsamples = {
"05-26-95 10:57AM 143712 $LDR$",
"05-20-97 03:31PM 681 .bash_history",
"12-05-96 05:03PM <DIR> absoft2",
"11-14-97 04:21PM 953 AUDITOR3.INI",
"05-22-97 08:08AM 828 AUTOEXEC.BAK",
"01-22-98 01:52PM 795 AUTOEXEC.BAT",
"05-13-97 01:46PM 828 AUTOEXEC.DOS",
"12-03-96 06:38AM 403 AUTOTOOL.LOG",
"01-20-97 03:48PM <DIR> bin",
};
private static final String [] badsamples = {
"05-26-1995 10:57AM 143712 $LDR$",
"20-05-97 03:31PM 681 .bash_history",
"12-05-96 17:03 <DIR> absoft2",
"05-22-97 08:08 828 AUTOEXEC.BAK",
" 0 DIR 05-19-97 12:56 local",
" 0 DIR 05-12-97 16:52 Maintenance Desktop",
};
/**
* @see junit.framework.TestCase#TestCase(String)
*/
public NTFTPEntryParserTest (String name)
{
super(name);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getGoodListing()
*/
protected String[] getGoodListing()
{
return(goodsamples);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getBadListing()
*/
protected String[] getBadListing()
{
return(badsamples);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getParser()
*/
protected FTPFileEntryParser getParser()
{
return(new NTFTPEntryParser());
}
/**
* Method suite.
* @return TestSuite
*/
public static TestSuite suite()
{
return(new TestSuite(NTFTPEntryParserTest.class));
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnDirectory()
*/
public void testParseFieldsOnDirectory() throws Exception
{
FTPFile dir = getParser().parseFTPEntry("12-05-96 05:03PM <DIR> absoft2");
assertNotNull("Could not parse entry.", dir);
assertEquals("Thu Dec 05 17:03:00 1996",
df.format(dir.getTimestamp().getTime()));
assertTrue("Should have been a directory.",
dir.isDirectory());
assertEquals("absoft2", dir.getName());
assertEquals(0, dir.getSize());
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnFile()
*/
public void testParseFieldsOnFile() throws Exception
{
FTPFile f = getParser().parseFTPEntry("05-22-97 08:08AM 828 AUTOEXEC.BAK");
assertNotNull("Could not parse entry.", f);
assertEquals("Thu May 22 08:08:00 1997",
df.format(f.getTimestamp().getTime()));
assertTrue("Should have been a file.",
f.isFile());
assertEquals("AUTOEXEC.BAK", f.getName());
assertEquals(828, f.getSize());
}
}
1.1 jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/OS2FTPEntryParserTest.java
Index: OS2FTPEntryParserTest.java
===================================================================
package org.apache.commons.net.ftp.parser;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Commons" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import junit.framework.TestSuite;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPFileEntryParser;
/**
* @author <a href="mailto:scohen@stevecoh1@attbi.com">Steve Cohen</a>
* @version $Id: OS2FTPEntryParserTest.java,v 1.1 2003/03/02 18:27:41 scohen Exp $
*/
public class OS2FTPEntryParserTest extends FTPParseTestFramework
{
private static final String[] badsamples =
{
" DIR 12-30-97 12:32 jbrekke",
" 0 rsa DIR 11-25-97 09:42 junk",
" 0 dir 05-12-97 16:44 LANGUAGE",
" 0 DIR 05-19-2000 12:56 local",
" 0 DIR 13-05-97 25:49 MPTN",
"587823 RSA DIR Jan-08-97 13:58 OS2KRNL",
" 33280 A 1997-02-03 13:49 OS2LDR",
"12-05-96 05:03PM <DIR> absoft2",
"11-14-97 04:21PM 953 AUDITOR3.INI"
};
private static final String[] goodsamples =
{
" 0 DIR 12-30-97 12:32 jbrekke",
" 0 DIR 11-25-97 09:42 junk",
" 0 DIR 05-12-97 16:44 LANGUAGE",
" 0 DIR 05-19-97 12:56 local",
" 0 DIR 05-12-97 16:52 Maintenance Desktop",
" 0 DIR 05-13-97 10:49 MPTN",
"587823 RSA DIR 01-08-97 13:58 OS2KRNL",
" 33280 A 02-09-97 13:49 OS2LDR",
" 0 DIR 11-28-97 09:42 PC",
"149473 A 11-17-98 16:07 POPUPLOG.OS2",
" 0 DIR 05-12-97 16:44 PSFONTS"
};
/**
* @see junit.framework.TestCase#TestCase(String)
*/
public OS2FTPEntryParserTest(String name)
{
super(name);
}
/**
* Method suite.
* @return TestSuite
*/
public static TestSuite suite()
{
return (new TestSuite(OS2FTPEntryParserTest.class));
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnDirectory()
*/
public void testParseFieldsOnDirectory() throws Exception
{
FTPFile dir = getParser().parseFTPEntry(" 0 DIR 11-28-97 09:42 PC");
assertNotNull("Could not parse entry.", dir);
assertTrue("Should have been a directory.",
dir.isDirectory());
assertEquals(0,dir.getSize());
assertEquals("PC", dir.getName());
assertEquals("Fri Nov 28 09:42:00 1997",
df.format(dir.getTimestamp().getTime()));
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnFile()
*/
public void testParseFieldsOnFile() throws Exception
{
FTPFile file = getParser().parseFTPEntry("149473 A 11-17-98 16:07 POPUPLOG.OS2");
assertNotNull("Could not parse entry.", file);
assertTrue("Should have been a file.",
file.isFile());
assertEquals(149473,file.getSize());
assertEquals("POPUPLOG.OS2", file.getName());
assertEquals("Tue Nov 17 16:07:00 1998",
df.format(file.getTimestamp().getTime()));
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getBadListing()
*/
protected String[] getBadListing()
{
return (badsamples);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getGoodListing()
*/
protected String[] getGoodListing()
{
return (goodsamples);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getParser()
*/
protected FTPFileEntryParser getParser()
{
return (new OS2FTPEntryParser());
}
}
1.1 jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java
Index: UnixFTPEntryParserTest.java
===================================================================
package org.apache.commons.net.ftp.parser;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Commons" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import junit.framework.TestSuite;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPFileEntryParser;
import java.util.Calendar;
import java.util.Date;
/**
* @author <a href="mailto:scohen@stevecoh1@attbi.com">Steve Cohen</a>
* @versionn $Id: UnixFTPEntryParserTest.java,v 1.1 2003/03/02 18:27:41 scohen Exp $
*/
public class UnixFTPEntryParserTest extends FTPParseTestFramework
{
private static final String[] badsamples =
{
"zrwxr-xr-x 2 root root 4096 Mar 2 15:13 zxbox",
"dxrwr-xr-x 2 root root 4096 Aug 24 2001 zxjdbc",
"drwxr-xr-x 2 root root 4096 Jam 4 00:03 zziplib",
"drwxr-xr-x 2 root 99 4096 Feb 23 30:01 zzplayer",
"drwxr-xr-x 2 root root 4096 Aug 36 2001 zztpp",
"-rw-r--r-- 1 14 staff 80284 Aug 22 zxJDBC-1.2.3.tar.gz",
"-rw-r--r-- 1 14 staff 119:26 Aug 22 2000 zxJDBC-1.2.3.zip",
"-rw-r--r-- 1 ftp no group 83853 Jan 22 2001 zxJDBC-1.2.4.tar.gz",
"-rw-r--r-- 1ftp nogroup 126552 Jan 22 2001 zxJDBC-1.2.4.zip",
"-rw-r--r-- 1 root root 111325 Apr -7 18:79 zxJDBC-2.0.1b1.tar.gz"
};
private static final String[] goodsamples =
{
"-rw-r--r-- 1 500 500 21 Aug 8 14:14 JB3-TES1.gz",
"-rwxr-xr-x 2 root root 4096 Mar 2 15:13 zxbox",
"drwxr-xr-x 2 root root 4096 Aug 24 2001 zxjdbc",
"drwxr-xr-x 2 root root 4096 Jan 4 00:03 zziplib",
"drwxr-xr-x 2 root 99 4096 Feb 23 2001 zzplayer",
"drwxr-xr-x 2 root root 4096 Aug 6 2001 zztpp",
"lrw-r--r-- 1 14 14 80284 Aug 22 2000 zxJDBC-1.2.3.tar.gz",
"frw-r--r-- 1 14 staff 119926 Aug 22 2000 zxJDBC-1.2.3.zip",
"crw-r--r-- 1 ftp nogroup 83853 Jan 22 2001 zxJDBC-1.2.4.tar.gz",
"brw-r--r-- 1 ftp nogroup 126552 Jan 22 2001 zxJDBC-1.2.4.zip",
"-rw-r--r-- 1 root root 111325 Apr 27 2001 zxJDBC-2.0.1b1.tar.gz",
"-rw-r--r-- 1 root root 190144 Apr 27 2001 zxJDBC-2.0.1b1.zip",
"-rwxr-xr-x 2 500 500 166 Nov 2 2001 73131-testtes1.afp",
"-rw-r--r-- 1 500 500 166 Nov 9 2001 73131-testtes1.AFP",
"-rw-r--r-- 1 500 500 166 Nov 12 2001 73131-testtes2.afp",
"-rw-r--r-- 1 500 500 166 Nov 12 2001 73131-testtes2.AFP",
"-rw-r--r-- 1 500 500 2040000 Aug 5 07:35 testRemoteUPCopyNIX",
"-rw-r--r-- 1 500 500 2040000 Aug 5 07:31 testRemoteUPDCopyNIX",
"-rw-r--r-- 1 500 500 2040000 Aug 5 07:31 testRemoteUPVCopyNIX"
};
/**
* @see junit.framework.TestCase#TestCase(String)
*/
public UnixFTPEntryParserTest(String name)
{
super(name);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getBadListing()
*/
protected String[] getBadListing()
{
return(badsamples);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getGoodListing()
*/
protected String[] getGoodListing()
{
return(goodsamples);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getParser()
*/
protected FTPFileEntryParser getParser()
{
return(new UnixFTPEntryParser());
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnDirectory()
*/
public void testParseFieldsOnDirectory() throws Exception
{
FTPFile f = getParser().parseFTPEntry("drwxr-xr-x 2 user group 4096 Mar 2 15:13 zxbox");
assertNotNull("Could not parse entry.",
f);
assertTrue("Should have been a directory.",
f.isDirectory());
checkPermissions(f);
assertEquals(2,
f.getHardLinkCount());
assertEquals("user",
f.getUser());
assertEquals("group",
f.getGroup());
assertEquals("zxbox",
f.getName());
assertEquals(4096,
f.getSize());
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, Calendar.MARCH);
cal.set(Calendar.DATE,1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
if (f.getTimestamp().getTime().before(cal.getTime())) {
cal.add(Calendar.YEAR, -1);
}
cal.set(Calendar.DATE,2);
cal.set(Calendar.HOUR_OF_DAY, 15);
cal.set(Calendar.MINUTE, 13);
assertEquals(df.format(cal.getTime()),
df.format(f.getTimestamp().getTime()));
}
/**
* Method checkPermissions.
* Verify that the persmissions were properly set.
* @param f
*/
private void checkPermissions(FTPFile f)
{
assertTrue("Should have user read permission.",
f.hasPermission(FTPFile.USER_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("Should have user write permission.",
f.hasPermission(FTPFile.USER_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("Should have user execute permission.",
f.hasPermission(FTPFile.USER_ACCESS,
FTPFile.EXECUTE_PERMISSION));
assertTrue("Should have group read permission.",
f.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("Should NOT have group write permission.",
!f.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("Should have group execute permission.",
f.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.EXECUTE_PERMISSION));
assertTrue("Should have world read permission.",
f.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("Should NOT have world write permission.",
!f.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("Should have world execute permission.",
f.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.EXECUTE_PERMISSION));
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnFile()
*/
public void testParseFieldsOnFile() throws Exception
{
FTPFile f = getParser().parseFTPEntry("-rwxr-xr-x 2 user group 4096 Mar 2 15:13 zxbox");
assertNotNull("Could not parse entry.",
f);
assertTrue("Should have been a file.",
f.isFile());
checkPermissions(f);
assertEquals(2,
f.getHardLinkCount());
assertEquals("user",
f.getUser());
assertEquals("group",
f.getGroup());
assertEquals("zxbox",
f.getName());
assertEquals(4096,
f.getSize());
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, Calendar.MARCH);
cal.set(Calendar.DATE,1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
if (f.getTimestamp().getTime().before(cal.getTime())) {
cal.add(Calendar.YEAR, -1);
}
cal.set(Calendar.DATE,2);
cal.set(Calendar.HOUR_OF_DAY, 15);
cal.set(Calendar.MINUTE, 13);
assertEquals(df.format(cal.getTime()),
df.format(f.getTimestamp().getTime()));
}
/**
* Method suite.
* @return TestSuite
*/
public static TestSuite suite()
{
return(new TestSuite(UnixFTPEntryParserTest.class));
}
}
1.1 jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/VMSFTPEntryParserTest.java
Index: VMSFTPEntryParserTest.java
===================================================================
package org.apache.commons.net.ftp.parser;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Commons" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import junit.framework.TestSuite;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPFileEntryParser;
/**
* @author <a href="mailto:scohen@stevecoh1@attbi.com">Steve Cohen</a>
* @version $Id: VMSFTPEntryParserTest.java,v 1.1 2003/03/02 18:27:41 scohen Exp $
*/
public class VMSFTPEntryParserTest extends FTPParseTestFramework
{
private static final String[] badsamples =
{
"1-JUN.LIS;1 9/9 2-jun-1998 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,RE)",
"1-JUN.LIS;2 9/9 JUN-2-1998 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,)",
"1-JUN.LIS;2 a/9 2-JUN-98 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,)",
"DATA.DIR; 1 1/9 2-JUN-1998 07:32:04 [GROUP,OWNER] (,RWED,RWED,RE)",
"120196.TXT;1 118/126 14-APR-1997 12:45:27 PM [GROUP,OWNER] (RWED,,RWED,RE)",
"30CHARBAR.TXT;1 11/18 2-JUN-1998 08:38:42 [GROUP-1,OWNER] (RWED,RWED,RWED,RE)",
"A.;2 18/18 1-JUL-1998 08:43:20 [GROUP,OWNER] (RWED2,RWED,RWED,RE)",
"AA.;2 152/153 13-FED-1997 08:13:43 [GROUP,OWNER] (RWED,RWED,RWED,RE)"
};
private static final String[] goodsamples =
{
"1-JUN.LIS;1 9/9 2-JUN-1998 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,RE)",
"1-JUN.LIS;2 9/9 2-JUN-1998 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,)",
"1-JUN.LIS;2 9/9 2-JUN-1998 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,)",
"DATA.DIR;1 1/9 2-JUN-1998 07:32:04 [GROUP,OWNER] (,RWED,RWED,RE)",
"120196.TXT;1 118/126 14-APR-1997 12:45:27 [GROUP,OWNER] (RWED,,RWED,RE)",
"30CHARBAR.TXT;1 11/18 2-JUN-1998 08:38:42 [GROUP,OWNER] (RWED,RWED,RWED,RE)",
"A.;2 18/18 1-JUL-1998 08:43:20 [GROUP,OWNER] (RWED,RWED,RWED,RE)",
"AA.;2 152/153 13-FEB-1997 08:13:43 [GROUP,OWNER] (RWED,RWED,RWED,RE)"
};
/**
* @see junit.framework.TestCase#TestCase(String)
*/
public VMSFTPEntryParserTest(String name)
{
super(name);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnDirectory()
*/
public void testParseFieldsOnDirectory() throws Exception
{
FTPFile dir = getParser().parseFTPEntry("DATA.DIR;1 1/9 2-JUN-1998 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,RE)");
assertTrue("Should be a directory.",
dir.isDirectory());
assertEquals("DATA.DIR",
dir.getName());
assertEquals(512,
dir.getSize());
assertEquals("Tue Jun 02 07:32:04 1998",
df.format(dir.getTimestamp().getTime()));
assertEquals("GROUP",
dir.getGroup());
assertEquals("OWNER",
dir.getUser());
checkPermisions(dir);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnFile()
*/
public void testParseFieldsOnFile() throws Exception
{
FTPFile file = getParser().parseFTPEntry("1-JUN.LIS;1 9/9 2-JUN-1998 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,RE)");
assertTrue("Should be a file.",
file.isFile());
assertEquals("1-JUN.LIS",
file.getName());
assertEquals(9 * 512,
file.getSize());
assertEquals("Tue Jun 02 07:32:04 1998",
df.format(file.getTimestamp().getTime()));
assertEquals("GROUP",
file.getGroup());
assertEquals("OWNER",
file.getUser());
checkPermisions(file);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getBadListing()
*/
protected String[] getBadListing()
{
return (badsamples);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getGoodListing()
*/
protected String[] getGoodListing()
{
return (goodsamples);
}
/**
* @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getParser()
*/
protected FTPFileEntryParser getParser()
{
return (new VMSFTPEntryParser());
}
/**
* Method checkPermisions.
* Verify that the VMS parser does NOT set the permissions.
* @param dir
*/
private void checkPermisions(FTPFile dir)
{
assertTrue("Owner should not have read permission.",
!dir.hasPermission(FTPFile.USER_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("Owner should not have write permission.",
!dir.hasPermission(FTPFile.USER_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("Owner should not have execute permission.",
!dir.hasPermission(FTPFile.USER_ACCESS,
FTPFile.EXECUTE_PERMISSION));
assertTrue("Group should not have read permission.",
!dir.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("Group should not have write permission.",
!dir.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("Group should not have execute permission.",
!dir.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.EXECUTE_PERMISSION));
assertTrue("World should not have read permission.",
!dir.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("World should not have write permission.",
!dir.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("World should not have execute permission.",
!dir.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.EXECUTE_PERMISSION));
}
/**
* Method suite.
* @return TestSuite
*/
public static TestSuite suite()
{
return(new TestSuite(VMSFTPEntryParserTest.class));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org