#78 - Add Dummy

This commit is contained in:
alexandra 2022-12-22 15:53:08 +04:00
parent 4de0e37902
commit 33e426e7f5
12 changed files with 180 additions and 30 deletions

View File

@ -1,19 +1,24 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class AuthorsCommitTS extends AbstractTimeSeriesCreator { public class AuthorsCommitTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public AuthorsCommitTS(TimeSeriesService timeSeriesService) { private final GitRepositoryService gitRepositoryService;
public AuthorsCommitTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
@ -23,7 +28,14 @@ public class AuthorsCommitTS extends AbstractTimeSeriesCreator {
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
return new ArrayList<TimeSeries>(); return Collections.singletonList(
new TimeSeries(
String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(),
branchName,
getTimeSeriesType().getDescription()),
getTimeSeriesType(),
Dummy.getDefaultTimeSeries()));
} }
@Override @Override

View File

@ -1,24 +1,37 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class AuthorsCompletedIssueTS extends AbstractTimeSeriesCreator { public class AuthorsCompletedIssueTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public AuthorsCompletedIssueTS(TimeSeriesService timeSeriesService) { private final GitRepositoryService gitRepositoryService;
public AuthorsCompletedIssueTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
return new ArrayList<>(); return Collections.singletonList(
new TimeSeries(
String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(),
branchName,
getTimeSeriesType().getDescription()),
getTimeSeriesType(),
Dummy.getDefaultTimeSeries()));
} }
@Override @Override

View File

@ -1,24 +1,36 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class AuthorsIssueTS extends AbstractTimeSeriesCreator { public class AuthorsIssueTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public AuthorsIssueTS(TimeSeriesService timeSeriesService) { private final GitRepositoryService gitRepositoryService;
public AuthorsIssueTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
return new ArrayList<TimeSeries>(); return Collections.singletonList(
new TimeSeries(
String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(),
branchName,
getTimeSeriesType().getDescription()),
getTimeSeriesType(),
Dummy.getDefaultTimeSeries()));
} }
@Override @Override

View File

@ -1,19 +1,24 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class BranchTS extends AbstractTimeSeriesCreator { public class BranchTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public BranchTS(TimeSeriesService timeSeriesService) { private final GitRepositoryService gitRepositoryService;
public BranchTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
@ -23,7 +28,14 @@ public class BranchTS extends AbstractTimeSeriesCreator {
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
return new ArrayList<>(); return Collections.singletonList(
new TimeSeries(
String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(),
branchName,
getTimeSeriesType().getDescription()),
getTimeSeriesType(),
Dummy.getDefaultTimeSeries()));
} }
@Override @Override

View File

@ -1,24 +1,36 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class ClassTS extends AbstractTimeSeriesCreator { public class ClassTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public ClassTS(TimeSeriesService timeSeriesService) { private final GitRepositoryService gitRepositoryService;
public ClassTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
return new ArrayList<TimeSeries>(); return Collections.singletonList(
new TimeSeries(
String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(),
branchName,
getTimeSeriesType().getDescription()),
getTimeSeriesType(),
Dummy.getDefaultTimeSeries()));
} }
@Override @Override

View File

@ -1,24 +1,36 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class DependenceTS extends AbstractTimeSeriesCreator { public class DependenceTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public DependenceTS(TimeSeriesService timeSeriesService) { private final GitRepositoryService gitRepositoryService;
public DependenceTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
return new ArrayList<TimeSeries>(); return Collections.singletonList(
new TimeSeries(
String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(),
branchName,
getTimeSeriesType().getDescription()),
getTimeSeriesType(),
Dummy.getDefaultTimeSeries()));
} }
@Override @Override

View File

@ -1,24 +1,36 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class InterfaceTS extends AbstractTimeSeriesCreator { public class InterfaceTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public InterfaceTS(TimeSeriesService timeSeriesService) { private final GitRepositoryService gitRepositoryService;
public InterfaceTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
return new ArrayList<TimeSeries>(); return Collections.singletonList(
new TimeSeries(
String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(),
branchName,
getTimeSeriesType().getDescription()),
getTimeSeriesType(),
Dummy.getDefaultTimeSeries()));
} }
@Override @Override

View File

@ -1,24 +1,36 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class IssuesTS extends AbstractTimeSeriesCreator { public class IssuesTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public IssuesTS(TimeSeriesService timeSeriesService) { private final GitRepositoryService gitRepositoryService;
public IssuesTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
return new ArrayList<>(); return Collections.singletonList(
new TimeSeries(
String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(),
branchName,
getTimeSeriesType().getDescription()),
getTimeSeriesType(),
Dummy.getDefaultTimeSeries()));
} }
@Override @Override

View File

@ -1,24 +1,36 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class ProcessTS extends AbstractTimeSeriesCreator { public class ProcessTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public ProcessTS(TimeSeriesService timeSeriesService) { private final GitRepositoryService gitRepositoryService;
public ProcessTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
return new ArrayList<>(); return Collections.singletonList(
new TimeSeries(
String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(),
branchName,
getTimeSeriesType().getDescription()),
getTimeSeriesType(),
Dummy.getDefaultTimeSeries()));
} }
@Override @Override

View File

@ -1,24 +1,37 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class StarTS extends AbstractTimeSeriesCreator { public class StarTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public StarTS(TimeSeriesService timeSeriesService) { private final GitRepositoryService gitRepositoryService;
public StarTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
return new ArrayList<>(); return Collections.singletonList(
new TimeSeries(
String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(),
branchName,
getTimeSeriesType().getDescription()),
getTimeSeriesType(),
Dummy.getDefaultTimeSeries()));
} }
@Override @Override

View File

@ -0,0 +1,13 @@
package ru.ulstu.extractor.ts.util;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
public class DateUtils {
public static Date addMonths(int amount) {
Calendar c = GregorianCalendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, amount);
return c.getTime();
}
}

View File

@ -0,0 +1,15 @@
package ru.ulstu.extractor.ts.util;
import ru.ulstu.extractor.ts.model.TimeSeriesValue;
import java.util.List;
public class Dummy {
public static List<TimeSeriesValue> getDefaultTimeSeries (){
return List.of(new TimeSeriesValue(DateUtils.addMonths(-5), 1.0),
new TimeSeriesValue(DateUtils.addMonths(-4), 2.0),
new TimeSeriesValue(DateUtils.addMonths(-3), 3.0),
new TimeSeriesValue(DateUtils.addMonths(-2), 4.0),
new TimeSeriesValue(DateUtils.addMonths(-1), 5.0));
}
}