Nantes Université

Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider 7f1c68fd rédigé par Féry Mathieu (Mathius)'s avatar Féry Mathieu (Mathius)
Parcourir les fichiers

feat(datastore): Add endpoint for reset on dev

This option is available only if datastore emulated are attached
parent 7fa0789c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #34319 réussi
......@@ -10,7 +10,8 @@ import org.springframework.context.annotation.PropertySources;
* Class represent main app of Server
*/
@SpringBootApplication
@PropertySources(value = { @PropertySource("classpath:springdoc.properties") })
@PropertySources(value = { @PropertySource("classpath:springdoc.properties"),
@PropertySource("classpath:datastore.properties") })
public class App extends SpringBootServletInitializer {
public static void main(String[] args) {
......
package fr.univnantes.webandcloud.api.controllers;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import fr.univnantes.webandcloud.api.services.ServiceUsingDatastore;
@ConditionalOnProperty("datastore.emulated")
@RestController()
@RequestMapping("/datastore")
public class DatastoreController extends ServiceUsingDatastore {
@RequestMapping(value = "/reset", method = RequestMethod.GET)
public void reset() {
datastoreService.reset();
}
}
......@@ -71,6 +71,15 @@ public class DatastoreService implements SmartLifecycle {
return null;
}
public void reset() {
if (testing)
try {
localDatastore.reset();
} catch (IOException e) {
throw new RuntimeException("Error on reset of emulted datastore", e);
}
}
public Datastore getDatastore() {
if (datastore == null) {
logger.info("Init Datastore");
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter