Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions .github/workflows/pruebas.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
name: Flujo de trabajo para ejecutar los test
on:
workflow_dispatch:
push:
branches: [ V.0.2 ]
pull_request:
branches: [ V.0.2 ]
schedule:
- cron: '1 23 * * 0-4'
jobs:
Build:
build-and-test:
runs-on: ubuntu-latest
env:
GITHUB_LOGIN: ${{ github.actor }}
GITHUB_PACKAGES: ${{ secrets.GHTOKEN }}
GITHUB_OAUTH: ${{ secrets.GHTOKEN }}
steps:
- name: Clonando el repositorio y estableciendo el espacio de trabajo
- name: Checkout del código
uses: actions/checkout@v3
- name: Configurando java

- name: Configurar Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '16'
- name: Construyendo y probando el código

- name: Ejecutar build y test
run: |
chmod +x gradlew
./gradlew build
chmod +x gradlew
./gradlew build test
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ignore Gradle project-specific cache directory
.gradle
#No quiero subir el fichero de configuraci�n de gradle, porque contiene secretos
#No quiero subir el fichero de configuraci�n de gradle, porque contiene secretos
gradle.properties
#Ignoro los directorios que crea el IDE en el espacio de trabajo, que no se suba a git
.settings
Expand All @@ -17,6 +17,7 @@ bin

# Ignorar el fichero de propiedades de gradle, porque tienen datos personales
gradle.properties
config.properties


# Compiled class file
Expand All @@ -38,6 +39,6 @@ gradle.properties



#las pruebas har�n generar informes excel, que no quiero subir al repositorio remoto
#las pruebas har�n generar informes excel, que no quiero subir al repositorio remoto
*.xls
/javadoc.xml
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,30 @@ publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/mit-fs/audit4improve-api")
url = uri("https://maven.pkg.github.com/androdfer1/audit4improve-api")
credentials {
//las propiedades gpr.user y gpr.key están configuradas en gradle.properties en el raiz del proyecto, y se añade a .gitignore para que no se suban
//O bien configuro las variables de entorno GITHUB_LOGIN y GITHUB_PACKAGES
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_LOGIN")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_PACKAGES")

}
}
}
publications {
gpr(MavenPublication) {
//Del tutorial https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven

groupId = 'us.mitfs.samples'
artifactId = 'a4i'
version = '0.2'
groupId = 'com.androdfer1'
artifactId = 'audit4improve-api'
version = '0.0.1-androdfer1'

from components.java
}

}
}
version = '0.2'
version = '0.0.1-androdfer1'
//group = 'us.mitfs.samples'
tasks.withType(JavaCompile) {
//Añadir la opción Xlint
Expand Down
16 changes: 16 additions & 0 deletions gradle-prueba/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
String nombre

tasks.register('dependiente') {
/*dependsOn 'independiente'*/
doLast {
println "Su nombre es: $nombre"
}
}

tasks.register('independiente') {
doLast {
nombre = 'Isabel'
println "El nombre original es: $nombre"
println "En mayúsculas: ${nombre.toUpperCase()}"
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
47 changes: 47 additions & 0 deletions src/main/java/us/muit/fs/a4i/control/IndicatorStrategyEquipo4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package us.muit.fs.a4i.control;

import java.util.Arrays;
import java.util.List;

import us.muit.fs.a4i.exceptions.NotAvailableMetricException;
import us.muit.fs.a4i.model.entities.ReportItemI;
import us.muit.fs.a4i.model.entities.impl.SimpleReportItem;

public class IndicatorStrategyEquipo4 implements IndicatorStrategy<Double> {

private static final String M1 = "issue_response_time";
private static final String M2 = "issues_without_response_ratio";
private static final String M3 = "resolved_under_48h_ratio";
private static final String INDICATOR_NAME = "issue_management_speed";

@Override
public ReportItemI<Double> calcIndicator(List<ReportItemI<Double>> metrics) throws NotAvailableMetricException {
Double m1 = null, m2 = null, m3 = null;

for (ReportItemI<Double> metric : metrics) {
switch (metric.getName()) {
case M1:
m1 = metric.getValue();
break;
case M2:
m2 = metric.getValue();
break;
case M3:
m3 = metric.getValue();
break;
}
}

if (m1 == null || m2 == null || m3 == null) {
throw new NotAvailableMetricException("Faltan métricas necesarias para calcular el indicador.");
}

double resultado = (m1 + m2 + m3) / 3.0;
return new SimpleReportItem(INDICATOR_NAME, resultado);
}

@Override
public List<String> requiredMetrics() {
return Arrays.asList(M1, M2, M3);
}
}
7 changes: 0 additions & 7 deletions src/main/java/us/muit/fs/a4i/model/entities/ReportI.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,4 @@ public static enum ReportType {

void addIndicator(ReportItemI newIndicator);

/**
* Calcula un indicador a partir de su nombre y lo añade al informe Si se basa
* en métricas que no están aún incluidas en el informe las incluye
*
* @param name Nombre del indicador que se quiere calcular
*/

}
64 changes: 64 additions & 0 deletions src/main/java/us/muit/fs/a4i/model/entities/impl/SimpleReport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package us.muit.fs.a4i.model.entities.impl;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import us.muit.fs.a4i.model.entities.ReportI;
import us.muit.fs.a4i.model.entities.ReportItemI;

public class SimpleReport implements ReportI {

private String entityId;
private ReportType type;

private Map<String, ReportItemI> metrics = new HashMap<>();
private Map<String, ReportItemI> indicators = new HashMap<>();

public SimpleReport(String entityId, ReportType type) {
this.entityId = entityId;
this.type = type;
}

@Override
public ReportType getType() {
return type;
}

@Override
public String getEntityId() {
return entityId;
}

@Override
public ReportItemI getMetricByName(String name) {
return metrics.get(name);
}

@Override
public Collection<ReportItemI> getAllMetrics() {
return metrics.values();
}

@Override
public void addMetric(ReportItemI metric) {
metrics.put(metric.getName(), metric);
}

@Override
public ReportItemI getIndicatorByName(String name) {
return indicators.get(name);
}

@Override
public Collection<ReportItemI> getAllIndicators() {
return indicators.values();
}

@Override
public void addIndicator(ReportItemI newIndicator) {
indicators.put(newIndicator.getName(), newIndicator);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package us.muit.fs.a4i.model.entities.impl;

import us.muit.fs.a4i.model.entities.ReportItemI;
import us.muit.fs.a4i.model.entities.IndicatorI;

import java.util.Date;

public class SimpleReportItem implements ReportItemI<Double> {

private String name;
private Double value;
private Date date;
private String description;
private String source;
private String unit;
private IndicatorI indicator;

public SimpleReportItem(String name, Double value) {
this.name = name;
this.value = value;
this.date = new Date(); // asignamos la fecha actual por defecto
}

public SimpleReportItem(String name, Double value, String description, String source, String unit) {
this.name = name;
this.value = value;
this.description = description;
this.source = source;
this.unit = unit;
this.date = new Date();
}

@Override
public String getName() {
return name;
}

@Override
public Double getValue() {
return value;
}

@Override
public Date getDate() {
return date;
}

@Override
public String getDescription() {
return description;
}

@Override
public String getSource() {
return source;
}

@Override
public String getUnit() {
return unit;
}

@Override
public IndicatorI getIndicator() {
return indicator;
}

// Setter si necesitamos añadir el indicador más tarde
public void setIndicator(IndicatorI indicator) {
this.indicator = indicator;
}
}
Loading