13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ${LOG_HOME}/mangosteen.%d{yyyy-MM-dd}.log
6 | 30
7 |
8 |
9 | %-4relative [%thread] %-5level %logger{35} - %msg%n
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * Meta information about JaCoCo.
15 | */
16 | package com.mangosteen.jacoco.core;
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/csv/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Brock Janiczak - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * CSV report implementation.
15 | */
16 | package com.mangosteen.jacoco.report.csv;
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/xml/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Brock Janiczak - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * XML report implementation.
15 | */
16 | package com.mangosteen.jacoco.report.xml;
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/check/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * Rules check implementation.
15 | */
16 | package com.mangosteen.jacoco.report.check;
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/html/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * HTML report implementation.
15 | */
16 | package com.mangosteen.jacoco.report.html;
17 |
--------------------------------------------------------------------------------
/src/main/resources/templates/header.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * Common interfaces and utilities for report generation.
15 | */
16 | package com.mangosteen.jacoco.report;
17 |
--------------------------------------------------------------------------------
/src/main/resources/static/jacoco/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * Internal: Resources for HTML reports.
15 | */
16 | package com.mangosteen.jacoco.report.internal.html.resources;
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/runtime/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * Runtime control and execution data collection.
15 | */
16 | package com.mangosteen.jacoco.core.runtime;
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/data/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * Representation and persistence of execution data and session information.
15 | */
16 | package com.mangosteen.jacoco.core.data;
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/internal/html/index/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * Internal: Index generation for HTML reports.
15 | */
16 | package com.mangosteen.jacoco.report.internal.html.index;
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/internal/html/resources/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * Internal: Resources for HTML reports.
15 | */
16 | package com.mangosteen.jacoco.report.internal.html.resources;
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/dao/UserMapper.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.dao;
2 |
3 |
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Select;
6 |
7 | /**
8 | * @author guochang.xie
9 | * @Description: TODO
10 | * @date 2019/3/264:23 PM
11 | */
12 |
13 | @Mapper
14 | public interface UserMapper {
15 |
16 | @Select("select passwd from tb_user where userName =#{userName}")
17 | String queryPasswdByUserName(String userName);
18 |
19 | @Select("SELECT " +
20 | "role " +
21 | "FROM " +
22 | " tb_role tr " +
23 | " JOIN tb_userrole tur ON tr.id = tur.roleId " +
24 | " JOIN tb_user tu ON tu.id = tur.userId " +
25 | " AND tu.userName = #{userName}")
26 | String queryUserRole(String userName);
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/internal/html/table/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * Internal: Sortable HTML table for coverage node elements.
15 | */
16 | package com.mangosteen.jacoco.report.internal.html.table;
17 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/tools/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | * Collection of tools build on top of the JaCoCo core APIs. The tools offer
15 | * more high-level functionality useful for integrating JaCoCo.
16 | */
17 | package com.mangosteen.jacoco.core.tools;
18 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/service/CodeRepository.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.service;
2 |
3 |
4 | import java.io.File;
5 | import java.util.List;
6 |
7 | /**
8 | * @author guochang.xie
9 | * @Description: TODO
10 | * @date 2019/4/1012:15 PM
11 | */
12 | public interface CodeRepository {
13 |
14 | /**
15 | * 从代码仓库下载代码
16 | * @param repository 本地文件路径
17 | * @param branch 要下载的分支地址
18 | * @return
19 | */
20 | boolean downLoad(File repository, String branch);
21 |
22 | /**
23 | * 从代码仓库更新代码
24 | * @param file 本地代码位置
25 | * @param branch 要更新的分支地址
26 | * @return
27 | */
28 | boolean update(File file, String branch);
29 |
30 | /**
31 | *
32 | * @param baseUrl
33 | * @param diffUrl
34 | * @return 变更的方法列表
35 | */
36 | List diff(String baseUrl, String diffUrl);
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/instr/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 |
13 | /**
14 | *
15 | * Instrumentation of Java class files for code coverage. The main entry point
16 | * is the class {@link com.mangosteen.jacoco.core.instr.Instrumenter}.
17 | *
18 | */
19 | package com.mangosteen.jacoco.core.instr;
20 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/model/Project.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.model;
2 |
3 |
4 | import lombok.Getter;
5 | import lombok.Setter;
6 |
7 | @Getter
8 | @Setter
9 | public class Project {
10 |
11 |
12 | private int id;
13 |
14 | private String projectName;
15 |
16 | private String projectGroup;
17 |
18 | private String codeBranch;
19 |
20 | private String projectConfig;
21 |
22 |
23 | @Override
24 | public String toString() {
25 | final StringBuilder sb = new StringBuilder("{");
26 | sb.append("\"id\":")
27 | .append(id);
28 | sb.append(",\"projectName\":\"")
29 | .append(projectName).append('\"');
30 | sb.append(",\"projectGroup\":\"")
31 | .append(projectGroup).append('\"');
32 | sb.append(",\"codeBranch\":\"")
33 | .append(codeBranch).append('\"');
34 | sb.append('}');
35 | return sb.toString();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/service/MangosteenUserService.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.service;
2 |
3 | import com.mangosteen.dao.UserMapper;
4 | import com.mangosteen.tools.MD5Tools;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * @author guochang.xie
10 | * @Description: TODO
11 | * @date 2019/4/107:00 PM
12 | */
13 | @Service
14 | public class MangosteenUserService {
15 | @Autowired
16 | private UserMapper userMapper;
17 |
18 | public boolean isLogin(String userName,String passwd){
19 | String passWord = userMapper.queryPasswdByUserName(userName);
20 | String encryption = MD5Tools.encryption(passwd);
21 | if(encryption.equals(passWord)){
22 | return true;
23 | }
24 | return false;
25 | }
26 |
27 |
28 | public String queryUserRole(String userName){
29 | return userMapper.queryUserRole(userName);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/flow/IProbeIdGenerator.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.flow;
13 |
14 | /**
15 | * Internal interface to create probe ids unique within a class.
16 | */
17 | public interface IProbeIdGenerator {
18 |
19 | /**
20 | * Returns the next unique probe id.
21 | *
22 | * @return unique probe id
23 | */
24 | int nextId();
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/model/ProjectConfig.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.model;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 |
6 | @Setter
7 | @Getter
8 | public class ProjectConfig {
9 |
10 | private int id ;
11 | private int projectId;
12 | private String serverIp;
13 | private int serverPort;
14 | private String serverContainer;
15 |
16 |
17 | @Override
18 | public String toString() {
19 | final StringBuilder sb = new StringBuilder("{");
20 | sb.append("\"id\":")
21 | .append(id);
22 | sb.append(",\"projectId\":")
23 | .append(projectId);
24 | sb.append(",\"serverIp\":\"")
25 | .append(serverIp).append('\"');
26 | sb.append(",\"serverPort\":\"")
27 | .append(serverPort).append('\"');
28 | sb.append(",\"serverContainer\":\"")
29 | .append(serverContainer).append('\"');
30 | sb.append('}');
31 | return sb.toString();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/resources/static/vendor/vector-map/jqvmap.min.css:
--------------------------------------------------------------------------------
1 | .jqvmap-label,
2 | .jqvmap-pin {
3 | pointer-events: none
4 | }
5 | .jqvmap-label {
6 | position: absolute;
7 | display: none;
8 | -webkit-border-radius: 3px;
9 | -moz-border-radius: 3px;
10 | border-radius: 3px;
11 | background: #292929;
12 | color: #fff;
13 | font-family: sans-serif, Verdana;
14 | font-size: smaller;
15 | padding: 3px
16 | }
17 | .jqvmap-zoomin,
18 | .jqvmap-zoomout {
19 | position: absolute;
20 | left: 10px;
21 | -webkit-border-radius: 3px;
22 | -moz-border-radius: 3px;
23 | border-radius: 3px;
24 | background: #000;
25 | padding: 3px;
26 | color: #fff;
27 | width: 15px;
28 | height: 15px;
29 | cursor: pointer;
30 | line-height: 10px;
31 | text-align: center
32 | }
33 | .jqvmap-zoomin {
34 | top: 10px
35 | }
36 | .jqvmap-zoomout {
37 | top: 30px
38 | }
39 | .jqvmap-region {
40 | cursor: pointer
41 | }
42 | .jqvmap-ajax_response {
43 | width: 100%;
44 | height: 500px
45 | }
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/instr/IProbeInserter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.instr;
13 |
14 | /**
15 | * Internal interface for insertion of probes into in the instruction sequence
16 | * of a method.
17 | */
18 | interface IProbeInserter {
19 |
20 | /**
21 | * Inserts the probe with the given id.
22 | *
23 | * @param id
24 | * id of the probe to insert
25 | */
26 | void insertProbe(int id);
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/configContext/WebConfig.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.configContext;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.web.servlet.config.annotation.EnableWebMvc;
6 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
8 | import org.springframework.web.socket.server.standard.ServerEndpointExporter;
9 |
10 |
11 | @Configuration
12 | public class WebConfig implements WebMvcConfigurer {
13 |
14 | @Override
15 | public void addResourceHandlers(ResourceHandlerRegistry registry) {
16 | registry.addResourceHandler(
17 | "/static/**")
18 | .addResourceLocations(
19 | "classpath:/static/");
20 | }
21 | @Bean
22 | public ServerEndpointExporter serverEndpointExporter() {
23 | return new ServerEndpointExporter();
24 | }
25 |
26 |
27 | }
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/analysis/ISourceFileCoverage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.analysis;
13 |
14 | /**
15 | * Coverage data of a single source file. The name of this node is the local
16 | * name of the source file.
17 | */
18 | public interface ISourceFileCoverage extends ISourceNode {
19 |
20 | /**
21 | * Returns the VM name of the package the source file belongs to.
22 | *
23 | * @return package name
24 | */
25 | String getPackageName();
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/analysis/ICoverageVisitor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.analysis;
13 |
14 | /**
15 | * Interface for coverage data output as a stream of {@link IClassCoverage}
16 | * instances.
17 | */
18 | public interface ICoverageVisitor {
19 |
20 | /**
21 | * For analyzed class coverage data is emitted to this method.
22 | *
23 | * @param coverage
24 | * coverage data for a class
25 | */
26 | void visitCoverage(IClassCoverage coverage);
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/flow/IFrame.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.flow;
13 |
14 | import org.objectweb.asm.MethodVisitor;
15 |
16 | /**
17 | * Representation of the current stackmap frame content.
18 | */
19 | public interface IFrame {
20 |
21 | /**
22 | * Emits a frame event with the current content to the given visitor.
23 | *
24 | * @param mv
25 | * method visitor to emit frame event to
26 | */
27 | void accept(MethodVisitor mv);
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.servlet.context-path=/mangosteen
2 | server.port =8086
3 | server.address=0.0.0.0
4 | #### thymeleaf配置 #######
5 | spring.thymeleaf.cache=false
6 | spring.thymeleaf.encoding=UTF-8
7 | spring.thymeleaf.servlet.content-type=text/html
8 | spring.thymeleaf.mode=LEGACYHTML5
9 | ###静态资源文件路径配置,指定外部文件也为静态资源文件,就可以直接通过浏览器访问
10 | #spring.resources.static-locations =file:/Users/guochang.xie/Documents/tmp/ci-jacoco/
11 | spring.resources.static-locations =file:/opt/mangosteenWorkSpace/
12 | #数据源服务配置
13 | datasource.url=jdbc:mysql://10.10.111.10:3306/mangosteen?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&verifyServerCertificate=false&useSSL=false
14 | datasource.driverClassName=com.mysql.jdbc.Driver
15 | datasource.username=mangosteen
16 | datasource.password=mangosteen
17 | datasource.test-on-borrow=false
18 | datasource.test-while-idle=true
19 | datasource.time-between-eviction-runs-millis= 3600000
20 | #mongosteen项目保存路径
21 | mangosteen.workspace=/opt/mangosteenWorkSpace
22 | #spring.jpa.show-sql=true
23 | #logging.level.com.mangosteen.dao=debug
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/analysis/IBundleCoverage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.analysis;
13 |
14 | import java.util.Collection;
15 |
16 | /**
17 | * Coverage data of a bundle. A bundle groups a collection of packages.
18 | *
19 | * @see IPackageCoverage
20 | */
21 | public interface IBundleCoverage extends ICoverageNode {
22 |
23 | /**
24 | * Returns all packages contained in this bundle.
25 | *
26 | * @return all packages
27 | */
28 | Collection getPackages();
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/internal/html/table/ITableItem.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.report.internal.html.table;
13 |
14 | import com.mangosteen.jacoco.core.analysis.ICoverageNode;
15 | import com.mangosteen.jacoco.report.internal.html.ILinkable;
16 |
17 | /**
18 | * Interface for a item (row) in a coverage data table.
19 | */
20 | public interface ITableItem extends ILinkable {
21 |
22 | /**
23 | * Returns the corresponding node data.
24 | *
25 | * @return node data
26 | */
27 | ICoverageNode getNode();
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/data/IExecutionDataVisitor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.data;
13 |
14 | /**
15 | * Interface for data output of collected execution data. This interface is
16 | * meant to be implemented by parties that want to retrieve data from the
17 | * coverage runtime.
18 | */
19 | public interface IExecutionDataVisitor {
20 |
21 | /**
22 | * Provides execution data for a class.
23 | *
24 | * @param data
25 | * execution data for a class
26 | */
27 | void visitClassExecution(ExecutionData data);
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/tools/MD5Tools.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.tools;
2 |
3 | import java.security.MessageDigest;
4 | import java.security.NoSuchAlgorithmException;
5 |
6 | /**
7 | * @author guochang.xie
8 | * @Description: TODO
9 | * @date 2019/3/264:36 PM
10 | */
11 | public class MD5Tools {
12 |
13 | public static String encryption(String plainText) {
14 | String re_md5 = new String();
15 | try {
16 | MessageDigest md = MessageDigest.getInstance("MD5");
17 | md.update(plainText.getBytes());
18 | byte b[] = md.digest();
19 |
20 | int i;
21 |
22 | StringBuffer buf = new StringBuffer("");
23 | for (int offset = 0; offset < b.length; offset++) {
24 | i = b[offset];
25 | if (i < 0)
26 | i += 256;
27 | if (i < 16)
28 | buf.append("0");
29 | buf.append(Integer.toHexString(i));
30 | }
31 |
32 | re_md5 = buf.toString();
33 |
34 | } catch (NoSuchAlgorithmException e) {
35 | e.printStackTrace();
36 | }
37 | return re_md5;
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/analysis/IMethodCoverage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.analysis;
13 |
14 | /**
15 | * Coverage data of a single method. The name of this node is the local method
16 | * name.
17 | */
18 | public interface IMethodCoverage extends ISourceNode {
19 |
20 | /**
21 | * Returns the descriptor of the method.
22 | *
23 | * @return descriptor
24 | */
25 | String getDesc();
26 |
27 | /**
28 | * Returns the generic signature of the method if defined.
29 | *
30 | * @return generic signature or null
31 | */
32 | String getSignature();
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/internal/html/index/IIndexUpdate.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.report.internal.html.index;
13 |
14 | import com.mangosteen.jacoco.report.internal.html.ILinkable;
15 |
16 | /**
17 | * Every report page that should become part of the index must be added via this
18 | * interface.
19 | */
20 | public interface IIndexUpdate {
21 |
22 | /**
23 | * Adds a class to the index.
24 | *
25 | * @param link
26 | * link to the class
27 | * @param classid
28 | * identifier of the class
29 | */
30 | void addClass(ILinkable link, long classid);
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/data/ISessionInfoVisitor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.data;
13 |
14 | /**
15 | * Interface for data output of collected session information. This interface is
16 | * meant to be implemented by parties that want to retrieve data from the
17 | * coverage runtime.
18 | */
19 | public interface ISessionInfoVisitor {
20 |
21 | /**
22 | * Provides session information for the subsequent execution data calls. In
23 | * case of merged sessions this method might be called multiple times.
24 | *
25 | * @param info
26 | * session information
27 | */
28 | void visitSessionInfo(SessionInfo info);
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/service/CollectingLogOutputStream.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.service;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.apache.commons.exec.LogOutputStream;
5 |
6 | import java.util.LinkedList;
7 | import java.util.List;
8 |
9 | /**
10 | * @author guochang.xie
11 | * @Description: TODO
12 | * @date 2019/5/62:03 PM
13 | */
14 | @Slf4j
15 | public class CollectingLogOutputStream extends LogOutputStream {
16 | private final List lines = new LinkedList();
17 | private final boolean logToStandardOut;
18 |
19 | public CollectingLogOutputStream(boolean logToStandardOut) {
20 | this.logToStandardOut = logToStandardOut;
21 | }
22 |
23 | @Override
24 | protected void processLine(String line, int level) {
25 | if (logToStandardOut) {
26 | log.info(line);
27 | }
28 | lines.add(line);
29 | }
30 |
31 | public List getLines() {
32 | return lines;
33 | }
34 |
35 | public String getLine(){
36 | StringBuffer stringBuffer=new StringBuffer();
37 | for(String line:lines){
38 | stringBuffer.append(line);
39 | stringBuffer.append("\r\n");
40 | }
41 | return stringBuffer.toString();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/resources/static/vendor/smk-accordion/accordion.css:
--------------------------------------------------------------------------------
1 | .accordionjs {
2 | position: relative;
3 | margin: 0;
4 | padding: 0;
5 | list-style: none;
6 | margin-top: 10px;
7 | margin-bottom: 20px;
8 | }
9 | .accordionjs .acc_section {
10 | border: 1px solid #ccc;
11 | position: relative;
12 | z-index: 10;
13 | margin-top: -1px;
14 | overflow: hidden;
15 | }
16 | .accordionjs .acc_section .acc_head {
17 | position: relative;
18 | background: #fff;
19 | padding: 10px;
20 | display: block;
21 | cursor: pointer;
22 | }
23 | .accordionjs .acc_section .acc_head h3 {
24 | line-height: 1;
25 | margin: 5px 0;
26 | }
27 | .accordionjs .acc_section .acc_content {
28 | padding: 10px;
29 | }
30 | .accordionjs .acc_section:first-of-type,
31 | .accordionjs .acc_section:first-of-type .acc_head {
32 | border-top-left-radius: 3px;
33 | border-top-right-radius: 3px;
34 | }
35 | .accordionjs .acc_section:last-of-type,
36 | .accordionjs .acc_section:last-of-type .acc_content {
37 | border-bottom-left-radius: 3px;
38 | border-bottom-right-radius: 3px;
39 | }
40 | .accordionjs .acc_section.acc_active > .acc_content {
41 | display: block;
42 | }
43 | .accordionjs .acc_section.acc_active > .acc_head {
44 | background: #F9F9F9;
45 | border-bottom: 1px solid #ccc;
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/instr/NoneProbeArrayStrategy.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.instr;
13 |
14 | import org.objectweb.asm.ClassVisitor;
15 | import org.objectweb.asm.MethodVisitor;
16 |
17 | /**
18 | * The strategy does not emit any code at all. This is used for interface types
19 | * without any code.
20 | */
21 | class NoneProbeArrayStrategy implements IProbeArrayStrategy {
22 |
23 | public int storeInstance(final MethodVisitor mv, final boolean clinit,
24 | final int variable) {
25 | throw new UnsupportedOperationException();
26 | }
27 |
28 | public void addMembers(final ClassVisitor delegate, final int probeCount) {
29 | // nothing to do
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/runtime/IRemoteCommandVisitor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.runtime;
13 |
14 | import java.io.IOException;
15 |
16 | /**
17 | * Interface for remote commands to a coverage runtime.
18 | */
19 | public interface IRemoteCommandVisitor {
20 |
21 | /**
22 | * Requests a execution data dump with an optional reset.
23 | *
24 | * @param dump
25 | * true if the dump should be executed
26 | * @param reset
27 | * true if the reset should be executed
28 | * @throws IOException
29 | * in case of problems with the remote connection
30 | */
31 | void visitDumpCommand(boolean dump, boolean reset) throws IOException;
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/internal/html/table/TableItemComparator.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.report.internal.html.table;
13 |
14 | import com.mangosteen.jacoco.core.analysis.ICoverageNode;
15 |
16 | import java.util.Comparator;
17 |
18 | /**
19 | * Adapter to sort table items based on their coverage nodes.
20 | */
21 | class TableItemComparator implements Comparator {
22 |
23 | private final Comparator comparator;
24 |
25 | TableItemComparator(final Comparator comparator) {
26 | this.comparator = comparator;
27 | }
28 |
29 | public int compare(final ITableItem i1, final ITableItem i2) {
30 | return comparator.compare(i1.getNode(), i2.getNode());
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/resources/templates/menu.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/check/IViolationsOutput.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.report.check;
13 |
14 | import com.mangosteen.jacoco.core.analysis.ICoverageNode;
15 |
16 | /**
17 | * Call-back interface which is used to report rule violations to.
18 | *
19 | */
20 | public interface IViolationsOutput {
21 |
22 | /**
23 | * Called for every rule violation.
24 | *
25 | * @param node
26 | * node which violates a rule
27 | * @param rule
28 | * rule which is violated
29 | * @param limit
30 | * limit which is violated
31 | * @param message
32 | * readable message describing this violation
33 | */
34 | void onViolation(ICoverageNode node, Rule rule, Limit limit, String message);
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/service/LogOption.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.service;
2 |
3 | import java.io.*;
4 |
5 | /**
6 | * @author guochang.xie
7 | * @Description: TODO
8 | * @date 2019/5/64:33 PM
9 | */
10 | public class LogOption {
11 |
12 | private String filePath;
13 | public LogOption(String filePath){
14 | this.filePath=filePath;
15 | }
16 | public void writeLog(String log){
17 |
18 | BufferedWriter bwriter = null;
19 | try {
20 | File dir = new File(filePath);
21 | if(!dir.exists() && !dir.isDirectory()) {
22 | dir.mkdirs();
23 | }
24 | File logFile = new File(filePath + "/" + "build.log");
25 | if(!logFile.exists()) {
26 | logFile.createNewFile();
27 | }
28 | bwriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(logFile, true)));
29 | bwriter.write(log);
30 | bwriter.newLine();
31 | bwriter.flush();
32 | }catch (Exception exception){
33 |
34 | }
35 | finally{
36 | if(bwriter != null){
37 | try {
38 | bwriter.close();
39 | } catch (IOException e) {
40 | e.printStackTrace();
41 | }
42 | }
43 | }
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/JaCoCo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core;
13 |
14 | /**
15 | * Static Meta information about JaCoCo.
16 | */
17 | public final class JaCoCo {
18 |
19 | /** Qualified build version of the JaCoCo core library. */
20 | public static final String VERSION;
21 |
22 | /** Absolute URL of the current JaCoCo home page */
23 | public static final String HOMEURL;
24 |
25 | /** Name of the runtime package of this build */
26 | public static final String RUNTIMEPACKAGE;
27 |
28 | static {
29 | /*final ResourceBundle bundle = ResourceBundle
30 | .getBundle("jacoco");*/
31 | VERSION = "$qualified.bundle.version$";
32 | HOMEURL = "$jacoco.home.url$";
33 | RUNTIMEPACKAGE = "$jacoco.home.url$";
34 | }
35 |
36 | private JaCoCo() {
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/model/ExecuteRecords.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.model;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 |
6 | import java.util.Date;
7 |
8 | /**
9 | * @author guochang.xie
10 | * @Description: TODO
11 | * @date 2018/12/209:43 AM
12 | */
13 | @Getter
14 | @Setter
15 | public class ExecuteRecords {
16 |
17 | private int id ;
18 |
19 | private String projectName;
20 |
21 | private String codeBranch;
22 |
23 | private Date executeTime;
24 |
25 | private String serverIp;
26 |
27 | private String reportPath;
28 |
29 | private String diffUrl;
30 |
31 | //是否为git仓库
32 | private boolean isGit;
33 | //是否为增量覆盖率
34 | private boolean isIncrement;
35 |
36 |
37 | @Override
38 | public String toString() {
39 | final StringBuilder sb = new StringBuilder("{");
40 | sb.append("\"projectName\":\"")
41 | .append(projectName).append('\"');
42 | sb.append(",\"codeBranch\":\"")
43 | .append(codeBranch).append('\"');
44 | sb.append(",\"executeTime\":\"")
45 | .append(executeTime).append('\"');
46 | sb.append(",\"serverIp\":\"")
47 | .append(serverIp).append('\"');
48 | sb.append(",\"reportPath\":\"")
49 | .append(reportPath).append('\"');
50 | sb.append('}');
51 | return sb.toString();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/runtime/AbstractRuntime.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.runtime;
13 |
14 | import java.util.Random;
15 |
16 | /**
17 | * Base {@link IRuntime} implementation.
18 | */
19 | public abstract class AbstractRuntime implements IRuntime {
20 |
21 | /** access to the runtime data */
22 | protected RuntimeData data;
23 |
24 | /**
25 | * Subclasses must call this method when overwriting it.
26 | */
27 | public void startup(final RuntimeData data) throws Exception {
28 | this.data = data;
29 | }
30 |
31 | private static final Random RANDOM = new Random();
32 |
33 | /**
34 | * Creates a random session identifier.
35 | *
36 | * @return random session identifier
37 | */
38 | public static String createRandomId() {
39 | return Integer.toHexString(RANDOM.nextInt());
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/analysis/IPackageCoverage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.analysis;
13 |
14 | import java.util.Collection;
15 |
16 | /**
17 | * Coverage data of a Java package containing classes and source files. The name
18 | * of this node is the package name in VM notation (slash separated). The name
19 | * of the default package is the empty string.
20 | *
21 | * @see IClassCoverage
22 | * @see ISourceFileCoverage
23 | */
24 | public interface IPackageCoverage extends ICoverageNode {
25 |
26 | /**
27 | * Returns all classes contained in this package.
28 | *
29 | * @return all classes
30 | */
31 | Collection getClasses();
32 |
33 | /**
34 | * Returns all source files in this package.
35 | *
36 | * @return all source files
37 | */
38 | Collection getSourceFiles();
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/IMultiReportOutput.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.report;
13 |
14 | import java.io.IOException;
15 | import java.io.OutputStream;
16 |
17 | /**
18 | * Interface to emit multiple binary files.
19 | */
20 | public interface IMultiReportOutput {
21 |
22 | /**
23 | * Creates a file at the given local path. The returned {@link OutputStream}
24 | * has to be closed before the next document is created.
25 | *
26 | * @param path
27 | * local path to the new document
28 | * @return output for the content
29 | * @throws IOException
30 | * if the creation fails
31 | */
32 | OutputStream createFile(String path) throws IOException;
33 |
34 | /**
35 | * Closes the underlying resource container.
36 | *
37 | * @throws IOException
38 | * if closing fails
39 | */
40 | void close() throws IOException;
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/runtime/IRuntime.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.runtime;
13 |
14 | /**
15 | * This interface represents a particular mechanism to collect execution
16 | * information in the target VM at runtime.
17 | */
18 | public interface IRuntime extends IExecutionDataAccessorGenerator {
19 |
20 | /**
21 | * Starts the coverage runtime. This method MUST be called before any class
22 | * instrumented for this runtime is loaded.
23 | *
24 | * @param data
25 | * the execution data for this runtime
26 | * @throws Exception
27 | * any internal problem during startup
28 | */
29 | void startup(RuntimeData data) throws Exception;
30 |
31 | /**
32 | * Allows the coverage runtime to cleanup internals. This class should be
33 | * called when classes instrumented for this runtime are not used any more.
34 | */
35 | void shutdown();
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/configContext/MangosteenDataSource.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.configContext;
2 |
3 | import com.alibaba.druid.pool.DruidDataSource;
4 | import org.mybatis.spring.SqlSessionFactoryBean;
5 | import org.mybatis.spring.annotation.MapperScan;
6 | import org.springframework.beans.factory.annotation.Qualifier;
7 |
8 | import org.springframework.boot.context.properties.ConfigurationProperties;
9 | import org.springframework.context.annotation.Bean;
10 | import org.springframework.context.annotation.Configuration;
11 |
12 | import javax.sql.DataSource;
13 |
14 | @Configuration
15 | @MapperScan(basePackages="com.mangosteen.dao",sqlSessionFactoryRef="mangosteenSqlSessionFactory")
16 | public class MangosteenDataSource {
17 |
18 | @Bean(name = "mangosteenMysqlDataSource")
19 | @ConfigurationProperties("datasource")
20 | public DataSource initDataSouurce(){
21 | DruidDataSource dataSource = new DruidDataSource();
22 | dataSource.setTimeBetweenConnectErrorMillis(300000);
23 | dataSource.setMinEvictableIdleTimeMillis(600000);
24 | return dataSource;
25 | }
26 |
27 | @Bean(name="mangosteenSqlSessionFactory")
28 | public SqlSessionFactoryBean createSqlSessionFactoryBean(@Qualifier("mangosteenMysqlDataSource") DataSource mangosteenDataSource){
29 | SqlSessionFactoryBean sqlSessionFactoryBean=new SqlSessionFactoryBean();
30 | sqlSessionFactoryBean.setDataSource(mangosteenDataSource);
31 | return sqlSessionFactoryBean;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/analysis/ILine.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.analysis;
13 |
14 | /**
15 | * The instruction and branch coverage of a single source line is described by
16 | * this interface.
17 | */
18 | public interface ILine {
19 |
20 | /**
21 | * Returns the instruction counter for this line.
22 | *
23 | * @return instruction counter
24 | */
25 | ICounter getInstructionCounter();
26 |
27 | /**
28 | * Returns the branches counter for this line.
29 | *
30 | * @return branches counter
31 | */
32 | ICounter getBranchCounter();
33 |
34 | /**
35 | * Returns the coverage status of this line, calculated from the
36 | * instructions counter and branch counter.
37 | *
38 | * @see ICounter#EMPTY
39 | * @see ICounter#NOT_COVERED
40 | * @see ICounter#PARTLY_COVERED
41 | * @see ICounter#FULLY_COVERED
42 | *
43 | * @return status of this line
44 | */
45 | int getStatus();
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/analysis/filter/IFilter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Evgeny Mandrikov - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.analysis.filter;
13 |
14 | import org.objectweb.asm.tree.MethodNode;
15 |
16 | /**
17 | * Interface for filter implementations. Instances of filters are created for
18 | * analysis of each class and so can have per-class state.
19 | */
20 | public interface IFilter {
21 |
22 | /**
23 | * This method is called for every method. The filter implementation is
24 | * expected to inspect the provided method and report its result to the
25 | * given {@link IFilterOutput} instance.
26 | *
27 | * @param methodNode
28 | * method to inspect
29 | * @param context
30 | * context information for the method
31 | * @param output
32 | * callback to report filtering results to
33 | */
34 | void filter(MethodNode methodNode, IFilterContext context,
35 | IFilterOutput output);
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/internal/html/ILinkable.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.report.internal.html;
13 |
14 | import com.mangosteen.jacoco.report.internal.ReportOutputFolder;
15 |
16 | /**
17 | * Abstraction for items that can be linked to in a report.
18 | */
19 | public interface ILinkable {
20 |
21 | /**
22 | * Returns a relative link to the item that works from the given base
23 | * folder.
24 | *
25 | * @param base
26 | * folder where the link should be inserted
27 | * @return relative link or null if the target does not exist
28 | */
29 | String getLink(ReportOutputFolder base);
30 |
31 | /**
32 | * Returns the display label used for the link.
33 | *
34 | * @return display label
35 | */
36 | String getLinkLabel();
37 |
38 | /**
39 | * Optional style class to be associated with the link.
40 | *
41 | * @return link style class or null
42 | */
43 | String getLinkStyle();
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/analysis/filter/IFilterContext.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.analysis.filter;
13 |
14 | import java.util.Set;
15 |
16 | /**
17 | * Context information provided to filters.
18 | */
19 | public interface IFilterContext {
20 |
21 | /**
22 | * @return vm name of the enclosing class
23 | */
24 | String getClassName();
25 |
26 | /**
27 | * @return vm name of the super class of the enclosing class
28 | */
29 | String getSuperClassName();
30 |
31 | /**
32 | * @return vm names of the class annotations of the enclosing class
33 | */
34 | Set getClassAnnotations();
35 |
36 | /**
37 | * @return file name of the corresponding source file or null
38 | * if not available
39 | */
40 | String getSourceFileName();
41 |
42 | /**
43 | * @return value of SourceDebugExtension attribute or null if
44 | * not available
45 | */
46 | String getSourceDebugExtension();
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/analysis/SourceFileCoverageImpl.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.analysis;
13 |
14 | import com.mangosteen.jacoco.core.analysis.ISourceFileCoverage;
15 |
16 | /**
17 | * Implementation of {@link ISourceFileCoverage}.
18 | */
19 | public class SourceFileCoverageImpl extends SourceNodeImpl implements
20 | ISourceFileCoverage {
21 |
22 | private final String packagename;
23 |
24 | /**
25 | * Creates a source file data object with the given parameters.
26 | *
27 | * @param name
28 | * name of the source file
29 | * @param packagename
30 | * vm name of the package the source file belongs to
31 | */
32 | public SourceFileCoverageImpl(final String name, final String packagename) {
33 | super(ElementType.SOURCEFILE, name);
34 | this.packagename = packagename;
35 | }
36 |
37 | // === ISourceFileCoverage implementation ===
38 |
39 | public String getPackageName() {
40 | return packagename;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/ISourceFileLocator.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.report;
13 |
14 | import java.io.IOException;
15 | import java.io.Reader;
16 |
17 | /**
18 | * Interface to look-up source files that will be included with the report.
19 | */
20 | public interface ISourceFileLocator {
21 |
22 | /**
23 | * Tries to locate the given source file and opens a reader with the
24 | * appropriate encoding.
25 | *
26 | * @param packageName
27 | * VM name of the package
28 | * @param fileName
29 | * name of the source file
30 | * @return reader if the file could be located, null otherwise
31 | * @throws IOException
32 | * in case of problems while opening the file
33 | */
34 | Reader getSourceFile(String packageName, String fileName)
35 | throws IOException;
36 |
37 | /**
38 | * Returns number of blank characters that represent a tab in source code.
39 | *
40 | * @return tab width as number of blanks
41 | */
42 | int getTabWidth();
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/internal/html/page/SourceFileItem.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.report.internal.html.page;
13 |
14 | import com.mangosteen.jacoco.core.analysis.ICoverageNode;
15 | import com.mangosteen.jacoco.core.analysis.ISourceFileCoverage;
16 | import com.mangosteen.jacoco.report.internal.html.table.ITableItem;
17 | import com.mangosteen.jacoco.report.internal.ReportOutputFolder;
18 | import com.mangosteen.jacoco.report.internal.html.resources.Styles;
19 |
20 | /**
21 | * Table items representing a source file which cannot be linked.
22 | *
23 | */
24 | final class SourceFileItem implements ITableItem {
25 |
26 | private final ICoverageNode node;
27 |
28 | SourceFileItem(final ISourceFileCoverage node) {
29 | this.node = node;
30 | }
31 |
32 | public String getLinkLabel() {
33 | return node.getName();
34 | }
35 |
36 | public String getLinkStyle() {
37 | return Styles.EL_SOURCE;
38 | }
39 |
40 | public String getLink(final ReportOutputFolder base) {
41 | return null;
42 | }
43 |
44 | public ICoverageNode getNode() {
45 | return node;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/analysis/filter/SyntheticFilter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Evgeny Mandrikov - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.analysis.filter;
13 |
14 | import org.objectweb.asm.Opcodes;
15 | import org.objectweb.asm.tree.MethodNode;
16 |
17 | /**
18 | * Filters synthetic methods unless they represent bodies of lambda expressions.
19 | */
20 | public final class SyntheticFilter implements IFilter {
21 |
22 | public void filter(final MethodNode methodNode,
23 | final IFilterContext context, final IFilterOutput output) {
24 | if ((methodNode.access & Opcodes.ACC_SYNTHETIC) == 0) {
25 | return;
26 | }
27 |
28 | if (methodNode.name.startsWith("lambda$")) {
29 | return;
30 | }
31 |
32 | if (KotlinGeneratedFilter.isKotlinClass(context)) {
33 | if (KotlinDefaultArgumentsFilter
34 | .isDefaultArgumentsMethodName(methodNode.name)) {
35 | return;
36 | }
37 |
38 | if (KotlinCoroutineFilter.isLastArgumentContinuation(methodNode)) {
39 | return;
40 | }
41 | }
42 |
43 | output.ignore(methodNode.instructions.getFirst(),
44 | methodNode.instructions.getLast());
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/InputStreams.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Evgeny Mandrikov - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal;
13 |
14 | import java.io.ByteArrayOutputStream;
15 | import java.io.IOException;
16 | import java.io.InputStream;
17 |
18 | /**
19 | * Utilities for {@link InputStream}s.
20 | */
21 | public final class InputStreams {
22 |
23 | private InputStreams() {
24 | }
25 |
26 | /**
27 | * Reads all bytes from an input stream into a byte array. The provided
28 | * {@link InputStream} is not closed by this method.
29 | *
30 | * @param is
31 | * the input stream to read from
32 | * @return a byte array containing all the bytes from the stream
33 | * @throws IOException
34 | * if an I/O error occurs
35 | */
36 | public static byte[] readFully(final InputStream is) throws IOException {
37 | final byte[] buf = new byte[1024];
38 | final ByteArrayOutputStream out = new ByteArrayOutputStream();
39 | while (true) {
40 | final int r = is.read(buf);
41 | if (r == -1) {
42 | break;
43 | }
44 | out.write(buf, 0, r);
45 | }
46 | return out.toByteArray();
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/analysis/ISourceNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.analysis;
13 |
14 | /**
15 | * Interface for coverage nodes that have individual source lines like methods,
16 | * classes and source files.
17 | */
18 | public interface ISourceNode extends ICoverageNode {
19 |
20 | /** Place holder for unknown lines (no debug information) */
21 | int UNKNOWN_LINE = -1;
22 |
23 | /**
24 | * The number of the first line coverage information is available for. If no
25 | * line is contained, the method returns -1.
26 | *
27 | * @return number of the first line or {@link #UNKNOWN_LINE}
28 | */
29 | int getFirstLine();
30 |
31 | /**
32 | * The number of the last line coverage information is available for. If no
33 | * line is contained, the method returns -1.
34 | *
35 | * @return number of the last line or {@link #UNKNOWN_LINE}
36 | */
37 | int getLastLine();
38 |
39 | /**
40 | * Returns the line information for given line.
41 | *
42 | * @param nr
43 | * line number of interest
44 | * @return line information
45 | */
46 | ILine getLine(int nr);
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/dao/ProjectMapper.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.dao;
2 |
3 | import com.mangosteen.model.Project;
4 | import com.mangosteen.model.ProjectConfig;
5 | import org.apache.ibatis.annotations.*;
6 |
7 | import java.util.List;
8 |
9 | @Mapper
10 | public interface ProjectMapper {
11 |
12 | @Select("select id,projectName,projectGroup,codeBranch from tb_project")
13 | List queryAllProject();
14 |
15 | @Insert("INSERT INTO tb_project(`projectName`, `projectGroup`, `codeBranch`,`projectConfig`) VALUES " +
16 | "(#{projectName}, 'default', #{codeBranch},#{projectConfig});")
17 | @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
18 | int saveProject(Project project);
19 |
20 | @Insert("")
26 | void saveProjectConfig(@Param("projectConfigs") List projectConfigs);
27 |
28 | @Select("select id,projectName,projectGroup,codeBranch,projectConfig from tb_project where projectName=#{projectName}")
29 | Project queryProjectByName(String projectName);
30 |
31 | @Update("update tb_project set projectName=#{projectName} ,codeBranch=#{codeBranch} ,projectConfig=#{projectConfig} where id =#{id}")
32 | void updateProjectById(Project project);
33 |
34 | @Delete("delete from tb_project where projectName=#{projectName}")
35 | void deleteByProjectName(String projectName);
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/FileMultiReportOutput.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.report;
13 |
14 | import java.io.*;
15 |
16 | import static java.lang.String.format;
17 |
18 | /**
19 | * Implementation of {@link IMultiReportOutput} that writes files directly to a
20 | * given directory.
21 | */
22 | public class FileMultiReportOutput implements IMultiReportOutput {
23 |
24 | private final File basedir;
25 |
26 | /**
27 | * Creates a new instance for document output in the given base directory.
28 | *
29 | * @param basedir
30 | * base directory
31 | */
32 | public FileMultiReportOutput(final File basedir) {
33 | this.basedir = basedir;
34 | }
35 |
36 | public OutputStream createFile(final String path) throws IOException {
37 | final File file = new File(basedir, path);
38 | final File parent = file.getParentFile();
39 | parent.mkdirs();
40 | if (!parent.isDirectory()) {
41 | throw new IOException(format("Can't create directory %s.", parent));
42 | }
43 | return new BufferedOutputStream(new FileOutputStream(file));
44 | }
45 |
46 | public void close() throws IOException {
47 | // nothing to do here
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/service/impl/SvnRepositoryImpl.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.service.impl;
2 |
3 | import com.mangosteen.service.CodeRepository;
4 | import com.mangosteen.tools.SvnManager;
5 | import lombok.extern.slf4j.Slf4j;
6 | import org.apache.commons.lang3.StringUtils;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.io.BufferedReader;
10 | import java.io.File;
11 | import java.io.FileReader;
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | /**
16 | * @author guochang.xie
17 | * @Description: TODO
18 | * @date 2019/3/2010:47 AM
19 | */
20 | @Service("svnImpl")
21 | @Slf4j
22 | public class SvnRepositoryImpl implements CodeRepository {
23 |
24 | @Override
25 | public boolean downLoad(File repository, String branch) {
26 |
27 | SvnManager svnManager=new SvnManager();
28 | svnManager.init();
29 | try {
30 | svnManager.checkOutModel(repository,branch);
31 | } catch (Exception e) {
32 | log.error("svn 检出失败,详情为:{}",e.getMessage());
33 | return false;
34 | }
35 | return true;
36 | }
37 |
38 | @Override
39 | public boolean update(File file, String branch) {
40 | SvnManager svnManager=new SvnManager();
41 | svnManager.init();
42 | try {
43 | svnManager.updateModel(file);
44 | } catch (Exception e) {
45 | log.error("svn 更新失败,详情为:{}",e.getMessage());
46 | return false;
47 | }
48 | return true;
49 | }
50 |
51 | @Override
52 | public List diff(String baseUrl, String diffUrl) {
53 | SvnManager svnManager=new SvnManager();
54 | svnManager.init();
55 | return svnManager.doDiffStatus(baseUrl, diffUrl);
56 |
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/analysis/filter/KotlinNotNullOperatorFilter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Evgeny Mandrikov - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.analysis.filter;
13 |
14 | import org.objectweb.asm.Opcodes;
15 | import org.objectweb.asm.tree.AbstractInsnNode;
16 | import org.objectweb.asm.tree.MethodNode;
17 |
18 | /**
19 | * Filters branch in bytecode that Kotlin compiler generates for not-null
20 | * assertion operator.
21 | */
22 | public final class KotlinNotNullOperatorFilter implements IFilter {
23 |
24 | public void filter(final MethodNode methodNode,
25 | final IFilterContext context, final IFilterOutput output) {
26 | final Matcher matcher = new Matcher();
27 | for (AbstractInsnNode i = methodNode.instructions
28 | .getFirst(); i != null; i = i.getNext()) {
29 | matcher.match(i, output);
30 | }
31 | }
32 |
33 | private static class Matcher extends AbstractMatcher {
34 | public void match(final AbstractInsnNode start,
35 | final IFilterOutput output) {
36 | if (Opcodes.IFNONNULL != start.getOpcode()) {
37 | return;
38 | }
39 | cursor = start;
40 | nextIsInvokeStatic("kotlin/jvm/internal/Intrinsics", "throwNpe");
41 | if (cursor == null) {
42 | return;
43 | }
44 | output.ignore(start, cursor);
45 | }
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/analysis/filter/EnumFilter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Evgeny Mandrikov - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.analysis.filter;
13 |
14 | import org.objectweb.asm.tree.MethodNode;
15 |
16 | /**
17 | * Filters methods values and valueOf that compiler
18 | * creates for enums.
19 | */
20 | public final class EnumFilter implements IFilter {
21 |
22 | public void filter(final MethodNode methodNode,
23 | final IFilterContext context, final IFilterOutput output) {
24 | if (isMethodFiltered(context.getClassName(),
25 | context.getSuperClassName(), methodNode.name,
26 | methodNode.desc)) {
27 | output.ignore(methodNode.instructions.getFirst(),
28 | methodNode.instructions.getLast());
29 | }
30 | }
31 |
32 | private boolean isMethodFiltered(final String className,
33 | final String superClassName, final String methodName,
34 | final String methodDesc) {
35 | if ("java/lang/Enum".equals(superClassName)) {
36 | if ("values".equals(methodName)
37 | && ("()[L" + className + ";").equals(methodDesc)) {
38 | return true;
39 | }
40 | if ("valueOf".equals(methodName)
41 | && ("(Ljava/lang/String;)L" + className + ";")
42 | .equals(methodDesc)) {
43 | return true;
44 | }
45 | }
46 | return false;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/instr/ProbeCounter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.instr;
13 |
14 | import com.mangosteen.jacoco.core.internal.flow.ClassProbesVisitor;
15 | import com.mangosteen.jacoco.core.internal.flow.MethodProbesVisitor;
16 | import org.objectweb.asm.Opcodes;
17 |
18 | /**
19 | * Internal class to remember the total number of probes required for a class.
20 | */
21 | class ProbeCounter extends ClassProbesVisitor {
22 |
23 | private int count;
24 | private boolean methods;
25 |
26 | ProbeCounter() {
27 | count = 0;
28 | methods = false;
29 | }
30 |
31 | @Override
32 | public MethodProbesVisitor visitMethod(final int access, final String name,
33 | final String desc, final String signature, final String[] exceptions) {
34 | if (!InstrSupport.CLINIT_NAME.equals(name)
35 | && (access & Opcodes.ACC_ABSTRACT) == 0) {
36 | methods = true;
37 | }
38 | return null;
39 | }
40 |
41 | @Override
42 | public void visitTotalProbeCount(final int count) {
43 | this.count = count;
44 | }
45 |
46 | int getCount() {
47 | return count;
48 | }
49 |
50 | /**
51 | * @return true if the class has non-abstract methods other
52 | * than a static initializer
53 | */
54 | boolean hasMethods() {
55 | return methods;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/resources/static/js/common.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 校验文本是否为空
3 | * tips:提示信息
4 | * 使用方法:$("#id").validate("提示文本");
5 | * @itmyhome
6 | */
7 | $.fn.validate = function(tips){
8 |
9 | if($(this).val() == "" || $.trim($(this).val()).length == 0){
10 | alert(tips + "不能为空!");
11 | $(this).focus();
12 | throw SyntaxError();
13 | }
14 | }
15 | /**
16 | * 扩展jQuery动态创建表单,post提交数据后页面可以跳转
17 | * url:要跳转的页面
18 | * args:后台传递参数,{arg0:'arg0',arg1:'arg1'}
19 | * 用法为:$.StandardPost('url/path/req',{arg0:'arg0',arg1:'arg1'});
20 | */
21 | $.extend({
22 | StandardPost:function(url,args){
23 | var body = $(document.body),
24 | form = $(""),
25 | input;
26 | form.attr({"action":url});
27 | $.each(args,function(key,value){
28 | input = $("");
29 | input.attr({"name":key});
30 | input.val(value);
31 | form.append(input);
32 | });
33 |
34 | form.appendTo(document.body);
35 | form.submit();
36 | document.body.removeChild(form[0]);
37 | }
38 | });
39 |
40 |
41 | $.fn.serializeObject = function() {
42 | var o = {};
43 | var a = this.serializeArray();
44 | $.each(a, function() {
45 | if (o[this.name]) {
46 | if (!o[this.name].push) {
47 | o[this.name] = [ o[this.name] ];
48 | }
49 | o[this.name].push(this.value || '');
50 | } else {
51 | o[this.name] = this.value || '';
52 | }
53 | });
54 | return o;
55 | };
56 |
57 |
58 |
59 | function changeFrameHeight(){
60 | var ifm= document.getElementById("reportIframe");
61 | ifm.height=document.documentElement.clientHeight;
62 | ifm.weight=document.documentElement.clientWidth;
63 |
64 | }
65 |
66 |
67 | window.onresize=function(){
68 | changeFrameHeight();
69 |
70 | }
71 |
72 |
73 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/report/internal/html/page/GroupPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Marc R. Hoffmann - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.report.internal.html.page;
13 |
14 | import com.mangosteen.jacoco.core.analysis.ICoverageNode;
15 | import com.mangosteen.jacoco.report.internal.ReportOutputFolder;
16 | import com.mangosteen.jacoco.report.internal.html.IHTMLReportContext;
17 |
18 | /**
19 | * Page showing coverage information for a node that groups other nodes. The
20 | * page shows a table of linked nodes.
21 | */
22 | public class GroupPage extends TablePage {
23 |
24 | /**
25 | * Creates a new visitor in the given context.
26 | *
27 | * @param node
28 | * corresponding coverage data
29 | * @param parent
30 | * optional hierarchical parent
31 | * @param folder
32 | * base folder to create this page in
33 | * @param context
34 | * settings context
35 | */
36 | public GroupPage(final ICoverageNode node, final ReportPage parent,
37 | final ReportOutputFolder folder, final IHTMLReportContext context) {
38 | super(node, parent, folder, context);
39 | }
40 |
41 | @Override
42 | protected String getOnload() {
43 | return "initialSort(['breadcrumb', 'coveragetable'])";
44 | }
45 |
46 | @Override
47 | protected String getFileName() {
48 | return "index.html";
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/mangosteen/jacoco/core/internal/analysis/filter/PrivateEmptyNoArgConstructorFilter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Evgeny Mandrikov - initial API and implementation
10 | *
11 | *******************************************************************************/
12 | package com.mangosteen.jacoco.core.internal.analysis.filter;
13 |
14 | import org.objectweb.asm.Opcodes;
15 | import org.objectweb.asm.tree.MethodNode;
16 |
17 | /**
18 | * Filters private empty constructors that do not have arguments.
19 | */
20 | public final class PrivateEmptyNoArgConstructorFilter implements IFilter {
21 |
22 | private static final String CONSTRUCTOR_NAME = "";
23 | private static final String CONSTRUCTOR_DESC = "()V";
24 |
25 | public void filter(final MethodNode methodNode,
26 | final IFilterContext context, final IFilterOutput output) {
27 | if ((methodNode.access & Opcodes.ACC_PRIVATE) != 0
28 | && CONSTRUCTOR_NAME.equals(methodNode.name)
29 | && CONSTRUCTOR_DESC.equals(methodNode.desc) && new Matcher()
30 | .match(methodNode, context.getSuperClassName())) {
31 | output.ignore(methodNode.instructions.getFirst(),
32 | methodNode.instructions.getLast());
33 | }
34 | }
35 |
36 | private static class Matcher extends AbstractMatcher {
37 | private boolean match(final MethodNode methodNode,
38 | final String superClassName) {
39 | firstIsALoad0(methodNode);
40 | nextIsInvokeSuper(superClassName, CONSTRUCTOR_DESC);
41 | nextIs(Opcodes.RETURN);
42 | return cursor != null;
43 | }
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/test/java/com/mangosteen/service/impl/GitRepositoryImplTest.java:
--------------------------------------------------------------------------------
1 | package com.mangosteen.service.impl;
2 |
3 | import org.junit.After;
4 | import org.junit.Before;
5 | import org.junit.Test;
6 |
7 | import java.io.File;
8 |
9 | /**
10 | * GitRepositoryImpl Tester.
11 | *
12 | * @author
13 | * @version 1.0
14 | * @since