Skip to content

Commit

Permalink
1. cola-archetypes和cola-components的pom中plugin org.sonatype.plugins导致不…
Browse files Browse the repository at this point in the history
…能编译问题,注释掉

2. fastjson统一改为1.2.70
3. craftsman适配4.0.1版本的cola framwork
4. start/src/test下面增加测试的http脚本
  • Loading branch information
N2XK committed Jan 26, 2021
1 parent 345b2f3 commit 388f9a3
Show file tree
Hide file tree
Showing 34 changed files with 154 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.55</version>
<version>1.2.70</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.55</version>
<version>1.2.70</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
22 changes: 11 additions & 11 deletions cola-archetypes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.sonatype.plugins</groupId>-->
<!-- <artifactId>nexus-staging-maven-plugin</artifactId>-->
<!-- <version>1.6.8</version>-->
<!-- <extensions>true</extensions>-->
<!-- <configuration>-->
<!-- <serverId>ossrh</serverId>-->
<!-- <nexusUrl>https://oss.sonatype.org/</nexusUrl>-->
<!-- <autoReleaseAfterClose>true</autoReleaseAfterClose>-->
<!-- </configuration>-->
<!-- </plugin>-->
</plugins>
</build>

Expand Down
24 changes: 12 additions & 12 deletions cola-components/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.60</version>
<version>1.2.70</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -154,17 +154,17 @@
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.sonatype.plugins</groupId>-->
<!-- <artifactId>nexus-staging-maven-plugin</artifactId>-->
<!-- <version>1.6.8</version>-->
<!-- <extensions>true</extensions>-->
<!-- <configuration>-->
<!-- <serverId>ossrh</serverId>-->
<!-- <nexusUrl>https://oss.sonatype.org/</nexusUrl>-->
<!-- <autoReleaseAfterClose>true</autoReleaseAfterClose>-->
<!-- </configuration>-->
<!-- </plugin>-->
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>craftsman-controller</artifactId>
<artifactId>craftsman-adapter</artifactId>
<packaging>jar</packaging>
<name>craftsman-controller</name>
<name>craftsman-adapter</name>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.alibaba.craftsman.controller;
package com.alibaba.craftsman.web;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.Response;
Expand Down
4 changes: 4 additions & 0 deletions samples/craftsman/craftsman-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<name>craftsman-app</name>

<dependencies>
<dependency>
<groupId>com.alibaba.cola</groupId>
<artifactId>cola-component-catchlog-starter</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.craftsman</groupId>
<artifactId>craftsman-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import com.alibaba.cola.dto.Response;
import com.alibaba.cola.exception.Assert;
import com.alibaba.cola.logger.Logger;
import com.alibaba.cola.logger.LoggerFactory;
import com.alibaba.craftsman.domain.metrics.SubMetric;
import com.alibaba.craftsman.domain.metrics.appquality.AppMetric;
import com.alibaba.craftsman.domain.metrics.appquality.AppQualityMetric;
Expand All @@ -13,7 +11,6 @@
import com.alibaba.craftsman.domain.metrics.techinfluence.InfluenceMetric;
import com.alibaba.craftsman.domain.user.UserProfile;
import com.alibaba.craftsman.dto.RefreshScoreCmd;
import com.alibaba.craftsman.event.handler.MetricItemCreatedHandler;
import com.alibaba.craftsman.domain.gateway.MetricGateway;
import com.alibaba.craftsman.domain.gateway.UserProfileGateway;
import org.springframework.stereotype.Component;
Expand All @@ -23,7 +20,6 @@

@Component
public class RefreshScoreCmdExe{
private Logger logger = LoggerFactory.getLogger(MetricItemCreatedHandler.class);

@Resource
private UserProfileGateway userProfileGateway;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public MultiResponse<ATAMetricCO> execute(ATAMetricQry cmd) {
ataMetricCO.setOwnerId(metricDO.getUserId());
ataMetricCOList.add(ataMetricCO);
});
return MultiResponse.ofWithoutTotal(ataMetricCOList);
return MultiResponse.of(ataMetricCOList);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public MultiResponse<UserProfileCO> execute(UserProfileListQry qry) {
BeanUtils.copyProperties(userDO, userProfileCO);
userProfileCOList.add(userProfileCO);
});
return MultiResponse.ofWithoutTotal(userProfileCOList);
return MultiResponse.of(userProfileCOList);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
package com.alibaba.craftsman.event.handler;


import com.alibaba.cola.catchlog.CatchAndLog;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.logger.Logger;
import com.alibaba.cola.logger.LoggerFactory;
import com.alibaba.craftsman.api.UserProfileServiceI;
import com.alibaba.craftsman.dto.RefreshScoreCmd;
import com.alibaba.craftsman.dto.domainevent.MetricItemCreatedEvent;
import org.springframework.beans.factory.annotation.Autowired;

@CatchAndLog
public class MetricItemCreatedHandler {

private Logger logger = LoggerFactory.getLogger(MetricItemCreatedHandler.class);

@Autowired
private UserProfileServiceI userProfileService;

public Response execute(MetricItemCreatedEvent event) {
logger.debug("Handling Event: " + event);
RefreshScoreCmd cmd = new RefreshScoreCmd(event.getUserId());
userProfileService.refreshScore(cmd);
return Response.buildSuccess();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.alibaba.craftsman.service;

import com.alibaba.cola.catchlog.CatchAndLog;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.craftsman.api.MetricsServiceI;
Expand All @@ -18,6 +19,7 @@
* @date 2019-03-01 11:41 AM
*/
@Service
@CatchAndLog
public class MetricsServiceImpl implements MetricsServiceI{

@Resource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.alibaba.craftsman.service;

import com.alibaba.cola.catchlog.CatchAndLog;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
Expand All @@ -22,6 +23,7 @@
* @date 2019-02-28 6:22 PM
*/
@Service
@CatchAndLog
public class UserProfileServiceImpl implements UserProfileServiceI{
@Resource
private UserProfileAddCmdExe userProfileAddCmdExe;
Expand Down
4 changes: 2 additions & 2 deletions samples/craftsman/craftsman-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

<dependencies>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>cola-common</artifactId>
<groupId>com.alibaba.cola</groupId>
<artifactId>cola-component-dto</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down
12 changes: 10 additions & 2 deletions samples/craftsman/craftsman-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@
<dependencies>
<!-- COLA Framework -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>cola-core</artifactId>
<groupId>com.alibaba.cola</groupId>
<artifactId>cola-component-dto</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cola</groupId>
<artifactId>cola-component-domain-starter</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cola</groupId>
<artifactId>cola-component-exception</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.craftsman</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.alibaba.craftsman.domain.metrics;


import com.alibaba.cola.domain.EntityObject;
import com.alibaba.cola.domain.Entity;
import com.alibaba.craftsman.domain.user.UserProfile;
import lombok.Getter;
import lombok.Setter;
Expand All @@ -12,7 +12,8 @@
* @author Frank Zhang
* @date 2018-07-04 1:23 PM
*/
public abstract class Metric extends EntityObject implements Measurable{
@Entity
public abstract class Metric implements Measurable{

private double score;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.alibaba.craftsman.domain.metrics;

import com.alibaba.cola.domain.EntityObject;
import com.alibaba.cola.logger.Logger;
import com.alibaba.cola.logger.LoggerFactory;
import com.alibaba.cola.domain.Entity;
import com.alibaba.craftsman.domain.user.UserProfile;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
* MetricItem
Expand All @@ -15,9 +14,9 @@
* @date 2018-07-04 1:23 PM
*/
@Data
public abstract class MetricItem extends EntityObject implements Measurable{

private static Logger logger = LoggerFactory.getLogger(MetricItem.class);
@Entity
@Slf4j
public abstract class MetricItem implements Measurable{

/**
* The metric this MetricItem belongs to
Expand All @@ -41,7 +40,7 @@ public void setSubMetric(SubMetric subMetric){
*/
public String toJsonString() {
String jsonStr = JSON.toJSONString(this, JSONPropertyFilter.singleton);
logger.debug("\n From : " + this + " \n To: " + jsonStr);
log.debug("\n From : " + this + " \n To: " + jsonStr);
return jsonStr;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.alibaba.craftsman.domain.metrics.appquality;

import com.alibaba.cola.logger.Logger;
import com.alibaba.cola.logger.LoggerFactory;
import com.alibaba.craftsman.domain.metrics.MetricItem;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Data
@Slf4j
public class AppMetricItem extends MetricItem {
private final static Logger logger = LoggerFactory.getLogger(AppMetricItem.class);

private String appName;//应用名称
private int cyclomaticComplexityCount;//圈复杂度超标的数目
Expand All @@ -26,7 +25,7 @@ public double calculateScore() {
score = duductScore(score, duplicatedMethodCount);
score = duductScore(score, longMethodCount);
score = duductScore(score, blockedCodeConductCount);
logger.debug("Calculated App score is "+score );
log.debug("Calculated App score is "+score );
return score;
}

Expand All @@ -36,4 +35,4 @@ private double duductScore(double score, int count) {
}
return score;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.alibaba.craftsman.domain.metrics.techcontribution;

import com.alibaba.cola.logger.Logger;
import com.alibaba.cola.logger.LoggerFactory;
import com.alibaba.craftsman.domain.metrics.MainMetric;
import com.alibaba.craftsman.domain.metrics.MainMetricType;
import com.alibaba.craftsman.domain.user.UserProfile;
Expand All @@ -16,8 +14,6 @@
@Data
public class ContributionMetric extends MainMetric {

private static Logger logger = LoggerFactory.getLogger(ContributionMetric.class);

private CodeReviewMetric codeReviewMetric;
private RefactoringMetric refactoringMetric;
private MiscMetric miscMetric;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.alibaba.craftsman.domain.metrics.techinfluence;

import com.alibaba.cola.logger.Logger;
import com.alibaba.cola.logger.LoggerFactory;
import com.alibaba.craftsman.domain.metrics.MetricItem;
import com.alibaba.fastjson.JSON;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
* ATAMetricItem
Expand All @@ -13,10 +12,9 @@
* @date 2018-07-04 3:20 PM
*/
@Data
@Slf4j
public class ATAMetricItem extends MetricItem {

private static Logger logger = LoggerFactory.getLogger(ATAMetricItem.class);

private String authorId;//作者
private String title;//文章标题
private String url;//文章链接
Expand Down Expand Up @@ -51,13 +49,13 @@ public static ATAMetricItem valueOf(String json){

@Override
public double calculateScore() {
logger.debug("calculate score for : " + this);
log.debug("calculate score for : " + this);
double score = BASIC_SCORE;
score = addScoreByHitCount(score);
score = addScoreByThumbsupCount(score);
score = addScoreByFavoriteCount(score);
score = addScoreByCommentCount(score);
logger.debug("calculated score is : " + score);
log.debug("calculated score is : " + score);
return score;
}

Expand Down
Loading

0 comments on commit 388f9a3

Please sign in to comment.