blob: 042dcc63c01510384ecb5e24ca8a64febe1909c2 [file] [log] [blame]
// 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.doris.persist;
import org.junit.Test;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class EditLogTest {
private String meta = "editLogTestDir/";
public void mkdir() {
File dir = new File(meta);
if (!dir.exists()) {
dir.mkdir();
} else {
File[] files = dir.listFiles();
for (File file : files) {
if (file.isFile()) {
file.delete();
}
}
}
}
public void addFiles(int image, int edit) {
File imageFile = new File(meta + "image." + image);
try {
imageFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
for (int i = 1; i <= edit; i++) {
File editFile = new File(meta + "edits." + i);
try {
editFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
File current = new File(meta + "edits");
try {
current.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
File version = new File(meta + "VERSION");
try {
version.createNewFile();
String line1 = "#Mon Feb 02 13:59:54 CST 2015\n";
String line2 = "clusterId=966271669";
FileWriter fw = new FileWriter(version);
fw.write(line1);
fw.write(line2);
fw.flush();
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public void deleteDir() {
File dir = new File(meta);
if (dir.exists()) {
File[] files = dir.listFiles();
for (File file : files) {
if (file.isFile()) {
file.delete();
}
}
dir.delete();
}
}
@Test
public void testWriteLog() throws IOException {
}
@Test
public void test() {
}
}