129130131132133134135136137138139
fs.create(Integer.MAX_VALUE); fs.close(); //Open the File System fs = new FileSystem(Constants.ROOT_PATH); fs.open(); fs.drop(Integer.MAX_VALUE); assertTrue(new File(Constants.ROOT_PATH + org.jcoredb.system.Constants.PATH_SEP + 0).exists()); assertFalse(new File(Constants.ROOT_PATH + org.jcoredb.system.Constants.PATH_SEP + Integer.MAX_VALUE).exists()); }
143144145146147148149150151152153
{ IFileSystem fs = new FileSystem(Constants.ROOT_PATH); fs.create(0); fs = new FileSystem(Constants.ROOT_PATH); fs.open(); FileSystemConfig cfg = Configs.getFSConfig(); ISegment[] segments = fs.getContainer(0).getSegments();
159160161162163164165166167168169
@Test public void readTest() throws Exception { IFileSystem fs = new FileSystem(Constants.ROOT_PATH); fs.create(0); fs.open(); ArrayList<Block> blocks = new ArrayList<Block>(); ArrayList<BlockId> blockIds = new ArrayList<BlockId>(); String testStr = "<test> <content> Hello world! </content> </test>";
193194195196197198199200201202203
public void writeTest() throws Exception { IFileSystem fs = new FileSystem(Constants.ROOT_PATH); fs.create(0); fs.open(); ArrayList<Block> blocks = new ArrayList<Block>(); ArrayList<BlockId> blockIds = new ArrayList<BlockId>(); String testStr = "<test> <content> Hello world! </content> </test>";
2223242526272829303132
@Test public void appendSingleThreadedTest() throws Exception { IFileSystem fs = new FileSystem(Constants.ROOT_PATH); fs.create(0); fs.open(); Block[] blocks = new Block[NUM_OF_BLOCKS_TO_APPEND]; String testStr = "<test> <content> Hello world! </content> </test>"; byte[] content = testStr.getBytes();
335336337338339340341342343344345
* @throws Exception */ public static void main(String[] args) throws Exception { FileSystem fs = new FileSystem(Configs.getFSConfig().getRootDir()); fs.open(); FileSystemRegistry.register(Constants.HOST,fs); HTTPServer srv = new HTTPServer(); srv.start(); }
1415161718192021222324
@Test public void startHTTPServerTest() throws Exception { FileSystem fs = new FileSystem("C:\\data\\jcoredb"); fs.open(); FileSystemRegistry.register(Constants.HOST, fs); HTTPServer.main(new String[0]); System.out.println("Press any key!");
4748495051525354555657
@Test public void appendTest() throws Exception { IFileSystem fs = new FileSystem(Constants.ROOT_PATH); fs.create(0); fs.open(); Block b = new Block(new BlockId(0)); byte[] content = "<test> <content> Hello world! </content> </test>".getBytes(); b.setBytes(content);
8990919293949596979899
@Test public void deleteTest() throws Exception { IFileSystem fs = new FileSystem(Constants.ROOT_PATH); fs.create(0); fs.open(); ArrayList<Block> blocks = new ArrayList<Block>(); ArrayList<BlockId> blockIds = new ArrayList<BlockId>(); for (int i = 0; i < 200; i++) {