mirror of https://github.com/longtai-cn/hippo4j
commit
12b2397a68
@ -0,0 +1,56 @@
|
||||
<img align="center" width="400" alt="image" src="https://user-images.githubusercontent.com/77398366/181906454-b46f6a14-7c2c-4b8f-8b0a-40432521bed8.png">
|
||||
|
||||
# Dynamic and observable thread pool framework
|
||||
|
||||
[](https://gitee.com/itmachen/hippo4j) [](https://github.com/opengoofy/hippo4j) [](https://store.docker.com/community/images/hippo4j/hippo4j-server) [](https://github.com/opengoofy/hippo4j/graphs/contributors) [](https://github.com/opengoofy/hippo4j/blob/develop/LICENSE)
|
||||
|
||||
-------
|
||||
|
||||
## Thread pool pain points
|
||||
|
||||
A thread pool is a tool for managing threads based on the idea of pooling.
|
||||
|
||||
Using a thread pool reduces the overhead of creating and destroying threads and avoids running out of system resources due to too many threads.
|
||||
|
||||
The use of thread pools is essential in highly concurrent and high-volume task processing scenarios.
|
||||
|
||||
If you have actually used thread pools in your projects, I believe you may have encountered the following pain points:
|
||||
|
||||
- Thread pools are defined randomly, with too many thread resources, causing high server load.
|
||||
|
||||
- The thread pool parameters are not easily evaluated and the business is at risk of failure.
|
||||
- Thread pool task execution time exceeds the average execution cycle and developers are not informed.
|
||||
- Thread pool tasks pile up and affect business operations.
|
||||
- Wireless process pool monitoring when the service has timeouts, meltdowns, and other problems.
|
||||
- Thread pools do not support the passing of runtime variables, such as MDC contexts.
|
||||
- When a project is closed, a large number of running thread pool tasks are discarded.
|
||||
- Thread pool running, task execution stopped, don't know the problem.
|
||||
|
||||
## What is Hippo-4J
|
||||
|
||||
Hippo-4J through the JDK thread pool enhancements, as well as extending the three-party framework underlying thread pools and other features for business systems to improve online operational security capabilities.
|
||||
|
||||
The following functional support is provided:
|
||||
|
||||
- Global Control - Managing Application Thread Pool Instances.
|
||||
|
||||
- Dynamic changes - dynamically changing thread pool parameters at application runtime.
|
||||
- Notify alarms - Four built-in alarm notification policies.
|
||||
- Run Monitoring - Real-time view of thread pool runtime data.
|
||||
- Feature extensions - support for thread pooling task passing contexts, etc.
|
||||
- Multiple Modes - Two built-in usage modes: Configuration Center Mode and No Middleware Mode.
|
||||
- Container Management - Tomcat, Jetty, Undertow container thread pool runtime view and thread count changes.
|
||||
- Framework adaptation - Dubbo, Hystrix, Polaris, RabbitMQ, RocketMQ and other consumer thread pool runtime data view and thread count changes.
|
||||
|
||||
## Quick Start
|
||||
|
||||
For local presentation purposes, see [Quick start](https://hippo4j.cn/docs/user_docs/user_guide/quick-start).
|
||||
|
||||
Demo Environment: [http://console.hippo4j.cn/index.html](http://console.hippo4j.cn/index.html).
|
||||
|
||||
## Who is using
|
||||
|
||||
More companies with access are welcome to register at [registration address](https://github.com/opengoofy/hippo4j/issues/13), registration is only for product promotion.
|
||||
|
||||
## Contributors
|
||||
Thanks to all the developers who contributed to the project. If interested in contributing, refer to [good first issue](https://github.com/opengoofy/hippo4j/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
.editor-container[data-v-7505e034]{height:82vh;overflow:auto}
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 35 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2fd02e04"],{"64b7":function(e,t,n){"use strict";n("de5f")},ab3b:function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"app-container"},[n("split-pane",{attrs:{split:"vertical"},on:{resize:e.resize}},[n("template",{slot:"paneL"},[n("el-input",{attrs:{type:"textarea",rows:36,placeholder:"请输入内容",clearable:""},on:{change:e.originChange},model:{value:e.originText,callback:function(t){e.originText=t},expression:"originText"}})],1),e._v(" "),n("template",{slot:"paneR"},[n("div",{staticClass:"editor-container"},[n("JSONEditor",{attrs:{json:e.formatedValue}})],1)])],2)],1)},i=[],o=n("19ab"),r=n.n(o),s=n("33c3"),c={name:"JsonFormat",components:{splitPane:r.a,JSONEditor:s["a"]},data:function(){return{originText:"",formatedValue:""}},watch:{originText:function(e){try{this.formatedValue=JSON.parse(e)}catch(t){}}},methods:{resize:function(){},originChange:function(e){}}},l=c,u=(n("64b7"),n("2877")),p=Object(u["a"])(l,a,i,!1,null,"7505e034",null);t["default"]=p.exports},de5f:function(e,t,n){}}]);
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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 cn.hippo4j.monitor.base;
|
||||
|
||||
import cn.hippo4j.adapter.base.ThreadPoolAdapter;
|
||||
import cn.hippo4j.adapter.base.ThreadPoolAdapterState;
|
||||
import cn.hippo4j.common.config.ApplicationContextHolder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Abstract adapter thread-pool monitor.
|
||||
*/
|
||||
public abstract class AbstractAdapterThreadPoolMonitor implements AdapterThreadPoolMonitor {
|
||||
|
||||
/**
|
||||
* Execute collection thread pool running data.
|
||||
*
|
||||
* @param threadPoolAdapterState thread-pool adapter state
|
||||
*/
|
||||
protected abstract void execute(ThreadPoolAdapterState threadPoolAdapterState);
|
||||
|
||||
@Override
|
||||
public void collect() {
|
||||
Map<String, ThreadPoolAdapter> threadPoolAdapterMap = ApplicationContextHolder.getBeansOfType(ThreadPoolAdapter.class);
|
||||
threadPoolAdapterMap.forEach((beanName, bean) -> bean.getThreadPoolStates().forEach(each -> execute(each)));
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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 cn.hippo4j.monitor.base;
|
||||
|
||||
import cn.hippo4j.adapter.web.WebThreadPoolService;
|
||||
import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Abstract web thread-pool monitor.
|
||||
*/
|
||||
public abstract class AbstractWebThreadPoolMonitor implements WebThreadPoolMonitor {
|
||||
|
||||
@Resource
|
||||
private WebThreadPoolService webThreadPoolService;
|
||||
|
||||
/**
|
||||
* Execute collection thread pool running data.
|
||||
*
|
||||
* @param webThreadPoolRunStateInfo web thread-pool run state info
|
||||
*/
|
||||
protected abstract void execute(ThreadPoolRunStateInfo webThreadPoolRunStateInfo);
|
||||
|
||||
@Override
|
||||
public void collect() {
|
||||
ThreadPoolRunStateInfo webThreadPoolRunStateInfo = webThreadPoolService.getWebRunStateInfo();
|
||||
execute(webThreadPoolRunStateInfo);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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 cn.hippo4j.monitor.base;
|
||||
|
||||
/**
|
||||
* Adapter thread-pool monitor.
|
||||
*/
|
||||
public interface AdapterThreadPoolMonitor extends ThreadPoolMonitor {
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 cn.hippo4j.monitor.base;
|
||||
|
||||
/**
|
||||
* Monitor thread-pool type enum.
|
||||
*/
|
||||
public enum MonitorThreadPoolTypeEnum {
|
||||
|
||||
/**
|
||||
* Dynamic thread-pool
|
||||
*/
|
||||
DYNAMIC,
|
||||
|
||||
/**
|
||||
* Web thread-pool
|
||||
*/
|
||||
WEB,
|
||||
|
||||
/**
|
||||
* Adapter thread-pool
|
||||
*/
|
||||
ADAPTER
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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 cn.hippo4j.monitor.elasticsearch;
|
||||
|
||||
import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
|
||||
import cn.hippo4j.monitor.base.AbstractDynamicThreadPoolMonitor;
|
||||
import cn.hippo4j.monitor.base.MonitorTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Adapter thread-pool elastic-search monitor handler.
|
||||
*/
|
||||
@Slf4j
|
||||
public class AdapterThreadPoolElasticSearchMonitorHandler extends AbstractDynamicThreadPoolMonitor {
|
||||
|
||||
@Override
|
||||
protected void execute(ThreadPoolRunStateInfo poolRunStateInfo) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return MonitorTypeEnum.ELASTICSEARCH.name().toLowerCase();
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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 cn.hippo4j.monitor.elasticsearch;
|
||||
|
||||
import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
|
||||
import cn.hippo4j.monitor.base.AbstractDynamicThreadPoolMonitor;
|
||||
import cn.hippo4j.monitor.base.MonitorTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Web thread-pool elastic-search monitor handler.
|
||||
*/
|
||||
@Slf4j
|
||||
public class WebThreadPoolElasticSearchMonitorHandler extends AbstractDynamicThreadPoolMonitor {
|
||||
|
||||
@Override
|
||||
protected void execute(ThreadPoolRunStateInfo poolRunStateInfo) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return MonitorTypeEnum.ELASTICSEARCH.name().toLowerCase();
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 cn.hippo4j.monitor.local.log;
|
||||
|
||||
import cn.hippo4j.adapter.base.ThreadPoolAdapterState;
|
||||
import cn.hippo4j.common.toolkit.JSONUtil;
|
||||
import cn.hippo4j.monitor.base.AbstractAdapterThreadPoolMonitor;
|
||||
import cn.hippo4j.monitor.base.MonitorTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Adapter thread-pool local log monitor handler.
|
||||
*/
|
||||
@Slf4j
|
||||
public class AdapterThreadPoolLocalLogMonitorHandler extends AbstractAdapterThreadPoolMonitor {
|
||||
|
||||
@Override
|
||||
protected void execute(ThreadPoolAdapterState threadPoolAdapterState) {
|
||||
log.info("{}", JSONUtil.toJSONString(threadPoolAdapterState));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return MonitorTypeEnum.LOG.name().toLowerCase();
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 cn.hippo4j.monitor.local.log;
|
||||
|
||||
import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
|
||||
import cn.hippo4j.common.toolkit.JSONUtil;
|
||||
import cn.hippo4j.monitor.base.AbstractWebThreadPoolMonitor;
|
||||
import cn.hippo4j.monitor.base.MonitorTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Web thread-pool local log monitor handler.
|
||||
*/
|
||||
@Slf4j
|
||||
public class WebThreadPoolLocalLogMonitorHandler extends AbstractWebThreadPoolMonitor {
|
||||
|
||||
@Override
|
||||
protected void execute(ThreadPoolRunStateInfo poolRunStateInfo) {
|
||||
log.info("{}", JSONUtil.toJSONString(poolRunStateInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return MonitorTypeEnum.LOG.name().toLowerCase();
|
||||
}
|
||||
}
|
25
hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-local-log/src/main/java/cn/hippo4j/springboot/starter/monitor/local/log/LocalLogMonitorConfiguration.java → hippo4j-monitor/hippo4j-monitor-micrometer/src/main/java/cn/hippo4j/monitor/micrometer/AdapterThreadPoolMicrometerMonitorHandler.java
25
hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-local-log/src/main/java/cn/hippo4j/springboot/starter/monitor/local/log/LocalLogMonitorConfiguration.java → hippo4j-monitor/hippo4j-monitor-micrometer/src/main/java/cn/hippo4j/monitor/micrometer/AdapterThreadPoolMicrometerMonitorHandler.java
25
hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-elasticsearch/src/main/java/cn/hippo4j/springboot/starter/monitor/es/EsMonitorAutoConfiguration.java → hippo4j-monitor/hippo4j-monitor-micrometer/src/main/java/cn/hippo4j/monitor/micrometer/WebThreadPoolMicrometerMonitorHandler.java
25
hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-elasticsearch/src/main/java/cn/hippo4j/springboot/starter/monitor/es/EsMonitorAutoConfiguration.java → hippo4j-monitor/hippo4j-monitor-micrometer/src/main/java/cn/hippo4j/monitor/micrometer/WebThreadPoolMicrometerMonitorHandler.java
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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 cn.hippo4j.auth.secuity;
|
||||
|
||||
import cn.hippo4j.auth.security.JwtTokenManager;
|
||||
import cn.hippo4j.common.toolkit.Assert;
|
||||
import cn.hippo4j.common.toolkit.CollectionUtil;
|
||||
import cn.hippo4j.common.toolkit.StringUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public final class JwtTokenManagerTest {
|
||||
|
||||
private static final String USERNAME = "test";
|
||||
|
||||
@Test
|
||||
public void createTokenTest() {
|
||||
JwtTokenManager jwtTokenManager = new JwtTokenManager();
|
||||
String token = jwtTokenManager.createToken(USERNAME);
|
||||
Assert.isTrue(StringUtil.isNotBlank(token));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateTokenTest() {
|
||||
JwtTokenManager jwtTokenManager = new JwtTokenManager();
|
||||
String token = jwtTokenManager.createToken(USERNAME);
|
||||
jwtTokenManager.validateToken(token);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAuthenticationTest() {
|
||||
JwtTokenManager jwtTokenManager = new JwtTokenManager();
|
||||
String token = jwtTokenManager.createToken(USERNAME);
|
||||
Authentication authentication = jwtTokenManager.getAuthentication(token);
|
||||
Assert.isTrue(authentication.isAuthenticated());
|
||||
Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
|
||||
Assert.isTrue(CollectionUtil.isEmpty(authorities));
|
||||
Object credentials = authentication.getCredentials();
|
||||
Assert.isTrue(ObjectUtils.isEmpty(credentials));
|
||||
Object details = authentication.getDetails();
|
||||
Assert.isTrue(ObjectUtils.isEmpty(details));
|
||||
Object principal = authentication.getPrincipal();
|
||||
Assert.isTrue(ObjectUtils.isNotEmpty(principal));
|
||||
String name = authentication.getName();
|
||||
Assert.isTrue(StringUtil.isNotBlank(name));
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue