Skip to content

Commit

Permalink
release v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fudax committed Feb 17, 2020
1 parent 6a67d67 commit 25e96db
Show file tree
Hide file tree
Showing 12 changed files with 208 additions and 234 deletions.
22 changes: 21 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@
<version>4.5.8</version><!--$NO-MVN-MAN-VER$-->
<type>jar</type>
</dependency>
<dependency>
<groupId>org.gitlab</groupId>
<artifactId>java-gitlab-api</artifactId>
<version>4.1.1</version>
</dependency>

<dependency>
<groupId>commons-beanutils</groupId>
Expand Down Expand Up @@ -180,7 +185,7 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
<version>1.3.2</version>
<type>jar</type>
</dependency>

Expand Down Expand Up @@ -290,6 +295,21 @@
<artifactId>java-jwt</artifactId>
<version>3.8.3</version>
</dependency>



<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api-impl</artifactId>
<version>8.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-ws-client</artifactId>
<version>5.1</version>
</dependency>


</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.pr.sepp.common;

import com.pr.sepp.SeppApplication;
import com.pr.sepp.notify.alert.AlertMonitorHelper;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
Expand All @@ -18,8 +17,6 @@ public abstract class BaseServiceIntegrationTest {

@MockBean
private JavaMailSender javaMailSender;
@MockBean
private AlertMonitorHelper alertMonitorHelper;

@BeforeClass
public static void beforeClass() {
Expand Down
5 changes: 4 additions & 1 deletion src/test/java/com/pr/sepp/common/HtmlCreateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

import java.io.IOException;

import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertTrue;

public class HtmlCreateTest {


Expand Down Expand Up @@ -46,6 +49,6 @@ public void test() throws IOException {
HtmlCanvas htmlCanvas = html.table(attributes.add("class", "hovertable"))._table();

htmlCanvas.style()._style();
System.out.println(htmlCanvas.toHtml());
assertNotNull(htmlCanvas.toHtml());
}
}
34 changes: 34 additions & 0 deletions src/test/java/com/pr/sepp/common/addin/FatherTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.pr.sepp.common.addin;

public class FatherTest {
private String name;

public FatherTest() {
System.out.println("--父类的无参构造函数--");
}

public FatherTest(String name) {
this.name = name;
System.out.println("--父类的有参构造函数--" + this.name);
}

static {
System.out.println("--父类的静态代码块--");
}
{
System.out.println("--父类的非静态代码块--");
}

public void speak() {
System.out.println("--父类的方法--");
}

// 加入一个main程序后
public static void main(String[] args) {
System.out.println("--父类主程序--");
FatherTest father1 = new FatherTest();
FatherTest father = new FatherTest("父亲的名字");
father1.speak();
father.speak();
}
}
12 changes: 8 additions & 4 deletions src/test/java/com/pr/sepp/common/addin/MathTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

import org.junit.Test;

import static org.junit.Assert.assertTrue;

public class MathTest {
@Test
@Test
public void transfer(){
float a = 1.1f;
float b = 1.8f;

public void testMath() {
System.out.println(Math.pow(64, new Float((double) 1 / 3)));
}
assertTrue((int) a == (int) b);
}
}
34 changes: 34 additions & 0 deletions src/test/java/com/pr/sepp/common/addin/SonTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.pr.sepp.common.addin;

public class SonTest extends FatherTest {
private String name;
static {
System.out.println("--子类的静态代码块--");
}
{
System.out.println("--子类的非静态代码块--");
}

SonTest() {
System.out.println("--子类的无参构造函数--");
}

SonTest(String name) {
this.name = name;
System.out.println("--子类的有参构造函数--" + this.name);
}

@Override
public void speak() {
System.out.println("--子类Override了父类的方法--");
}

// 然后再加入一个main函数
public static void main(String[] args) {
System.out.println("--子类主程序--");
FatherTest father = new FatherTest("父亲的名字");
father.speak();
SonTest son = new SonTest("儿子的名字");
son.speak();
}
}
86 changes: 43 additions & 43 deletions src/test/java/com/pr/sepp/common/notify/MessageServerTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.pr.sepp.common.notify;

import com.pr.sepp.notify.fetch.FetchClient;
import com.pr.sepp.common.websocket.push.MessageServer;
import com.pr.sepp.notify.model.resp.GlobalDataResp;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pr.sepp.common.websocket.push.MessageServer;
import com.pr.sepp.notify.fetch.FetchClient;
import com.pr.sepp.notify.model.GlobalDataResp;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
Expand All @@ -26,51 +26,51 @@
@RunWith(MockitoJUnitRunner.Silent.class)
public class MessageServerTest {

@InjectMocks
private MessageServer messageServer;
@Mock
private FetchClient fetchClient;
@Mock
private WebSocketSession session;
private Map<String,Object> map;
@InjectMocks
private MessageServer messageServer;
@Mock
private FetchClient fetchClient;
@Mock
private WebSocketSession session;
private Map<String, Object> map;

@Before
public void setUp() throws Exception {
map = Maps.newHashMap();
map.put(MESSAGE_PAGE_NUM, 1);
map.put(MESSAGE_PAGE_SIZE, 10);
map.put(PRODUCT_ID, "9");
when(fetchClient.notifyMessage(session, ALARM)).thenReturn(new PageInfo());
when(fetchClient.notifyMessage(session, NOTICE)).thenReturn(new PageInfo());
}
@Before
public void setUp() throws Exception {
map = Maps.newHashMap();
map.put(MESSAGE_PAGE_NUM, 1);
map.put(MESSAGE_PAGE_SIZE, 10);
map.put(PRODUCT_ID, "9");
when(fetchClient.notifyMessage(session, WARNING)).thenReturn(new PageInfo());
when(fetchClient.notifyMessage(session, MESSAGE)).thenReturn(new PageInfo());
}

@Test
public void responseBuilderAlarmAndNoticeTest() {
map.put(MESSAGE_TYPE, Lists.newArrayList(ALARM, NOTICE));
when(session.getAttributes()).thenReturn(map);
GlobalDataResp globalDataResp = messageServer.responseBuilder(session);
verify(session, times(2)).getAttributes();
assertNotNull(globalDataResp);
}
@Test
public void responseBuilderWARNINGAndMESSAGETest() {
map.put(MESSAGE_TYPE, Lists.newArrayList(WARNING, MESSAGE));
when(session.getAttributes()).thenReturn(map);
GlobalDataResp globalDataResp = messageServer.responseBuilder(session);
verify(session, times(2)).getAttributes();
assertNotNull(globalDataResp);
}

@Test
public void responseBuilderAlarm() {
map.put(MESSAGE_TYPE, Lists.newArrayList(ALARM));
@Test
public void responseBuilderWARNING() {
map.put(MESSAGE_TYPE, Lists.newArrayList(WARNING));

when(session.getAttributes()).thenReturn(map);
GlobalDataResp globalDataResp = messageServer.responseBuilder(session);
verify(session, times(2)).getAttributes();
assertNotNull(globalDataResp);
}
when(session.getAttributes()).thenReturn(map);
GlobalDataResp globalDataResp = messageServer.responseBuilder(session);
verify(session, times(2)).getAttributes();
assertNotNull(globalDataResp);
}

@Test
public void responseBuilderNotice() {
map.put(MESSAGE_TYPE, Lists.newArrayList(NOTICE));
@Test
public void responseBuilderMESSAGE() {
map.put(MESSAGE_TYPE, Lists.newArrayList(MESSAGE));

when(session.getAttributes()).thenReturn(map);
GlobalDataResp globalDataResp = messageServer.responseBuilder(session);
verify(session, times(2)).getAttributes();
assertNotNull(globalDataResp);
}
when(session.getAttributes()).thenReturn(map);
GlobalDataResp globalDataResp = messageServer.responseBuilder(session);
verify(session, times(2)).getAttributes();
assertNotNull(globalDataResp);
}

}
27 changes: 0 additions & 27 deletions src/test/java/com/pr/sepp/common/service/AlertServiceTest.java

This file was deleted.

24 changes: 24 additions & 0 deletions src/test/java/com/pr/sepp/common/service/WarningServiceTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.pr.sepp.common.service;

import com.pr.sepp.common.BaseServiceIntegrationTest;
import com.pr.sepp.notify.warning.service.WarningService;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.jdbc.Sql;

import static org.junit.Assert.assertNull;

public class WarningServiceTest extends BaseServiceIntegrationTest {

@Autowired
private WarningService warningService;

@Test
@Ignore
@Sql(scripts = "/sql/init-warning.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
public void testWarningListPaging() {
assertNull("warningPageInfo");
}

}
58 changes: 29 additions & 29 deletions src/test/java/com/pr/sepp/common/websocket/WebsocketTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,36 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import static junit.framework.TestCase.assertTrue;

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class WebsocketTest extends BaseIntegrationTest {
final CountDownLatch latch = new CountDownLatch(1);
@LocalServerPort
private int port;
private SockJsClient sockJsClient;

@Autowired
private MessageWebSocketHandler messageWebSocketHandler;


@Before
public void setup() {
List<Transport> transports = new ArrayList<>();
transports.add(new WebSocketTransport(new StandardWebSocketClient()));
transports.add(new RestTemplateXhrTransport());
this.sockJsClient = new SockJsClient(transports);
}


@Test
@Ignore
public void getGreeting() throws Exception {
this.sockJsClient.doHandshake(messageWebSocketHandler,
"ws://localhost:" + port + "/sepp/myHandler");
if (latch.await(60, TimeUnit.SECONDS)) {
} else {
}

}

final CountDownLatch latch = new CountDownLatch(1);
@LocalServerPort
private int port;
private SockJsClient sockJsClient;

@Autowired
private MessageWebSocketHandler messageWebSocketHandler;


@Before
public void setup() {
List<Transport> transports = new ArrayList<>();
transports.add(new WebSocketTransport(new StandardWebSocketClient()));
transports.add(new RestTemplateXhrTransport());
this.sockJsClient = new SockJsClient(transports);
}

@Test
@Ignore
public void getGreeting() throws Exception {
this.sockJsClient.doHandshake(messageWebSocketHandler,
"ws://localhost:" + port + "/sepp/myHandler");
assertTrue(true);
if (latch.await(60, TimeUnit.SECONDS)) {
} else {
}
}
}
Loading

0 comments on commit 25e96db

Please sign in to comment.