Skip to content

Commit

Permalink
fix 修复升级版本后单元测试相关的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearXs committed Oct 21, 2023
1 parent 68e5148 commit 52f0a3e
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 530 deletions.
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>
</dependencies>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.springframework.core.io.buffer.NettyDataBufferFactory;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
Expand Down Expand Up @@ -46,7 +47,7 @@ void tryToGet() throws InterruptedException {
String url = "http://localhost:8081/http/get?unknown=123";
WebClient.RequestBodySpec spec = WebClient.create(url).method(HttpMethod.GET).contentType(MediaType.APPLICATION_JSON);
StepVerifier.create(spec.exchange().flatMap(res -> {
HttpStatus httpStatus = res.statusCode();
HttpStatusCode httpStatus = res.statusCode();
if (httpStatus.value() != HttpStatus.OK.value()) {
return Mono.error(new UnknownError());
}
Expand Down Expand Up @@ -84,9 +85,9 @@ void tryToPost() {
spec
.exchange()
.flatMap(res -> {
HttpStatus httpStatus = res.statusCode();
HttpStatusCode httpStatus = res.statusCode();
if (httpStatus.value() != HttpStatus.OK.value()) {
return Mono.error(new UnknownError(httpStatus.name()));
return Mono.error(new UnknownError());
}
return res.bodyToMono(ByteBuffer.class)
.map(Unpooled::wrappedBuffer).defaultIfEmpty(Unpooled.EMPTY_BUFFER)
Expand Down Expand Up @@ -116,9 +117,9 @@ void testAuthHeader() {
StepVerifier.create(
spec.exchange()
.flatMap(res -> {
HttpStatus status = res.statusCode();
HttpStatusCode status = res.statusCode();
if (status.value() != HttpStatus.OK.value()) {
return Mono.error(new UnknownError(status.name()));
return Mono.error(new UnknownError());
}
return res
.bodyToMono(ByteBuffer.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package cc.allio.uno.core.chain;

import jakarta.annotation.Priority;
import reactor.core.publisher.Mono;

import javax.annotation.Priority;

@Priority(1)
public class TestNode1 implements Node<String, String> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package cc.allio.uno.core.chain;

import jakarta.annotation.Priority;
import reactor.core.publisher.Mono;

import javax.annotation.Priority;

@Priority(2)
public class TestNode2 implements Node<String, String> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import cc.allio.uno.core.BaseTestCase;
import com.google.common.collect.Maps;
import jakarta.annotation.Priority;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

import javax.annotation.Priority;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package cc.allio.uno.core.util.template;

import cc.allio.uno.core.BaseTestCase;
import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;
import com.ql.util.express.IExpressContext;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

import javax.annotation.processing.FilerException;
import java.io.FileNotFoundException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -74,18 +70,6 @@ void testTemplateMap() {
});
}

@Test
void testQLExpress() {
assertDoesNotThrow(() -> {
String template = this.template.parseFileTemplate("cc/allio/uno/core/util/template/example.template", user);
ExpressRunner runner = new ExpressRunner(false, false);
IExpressContext<String, Object> expressContext = new DefaultContext<>();
expressContext.put("user", user);
runner.execute(template, expressContext, Collections.emptyList(), false, false);
log.info("user: {}", user);
});
}

@Override
protected void onDown() throws Throwable {

Expand Down
5 changes: 0 additions & 5 deletions uno-data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</dependency>
<!-- jpa 规范标准-->
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
Expand Down
8 changes: 0 additions & 8 deletions uno-data/src/test/java/cc/allio/uno/data/excel/CellDeal.java

This file was deleted.

This file was deleted.

This file was deleted.

128 changes: 0 additions & 128 deletions uno-data/src/test/java/cc/allio/uno/data/excel/ConCellDeal.java

This file was deleted.

6 changes: 4 additions & 2 deletions uno-data/src/test/java/cc/allio/uno/data/model/Car.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package cc.allio.uno.data.model;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import lombok.*;

import javax.persistence.*;

@Getter
@Setter
@ToString
Expand Down
8 changes: 4 additions & 4 deletions uno-data/src/test/java/cc/allio/uno/data/model/Dept.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package cc.allio.uno.data.model;

import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.List;

@Getter
Expand Down
3 changes: 1 addition & 2 deletions uno-data/src/test/java/cc/allio/uno/data/model/Role.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package cc.allio.uno.data.model;

import jakarta.persistence.*;
import lombok.*;
import org.springframework.data.domain.Persistable;

import javax.persistence.*;

@Getter
@Setter
@ToString
Expand Down
4 changes: 2 additions & 2 deletions uno-data/src/test/java/cc/allio/uno/data/model/User.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package cc.allio.uno.data.model;

import cc.allio.uno.data.orm.jpa.model.BaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import lombok.*;

import javax.persistence.*;

@Getter
@Setter
@ToString
Expand Down
Loading

0 comments on commit 52f0a3e

Please sign in to comment.