mirror of https://github.com/halo-dev/halo
commit
68a5481e5f
40
README.md
40
README.md
|
@ -1,6 +1,6 @@
|
||||||
<h1>Halo</h1>
|
<h1 align="center"><a href="https://github.com/halo-dev" target="_blank">Halo</a></h1>
|
||||||
|
|
||||||
> Halo 可能是最好的 Java 博客系统。(请注意,老版本已不提供维护,当前分支为新版本,正在内测中,将于近期发布版本)
|
> Halo 可能是最好的 Java 博客系统。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://ryanc.cc"><img alt="Author" src="https://img.shields.io/badge/author-ruibaby-red.svg?style=flat-square"/></a>
|
<a href="https://ryanc.cc"><img alt="Author" src="https://img.shields.io/badge/author-ruibaby-red.svg?style=flat-square"/></a>
|
||||||
|
@ -12,6 +12,10 @@
|
||||||
|
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
|
## 新版本说明
|
||||||
|
|
||||||
|
**老版本已不提供维护,请不要再使用老版本进行部署了,当前分支为新版本,正在内测中,将于近期发布版本**
|
||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
|
|
||||||
**Halo** [ˈheɪloʊ],意为光环。当然,你也可以当成拼音读(哈喽)。
|
**Halo** [ˈheɪloʊ],意为光环。当然,你也可以当成拼音读(哈喽)。
|
||||||
|
@ -64,3 +68,35 @@
|
||||||
| 支付宝/微信/QQ |
|
| 支付宝/微信/QQ |
|
||||||
| :------------: |
|
| :------------: |
|
||||||
| <img src="https://i.loli.net/2018/12/23/5c1f68ce9b884.png" width="200"/> |
|
| <img src="https://i.loli.net/2018/12/23/5c1f68ce9b884.png" width="200"/> |
|
||||||
|
|
||||||
|
## 预览图
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
|
@ -36,9 +36,9 @@ public class ContentSheetController {
|
||||||
*
|
*
|
||||||
* @return template path: themes/{theme}/gallery.ftl
|
* @return template path: themes/{theme}/gallery.ftl
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/gallery")
|
@GetMapping(value = "/photos")
|
||||||
public String gallery() {
|
public String photos() {
|
||||||
return themeService.render("gallery");
|
return themeService.render("photos");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,17 +23,17 @@
|
||||||
</ul>
|
</ul>
|
||||||
</header>
|
</header>
|
||||||
<section id="thumbnails">
|
<section id="thumbnails">
|
||||||
<@galleryTag method="list">
|
<@photoTag method="list">
|
||||||
<#if galleries?size gt 0>
|
<#if photos?size gt 0>
|
||||||
<#list galleries as gallery>
|
<#list photos as photo>
|
||||||
<article>
|
<article>
|
||||||
<a class="thumbnail" href="${gallery.url}" data-position="left center"><img src="${gallery.thumbnail}" alt="${gallery.description}" /></a>
|
<a class="thumbnail" href="${photo.url}" data-position="left center"><img src="${photo.thumbnail}" alt="${photo.description}" /></a>
|
||||||
<h2>${gallery.name}</h2>
|
<h2>${photo.name}</h2>
|
||||||
<p>${gallery.takeTime!}</p>
|
<p>${photo.takeTime!}</p>
|
||||||
</article>
|
</article>
|
||||||
</#list>
|
</#list>
|
||||||
</#if>
|
</#if>
|
||||||
</@galleryTag>
|
</@photoTag>
|
||||||
</section>
|
</section>
|
||||||
<footer id="footer">
|
<footer id="footer">
|
||||||
<ul class="copyright">
|
<ul class="copyright">
|
|
@ -1,33 +0,0 @@
|
||||||
package run.halo.app.event;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.context.ApplicationListener;
|
|
||||||
import run.halo.app.event.logger.LogEvent;
|
|
||||||
import run.halo.app.event.logger.LogEventListener;
|
|
||||||
import run.halo.app.utils.ReflectionUtils;
|
|
||||||
|
|
||||||
import java.lang.reflect.ParameterizedType;
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log event listener test.
|
|
||||||
*
|
|
||||||
* @author johnniang
|
|
||||||
* @date 19-4-21
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class LogEventListenerTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getGenericTypeTest() {
|
|
||||||
ParameterizedType parameterizedType = ReflectionUtils.getParameterizedType(ApplicationListener.class, LogEventListener.class);
|
|
||||||
Type[] actualTypeArguments = Objects.requireNonNull(parameterizedType).getActualTypeArguments();
|
|
||||||
Type actualTypeArgument = actualTypeArguments[0];
|
|
||||||
assertThat(actualTypeArgument.getTypeName(), equalTo(LogEvent.class.getTypeName()));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +1,19 @@
|
||||||
package run.halo.app.service.impl;
|
package run.halo.app.service.impl;
|
||||||
|
|
||||||
import run.halo.app.model.entity.Option;
|
|
||||||
import run.halo.app.model.properties.QnYunProperties;
|
|
||||||
import run.halo.app.repository.OptionRepository;
|
|
||||||
import com.qiniu.common.Zone;
|
import com.qiniu.common.Zone;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
import run.halo.app.cache.StringCacheStore;
|
||||||
|
import run.halo.app.model.entity.Option;
|
||||||
|
import run.halo.app.model.properties.QnYunProperties;
|
||||||
|
import run.halo.app.repository.OptionRepository;
|
||||||
|
import run.halo.app.service.OptionService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -30,6 +34,9 @@ public class OptionServiceImplTest {
|
||||||
@Mock
|
@Mock
|
||||||
private OptionRepository optionRepository;
|
private OptionRepository optionRepository;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private StringCacheStore cacheStore;
|
||||||
|
|
||||||
@InjectMocks
|
@InjectMocks
|
||||||
private OptionServiceImpl optionService;
|
private OptionServiceImpl optionService;
|
||||||
|
|
||||||
|
@ -76,13 +83,16 @@ public class OptionServiceImplTest {
|
||||||
QnYunProperties zoneProperty = QnYunProperties.ZONE;
|
QnYunProperties zoneProperty = QnYunProperties.ZONE;
|
||||||
|
|
||||||
// Given
|
// Given
|
||||||
given(optionRepository.findByKey(zoneProperty.getValue())).willReturn(Optional.ofNullable(option));
|
// given(optionRepository.findByKey(zoneProperty.getValue())).willReturn(Optional.ofNullable(option));
|
||||||
|
Map<String, Object> optionMap = new HashMap<>(1);
|
||||||
|
optionMap.put(zoneProperty.getValue(), Optional.ofNullable(option).map(Option::getValue).orElse(null));
|
||||||
|
given(cacheStore.getAny(OptionService.OPTIONS_KEY, Map.class)).willReturn(Optional.of(optionMap));
|
||||||
|
|
||||||
// When
|
// When
|
||||||
Zone zone = optionService.getQnYunZone();
|
Zone zone = optionService.getQnYunZone();
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
then(optionRepository).should().findByKey(zoneProperty.getValue());
|
then(cacheStore).should().getAny(OptionService.OPTIONS_KEY, Map.class);
|
||||||
|
|
||||||
assertNotNull(zone);
|
assertNotNull(zone);
|
||||||
assertThat(zone.getRegion(), equalTo(actualZone.getRegion()));
|
assertThat(zone.getRegion(), equalTo(actualZone.getRegion()));
|
||||||
|
|
Loading…
Reference in New Issue