From cdf28d792051069c7e9408d3d71dc8dfb364863e Mon Sep 17 00:00:00 2001 From: nt Date: Mon, 13 Nov 2023 18:23:15 +0100 Subject: [PATCH] performed some code cleanup --- .../ProfileStatisticsController.java | 46 ++----------------- .../de/hbt/pwr/model/SimRank/ProfileNode.java | 9 +--- .../pwr/model/SimRank/ProfileSimilarity.java | 6 +-- .../de/hbt/pwr/model/SimRank/SkillNode.java | 9 +--- .../pwr/model/SimRank/SkillSimilarity.java | 6 +-- .../de/hbt/pwr/model/StatisticsConfig.java | 9 ---- .../clustering/ConsultantClusteringInfo.java | 8 ++-- .../model/clustering/ProfilePrototype.java | 16 +++---- .../pwr/model/clustering/SkillWrapper.java | 6 +-- .../model/profile/entries/CareerElement.java | 8 ---- .../de/hbt/pwr/repo/StatisticsConfigRepo.java | 10 ---- .../pwr/service/AsyncInformationService.java | 17 ++----- .../de/hbt/pwr/service/StatisticsService.java | 23 ++-------- .../statistics/ProfileKMedoidClusterer.java | 18 ++++---- .../java/de/hbt/pwr/statistics/SimRank.java | 5 +- .../hbt/pwr/StatisticsApplicationTests.java | 13 ------ .../de/hbt/pwr/statistics/SimRankTest.java | 2 +- 17 files changed, 44 insertions(+), 167 deletions(-) delete mode 100644 src/main/java/de/hbt/pwr/repo/StatisticsConfigRepo.java delete mode 100644 src/test/java/de/hbt/pwr/StatisticsApplicationTests.java diff --git a/src/main/java/de/hbt/pwr/controller/ProfileStatisticsController.java b/src/main/java/de/hbt/pwr/controller/ProfileStatisticsController.java index 8fa0806..d7bdd78 100644 --- a/src/main/java/de/hbt/pwr/controller/ProfileStatisticsController.java +++ b/src/main/java/de/hbt/pwr/controller/ProfileStatisticsController.java @@ -3,10 +3,8 @@ import de.hbt.pwr.model.*; import de.hbt.pwr.model.clustering.ClusteredNetwork; import de.hbt.pwr.model.clustering.ConsultantClusteringInfo; -import de.hbt.pwr.model.clustering.MetricType; import de.hbt.pwr.model.profile.Consultant; import de.hbt.pwr.model.profile.NameEntityType; -import de.hbt.pwr.service.AsyncInformationService; import de.hbt.pwr.service.StatisticsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -29,24 +27,10 @@ public class ProfileStatisticsController { private final StatisticsService statisticsService; - private final AsyncInformationService asyncInformationService; - @Autowired - public ProfileStatisticsController(StatisticsService statisticsService, AsyncInformationService asyncInformationService) { + public ProfileStatisticsController(StatisticsService statisticsService) { this.statisticsService = statisticsService; - this.asyncInformationService = asyncInformationService; - } - - @RequestMapping(value = "", method = RequestMethod.HEAD) - public ResponseEntity available() { - return ResponseEntity.noContent().build(); - } - - @RequestMapping(value = "", method = RequestMethod.POST) - public ResponseEntity refresh() { - asyncInformationService.invokeConsultantDataRefresh(); - return ResponseEntity.noContent().build(); } @RequestMapping(value = "/skill/usage/absolute", produces = "application/json") @@ -69,11 +53,6 @@ public ResponseEntity> getRelativeMostUsedSkills(Intege return ResponseEntity.ok(statisticsService.getRelativeMostUsedSkills(maxSkills)); } - @RequestMapping(value = "/skill/common", produces = "application/json") - public ResponseEntity> getCommonSkills() { - return ResponseEntity.ok(statisticsService.getCommonSkills()); - } - @RequestMapping(value = "/skill/common/{initials}", produces = "application/json") public ResponseEntity>> getProfileSkillMetrics(@PathVariable("initials") String initials) { List common = new ArrayList<>(); @@ -95,23 +74,6 @@ public ResponseEntity getClusteredNetwork() { return ResponseEntity.ok(statisticsService.getClusteredNetwork()); } - /** - * Updates the parameters for the clustering process that is automated and invokes a re-clustering - * @param iterations the amount of iterations used for the k-medoid algorithm - * @param clusters the amount of expected clusters - * @param metric type to be used - * @return the newly clustered network. - */ - @RequestMapping(value = "/network/kmed", produces = "application/json", method = RequestMethod.POST) - public ResponseEntity updateClusteredNetworkParams( - @RequestParam(value = "iterations", required = true) Integer iterations, - @RequestParam(value = "clusters", required = true) Integer clusters, - @RequestParam(value = "metric", required = true) MetricType metric - ) { - statisticsService.updateConfigAndRenewNetwork(iterations, clusters, metric); - return ResponseEntity.ok(statisticsService.getClusteredNetwork()); - } - @RequestMapping(value = "/network/consultant/{initials}", produces = "application/json") public ResponseEntity getConsultantClusteringInfo(@PathVariable("initials") String initials){ return ResponseEntity.ok(statisticsService.getConsultantInfo(initials)); @@ -119,15 +81,15 @@ public ResponseEntity getConsultantClusteringInfo(@Pat @GetMapping(value = "/entries/referencing", produces = "application/json") public ResponseEntity> getConsultantsReferencingNameEntity( - @RequestParam(value = "name-entity", required = true) String nameEntityName, - @RequestParam(value = "type", required = true) NameEntityType type) { + @RequestParam(value = "name-entity") String nameEntityName, + @RequestParam(value = "type") NameEntityType type) { List consultantLost = statisticsService.getAllConsultantsReferencingNameEntity(nameEntityName, type); return ResponseEntity.ok(consultantLost.stream().map(ConsultantInfo::new).collect(Collectors.toList())); } @GetMapping(value = "/skill/referencing", produces = "application/json") public ResponseEntity> getConsultantsReferencingSkill( - @RequestParam(value = "skill", required = true) String skillName) { + @RequestParam(value = "skill") String skillName) { List consultants = statisticsService.getAllConsultantsReferencingSkill(skillName); return ResponseEntity.ok(consultants.stream().map(ConsultantInfo::new).collect(Collectors.toList())); } diff --git a/src/main/java/de/hbt/pwr/model/SimRank/ProfileNode.java b/src/main/java/de/hbt/pwr/model/SimRank/ProfileNode.java index ba6b736..6dc89b4 100644 --- a/src/main/java/de/hbt/pwr/model/SimRank/ProfileNode.java +++ b/src/main/java/de/hbt/pwr/model/SimRank/ProfileNode.java @@ -4,11 +4,13 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import de.hbt.pwr.model.profile.Profile; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import java.util.HashSet; import java.util.Set; +@NoArgsConstructor public class ProfileNode { @Getter @@ -20,17 +22,10 @@ public class ProfileNode { @JsonIgnore private Set skillNodes = new HashSet<>(); - public ProfileNode() { - } - public ProfileNode(Profile profile) { this.profileId = profile.getId(); } - /** - * Adds a skill node and also adds the skill nodes reference to this profile node to the skill node. - * @param skillNode - */ public void addSkillNode(SkillNode skillNode) { skillNodes.add(skillNode); skillNode.addProfileNode(this); diff --git a/src/main/java/de/hbt/pwr/model/SimRank/ProfileSimilarity.java b/src/main/java/de/hbt/pwr/model/SimRank/ProfileSimilarity.java index 80032e7..0009737 100644 --- a/src/main/java/de/hbt/pwr/model/SimRank/ProfileSimilarity.java +++ b/src/main/java/de/hbt/pwr/model/SimRank/ProfileSimilarity.java @@ -4,10 +4,10 @@ @Value public class ProfileSimilarity { - private ProfileNode node1; - private ProfileNode node2; + ProfileNode node1; + ProfileNode node2; - private double simVal; + double simVal; public ProfileSimilarity(ProfileNode node1, ProfileNode node2, double simVal) { this.node1 = node1; diff --git a/src/main/java/de/hbt/pwr/model/SimRank/SkillNode.java b/src/main/java/de/hbt/pwr/model/SimRank/SkillNode.java index 19a04c4..dc81ca2 100644 --- a/src/main/java/de/hbt/pwr/model/SimRank/SkillNode.java +++ b/src/main/java/de/hbt/pwr/model/SimRank/SkillNode.java @@ -2,11 +2,13 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import java.util.HashSet; import java.util.Set; +@NoArgsConstructor public class SkillNode { @Getter @@ -18,17 +20,10 @@ public class SkillNode { @JsonIgnore private Set profileNodes = new HashSet<>(); - public SkillNode() { - } - public SkillNode(String skillName) { this.skillName = skillName; } - /** - * Adds the profile node as backreference - * @param profileNode - */ public void addProfileNode(ProfileNode profileNode) { profileNodes.add(profileNode); } diff --git a/src/main/java/de/hbt/pwr/model/SimRank/SkillSimilarity.java b/src/main/java/de/hbt/pwr/model/SimRank/SkillSimilarity.java index d04c33a..bdb97f9 100644 --- a/src/main/java/de/hbt/pwr/model/SimRank/SkillSimilarity.java +++ b/src/main/java/de/hbt/pwr/model/SimRank/SkillSimilarity.java @@ -4,10 +4,10 @@ @Value public class SkillSimilarity { - private SkillNode node1; - private SkillNode node2; + SkillNode node1; + SkillNode node2; - private double simVal; + double simVal; public SkillSimilarity(SkillNode node1, SkillNode node2, double simVal) { this.node1 = node1; diff --git a/src/main/java/de/hbt/pwr/model/StatisticsConfig.java b/src/main/java/de/hbt/pwr/model/StatisticsConfig.java index ada217d..c41ba8c 100644 --- a/src/main/java/de/hbt/pwr/model/StatisticsConfig.java +++ b/src/main/java/de/hbt/pwr/model/StatisticsConfig.java @@ -2,10 +2,6 @@ import de.hbt.pwr.model.clustering.MetricType; import lombok.Data; -import org.springframework.data.annotation.Id; -import org.springframework.data.redis.core.RedisHash; - -@RedisHash("StatisticsConfig") @Data public class StatisticsConfig { @@ -14,12 +10,7 @@ public class StatisticsConfig { public static final Integer DEFAULT_CLUSTERS = 2; public static final MetricType DEFAULT_METRIC_TYPE = MetricType.SIM_RANK; - - @Id - private String id; - private Integer currentKMedIterations = DEFAULT_ITERATIONS; private Integer currentKMedClusters = DEFAULT_CLUSTERS; private MetricType currentMetricType = DEFAULT_METRIC_TYPE; - } diff --git a/src/main/java/de/hbt/pwr/model/clustering/ConsultantClusteringInfo.java b/src/main/java/de/hbt/pwr/model/clustering/ConsultantClusteringInfo.java index 1a3df19..588cee1 100644 --- a/src/main/java/de/hbt/pwr/model/clustering/ConsultantClusteringInfo.java +++ b/src/main/java/de/hbt/pwr/model/clustering/ConsultantClusteringInfo.java @@ -82,7 +82,7 @@ public void evaluate() { .filter(averagedSkill -> averagedSkill.getRelativeOccurance() >= 0.5) .map(AveragedSkill::getName) .collect(Collectors.toList()); - Set recommendationsSet = new HashSet(commonSkills); + Set recommendationsSet = new HashSet<>(commonSkills); recommendationsSet.removeAll(consultant.getProfile().getSkills().stream().map(Skill::getName).collect(Collectors.toSet())); recommendations = new ArrayList<>(recommendationsSet); } @@ -98,7 +98,7 @@ public void sort() { private static class AveragedSkill { @Getter - private String name; + private final String name; @Getter private int numOccurances; @@ -130,8 +130,8 @@ public int compareRelative(AveragedSkill a) { } public void calc() { - this.average = (double) totalRating / (double) numOccurances; + this.average = totalRating / (double) numOccurances; } } -} \ No newline at end of file +} diff --git a/src/main/java/de/hbt/pwr/model/clustering/ProfilePrototype.java b/src/main/java/de/hbt/pwr/model/clustering/ProfilePrototype.java index 471d455..2896361 100644 --- a/src/main/java/de/hbt/pwr/model/clustering/ProfilePrototype.java +++ b/src/main/java/de/hbt/pwr/model/clustering/ProfilePrototype.java @@ -1,7 +1,6 @@ package de.hbt.pwr.model.clustering; import lombok.Getter; -import lombok.Setter; import java.util.ArrayList; import java.util.HashSet; @@ -11,23 +10,22 @@ public class ProfilePrototype { - private static AtomicLong CURRENT_ID = new AtomicLong(); + private static final AtomicLong CURRENT_ID = new AtomicLong(); @Getter - @Setter - private String name; + private final String name; @Getter - private Long clusterId; + private final Long clusterId; @Getter - private Set skills = new HashSet<>(); + private final Set skills; /** * Used for evaluation */ @Getter - private List profileClusterables = new ArrayList<>(); + private final List profileClusterables = new ArrayList<>(); /** * List that keeps track of the currently assigned clusterables. @@ -77,9 +75,7 @@ public ProfilePrototype evaluate() { return empty(); } Set newSkills = new HashSet<>(profileClusterables.get(0).getValues()); - profileClusterables.forEach(profileClusterable -> { - newSkills.retainAll(profileClusterable.getValues()); - }); + profileClusterables.forEach(profileClusterable -> newSkills.retainAll(profileClusterable.getValues())); ProfilePrototype result = new ProfilePrototype(newSkills, name, clusterId); result.assignedClusterables = profileClusterables; return result; diff --git a/src/main/java/de/hbt/pwr/model/clustering/SkillWrapper.java b/src/main/java/de/hbt/pwr/model/clustering/SkillWrapper.java index d0344e1..37bcd06 100644 --- a/src/main/java/de/hbt/pwr/model/clustering/SkillWrapper.java +++ b/src/main/java/de/hbt/pwr/model/clustering/SkillWrapper.java @@ -4,7 +4,7 @@ public class SkillWrapper { - private Skill skill; + private final Skill skill; public Skill getSkill() { return skill; @@ -14,10 +14,6 @@ public SkillWrapper(Skill skill) { this.skill = skill; } - public SkillWrapper(String name) { - this.skill = new Skill(name, 0); - } - @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/src/main/java/de/hbt/pwr/model/profile/entries/CareerElement.java b/src/main/java/de/hbt/pwr/model/profile/entries/CareerElement.java index 92f1c58..e5fc269 100644 --- a/src/main/java/de/hbt/pwr/model/profile/entries/CareerElement.java +++ b/src/main/java/de/hbt/pwr/model/profile/entries/CareerElement.java @@ -12,14 +12,6 @@ abstract public class CareerElement extends ProfileEntry { public CareerElement() { } - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - public LocalDate getStartDate() { return startDate; } diff --git a/src/main/java/de/hbt/pwr/repo/StatisticsConfigRepo.java b/src/main/java/de/hbt/pwr/repo/StatisticsConfigRepo.java deleted file mode 100644 index 000f504..0000000 --- a/src/main/java/de/hbt/pwr/repo/StatisticsConfigRepo.java +++ /dev/null @@ -1,10 +0,0 @@ -package de.hbt.pwr.repo; - -import de.hbt.pwr.model.StatisticsConfig; -import org.springframework.data.repository.CrudRepository; - -/** - * Created by nt on 22.06.2017. - */ -public interface StatisticsConfigRepo extends CrudRepository { -} diff --git a/src/main/java/de/hbt/pwr/service/AsyncInformationService.java b/src/main/java/de/hbt/pwr/service/AsyncInformationService.java index d0d2b97..8fb7264 100644 --- a/src/main/java/de/hbt/pwr/service/AsyncInformationService.java +++ b/src/main/java/de/hbt/pwr/service/AsyncInformationService.java @@ -9,7 +9,6 @@ import de.hbt.pwr.model.profile.Consultant; import de.hbt.pwr.repo.ClusteredNetworkRepo; import de.hbt.pwr.repo.ConsultantRepository; -import de.hbt.pwr.repo.StatisticsConfigRepo; import de.hbt.pwr.statistics.KMedoidCommonSkillMetric; import de.hbt.pwr.statistics.KMedoidMetric; import de.hbt.pwr.statistics.KMedoidSimRankMetric; @@ -33,7 +32,6 @@ public class AsyncInformationService { private final ConsultantRepository consultantRepository; private final PowerProfileClient powerProfileClient; private final ClusteredNetworkRepo clusteredNetworkRepo; - private final StatisticsConfigRepo statisticsConfigRepo; private static final Logger LOG = LoggerFactory.getLogger(AsyncInformationService.class); @@ -41,16 +39,15 @@ public class AsyncInformationService { @Autowired public AsyncInformationService(ConsultantRepository consultantRepository, - PowerProfileClient powerProfileClient, ClusteredNetworkRepo clusteredNetworkRepo, StatisticsConfigRepo statisticsConfigRepo) { + PowerProfileClient powerProfileClient, ClusteredNetworkRepo clusteredNetworkRepo) { this.consultantRepository = consultantRepository; this.powerProfileClient = powerProfileClient; this.clusteredNetworkRepo = clusteredNetworkRepo; - this.statisticsConfigRepo = statisticsConfigRepo; } private StatisticsConfig getConfig() { - return StreamUtils.asStream(statisticsConfigRepo.findAll().iterator()).findFirst().get(); + return new StatisticsConfig(); // fixme@nt move this to config properties } @Async @@ -83,7 +80,7 @@ void refreshStatistics() { Map initialsByProfileId = new HashMap<>(); consultants.forEach(consultant -> initialsByProfileId.put(consultant.getProfile().getId(), consultant.getInitials())); - KMedoidMetric metric = null; + KMedoidMetric metric; // Create the metric switch (config.getCurrentMetricType()) { case SIM_RANK: @@ -110,20 +107,12 @@ void refreshStatistics() { old.forEach(clusteredNetworkRepo::deleteById); } - private void initConfigIfUninitialized() { - if(statisticsConfigRepo.count() <= 0) { - LOG.info("No Configuration stored in database. Storing default config."); - statisticsConfigRepo.save(new StatisticsConfig()); - } - } - /** * Invokes a refresh of the stored data */ @Scheduled(fixedRate = 60000L * 60L) public void invokeConsultantDataRefresh() { - initConfigIfUninitialized(); refreshConsultantData(); refreshStatistics(); } diff --git a/src/main/java/de/hbt/pwr/service/StatisticsService.java b/src/main/java/de/hbt/pwr/service/StatisticsService.java index 7d58ed9..4929ac9 100644 --- a/src/main/java/de/hbt/pwr/service/StatisticsService.java +++ b/src/main/java/de/hbt/pwr/service/StatisticsService.java @@ -1,15 +1,16 @@ package de.hbt.pwr.service; import de.hbt.pwr.StreamUtils; -import de.hbt.pwr.model.*; +import de.hbt.pwr.model.ConsultantSkillInfo; +import de.hbt.pwr.model.RelativeSkillUsage; +import de.hbt.pwr.model.SkillAverageRating; +import de.hbt.pwr.model.SkillUsage; import de.hbt.pwr.model.clustering.ClusteredNetwork; import de.hbt.pwr.model.clustering.ConsultantClusteringInfo; -import de.hbt.pwr.model.clustering.MetricType; import de.hbt.pwr.model.profile.*; import de.hbt.pwr.model.profile.entries.ProfileEntry; import de.hbt.pwr.repo.ClusteredNetworkRepo; import de.hbt.pwr.repo.ConsultantRepository; -import de.hbt.pwr.repo.StatisticsConfigRepo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -24,9 +25,6 @@ public class StatisticsService { private final ClusteredNetworkRepo clusteredNetworkRepo; - private final StatisticsConfigRepo statisticsConfigRepo; - - private final AsyncInformationService asyncInformationService; /** * Defines a threshold(percentage) that a skill needs to achieve to qualify as 'common' @@ -34,12 +32,9 @@ public class StatisticsService { private static final float COMMON_SKILL_THRESHOLD = 0.8f; @Autowired - public StatisticsService(ConsultantRepository consultantRepository, ClusteredNetworkRepo clusteredNetworkRepo, - StatisticsConfigRepo statisticsConfigRepo, AsyncInformationService asyncInformationService) { + public StatisticsService(ConsultantRepository consultantRepository, ClusteredNetworkRepo clusteredNetworkRepo) { this.consultantRepository = consultantRepository; this.clusteredNetworkRepo = clusteredNetworkRepo; - this.statisticsConfigRepo = statisticsConfigRepo; - this.asyncInformationService = asyncInformationService; } @@ -111,14 +106,6 @@ public ClusteredNetwork getClusteredNetwork() { return networkOptional.orElseThrow(() -> new RuntimeException("No network available.")); } - public void updateConfigAndRenewNetwork(Integer iterations, Integer clusters, MetricType metricType) { - StatisticsConfig config = statisticsConfigRepo.findAll().iterator().next(); - config.setCurrentKMedIterations(iterations); - config.setCurrentKMedClusters(clusters); - config.setCurrentMetricType(metricType); - statisticsConfigRepo.save(config); - asyncInformationService.invokeConsultantDataRefresh(); - } public ConsultantClusteringInfo getConsultantInfo(String initials) { ClusteredNetwork clusteredNetwork = clusteredNetworkRepo.findAll().iterator().next(); diff --git a/src/main/java/de/hbt/pwr/statistics/ProfileKMedoidClusterer.java b/src/main/java/de/hbt/pwr/statistics/ProfileKMedoidClusterer.java index bcc539a..f0c9ff8 100644 --- a/src/main/java/de/hbt/pwr/statistics/ProfileKMedoidClusterer.java +++ b/src/main/java/de/hbt/pwr/statistics/ProfileKMedoidClusterer.java @@ -16,9 +16,9 @@ public class ProfileKMedoidClusterer { - private int maxIterations = 10; + private final int maxIterations; - private Random random = new Random(); + private final Random random = new Random(); private final KMedoidMetric metric; @@ -42,7 +42,7 @@ public List cluster(List values, int clusters if(clusters > values.size()) { return Collections.emptyList(); } - List resultMedoids = new ArrayList<>(); + List resultMedoids; // Work on a copy of the list. List _values = new ArrayList<>(values); @@ -62,7 +62,7 @@ public List cluster(List values, int clusters } _values = valueCopies; _values.forEach(clusterable -> assignToFurthestMedoid(clusterable, initialMedoids)); - Double cost = sumCost(initialMedoids); + double cost = sumCost(initialMedoids); resultMedoids = initialMedoids; // Now, during each iteration, we'll grab a random medoid and a random value and swap them. @@ -84,7 +84,7 @@ public List cluster(List values, int clusters // Now, perform the calculation again. assignToMedoids(workValues, workMedoids); - Double newCost = sumCost(workMedoids); + double newCost = sumCost(workMedoids); if(newCost > cost) { // Good! Randomly found a better composition. Replace the old values _values = workValues; @@ -99,16 +99,16 @@ private void assignToMedoids(List values, List assignToFurthestMedoid(clusterable, medoids)); } - private Double sumCost(List medoids) { + private double sumCost(List medoids) { return medoids.stream().mapToDouble(ProfileMedoid::getCost).sum(); } private void assignToFurthestMedoid(ProfileClusterable clusterable, List medoids) { - Double distance = Double.MIN_VALUE; - Integer highestIndex = 0; + double distance = Double.MIN_VALUE; + int highestIndex = 0; for (int i = 0; i < medoids.size(); i++) { - Double currentDistance = metric.measure(clusterable, medoids.get(i)); + double currentDistance = metric.measure(clusterable, medoids.get(i)); if(currentDistance > distance) { distance = currentDistance; highestIndex = i; diff --git a/src/main/java/de/hbt/pwr/statistics/SimRank.java b/src/main/java/de/hbt/pwr/statistics/SimRank.java index a3261c0..47cbaf4 100644 --- a/src/main/java/de/hbt/pwr/statistics/SimRank.java +++ b/src/main/java/de/hbt/pwr/statistics/SimRank.java @@ -69,15 +69,12 @@ private ProfileSkillNetwork buildInitialRating(List profiles) { } } - - final ProfileSkillNetwork profileSkillNetwork = new ProfileSkillNetwork( + return new ProfileSkillNetwork( profileNodes, skillNodes, cartesianSkillNodes(skillNodes), cartesianProfileNodes(profileNodes) ); - - return profileSkillNetwork; } private double sumSimValues(ProfileSimilarity profileSimilarity, ProfileSkillNetwork network) { diff --git a/src/test/java/de/hbt/pwr/StatisticsApplicationTests.java b/src/test/java/de/hbt/pwr/StatisticsApplicationTests.java deleted file mode 100644 index e9228a6..0000000 --- a/src/test/java/de/hbt/pwr/StatisticsApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package de.hbt.pwr; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -public class StatisticsApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/src/test/java/de/hbt/pwr/statistics/SimRankTest.java b/src/test/java/de/hbt/pwr/statistics/SimRankTest.java index ed4c1e6..d501569 100644 --- a/src/test/java/de/hbt/pwr/statistics/SimRankTest.java +++ b/src/test/java/de/hbt/pwr/statistics/SimRankTest.java @@ -64,7 +64,7 @@ public void testBuildInitialRating() { assertThat(node.getSkillNodes()).containsExactlyInAnyOrder(new SkillNode("S2"), new SkillNode("S1")); // Now, check that back references work - node.getSkillNodes().forEach(skillNode -> assertThat(skillNode.getProfileNodes().contains(new ProfileNode(profile1)))); + node.getSkillNodes().forEach(skillNode -> assertThat(skillNode.getProfileNodes()).contains(new ProfileNode(profile1))); } @Test