none: add some test case, but ignored

pull/499/head
johnniang 2019-12-26 15:11:53 +08:00
parent 11c32ffdca
commit dc166d0b4a
4 changed files with 30 additions and 8 deletions

View File

@ -14,10 +14,10 @@ spring:
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
# H2 Database 配置 # H2 Database 配置
driver-class-name: org.h2.Driver # driver-class-name: org.h2.Driver
url: jdbc:h2:file:~/halo-test/db/halo # url: jdbc:h2:file:~/halo-test/db/halo
username: admin # username: admin
password: 123456 # password: 123456
# MySQL 配置 # MySQL 配置
# driver-class-name: com.mysql.cj.jdbc.Driver # driver-class-name: com.mysql.cj.jdbc.Driver
@ -33,10 +33,12 @@ spring:
enabled: true enabled: true
jpa: jpa:
hibernate: hibernate:
ddl-auto: update ddl-auto: create-drop
show-sql: true show-sql: true
flyway: flyway:
enabled: false locations: classpath:/migration
baseline-on-migrate: true
baseline-version: 1
servlet: servlet:
multipart: multipart:
max-file-size: 10MB max-file-size: 10MB
@ -48,7 +50,7 @@ management:
web: web:
base-path: /api/admin/actuator base-path: /api/admin/actuator
exposure: exposure:
include: ['httptrace', 'metrics','env','logfile','health'] include: ['httptrace', 'metrics','env','logfile']
logging: logging:
level: level:
run.halo.app: DEBUG run.halo.app: DEBUG

View File

@ -5,6 +5,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.ConversionService;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
@ -17,6 +18,7 @@ import static org.junit.Assert.assertThat;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@ActiveProfiles("test")
public class AttachmentTypeTest { public class AttachmentTypeTest {
@Autowired @Autowired

View File

@ -2,11 +2,12 @@ package run.halo.app.utils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import run.halo.app.model.support.HaloConst; import run.halo.app.model.support.HaloConst;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
@ -92,4 +93,19 @@ public class FileUtilsTest {
public void tempFolderTest() { public void tempFolderTest() {
log.debug(HaloConst.TEMP_DIR); log.debug(HaloConst.TEMP_DIR);
} }
@Test
@Ignore
public void dbFileReadTest() throws IOException {
Path dbPath = Paths.get(HaloConst.USER_HOME + "/halo-test/db/halo.mv.db");
try (RandomAccessFile randomAccessFile = new RandomAccessFile(dbPath.toString(), "r")) {
randomAccessFile.seek(2283640);
byte[] buffer = new byte[1024];
int count = randomAccessFile.read(buffer, 0, buffer.length);
System.out.println("Count: " + count);
String bufString = new String(buffer);
System.out.println("Buffer String: " + bufString);
}
}
} }

View File

@ -1,5 +1,6 @@
package run.halo.app.utils; package run.halo.app.utils;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.nio.file.Path; import java.nio.file.Path;
@ -18,6 +19,7 @@ import static org.junit.Assert.assertTrue;
public class PathsTest { public class PathsTest {
@Test @Test
@Ignore
public void getTest() { public void getTest() {
Path path = Paths.get("/home/test/", "/upload/test.txt"); Path path = Paths.get("/home/test/", "/upload/test.txt");
assertThat(path.toString(), equalTo("/home/test/upload/test.txt")); assertThat(path.toString(), equalTo("/home/test/upload/test.txt"));