Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
1 result

Target

Select target project
  • Noe Delcroix / m4102_tp3
  • Aymane Ismail / m4102_tp3
  • Baptiste Hardelin / m4102_tp3
  • Harold De buyst / m4102_tp3
  • Paul Daquin / m4102_tp3
  • Aurelien Brillet / m4102_tp3
  • Thomas Vantroys / m4102_tp3
  • Maxime Molines / m4102_tp3
  • Jessy Fanguimache / m4102_tp3
  • Tom Varingot / m4102_tp3
  • Thomas Tourdot / da2i_tp_rest
  • Remy Dekeister / da2i_tp_rest
  • Alban Sannier / m4102_tp3
  • Enzo Cocchi / m4102_tp3
  • Simon Prevost / m4102_tp3
  • Valentin Bout / m4102_tp3
  • Antoine Delaby / m4102_tp3
  • Rayd Tarafi / m4102_tp3
  • Hugo Dutoit / m4102_tp3
  • Antoine Delfosse / m4102_tp3
20 results
Select Git revision
  • master
1 result
Show changes

Commits on Source 18

17 files
+ 955
680
Compare changes
  • Side-by-side
  • Inline

Files

+3 −1
Original line number Original line Diff line number Diff line
@@ -206,5 +206,7 @@ local.properties
### VisualStudioCode Patch ###
### VisualStudioCode Patch ###
# Ignore all local history of files
# Ignore all local history of files
.history
.history

.project
.settings
.classpath
# End of https://www.gitignore.io/api/eclipse,visualstudiocode
# End of https://www.gitignore.io/api/eclipse,visualstudiocode
+585 −485

File changed.

Preview size limit exceeded, changes collapsed.

+157 −122
Original line number Original line Diff line number Diff line
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">


	<modelVersion>4.0.0</modelVersion>
	<modelVersion>4.0.0</modelVersion>


	<groupId>fr.ulille.iut.pizzaland</groupId>
	<groupId>fr.ulille.iut.pizzaland</groupId>
	<artifactId>pizzaland_jdbi</artifactId>
	<artifactId>pizzaland_jdbi</artifactId>
    <packaging>war</packaging>
	<packaging>jar</packaging>
	<version>1.0-SNAPSHOT</version>
	<version>1.0-SNAPSHOT</version>
    <name>pizzaland</name>
	<name>pizzaland_jdbi</name>

    <build>
        <finalName>pizzaland</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <inherited>true</inherited>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty-version}</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                </configuration>
            </plugin>
        </plugins>
    </build>


	<dependencyManagement>
	<dependencyManagement>
		<dependencies>
		<dependencies>
@@ -57,7 +23,7 @@
				<groupId>org.jdbi</groupId>
				<groupId>org.jdbi</groupId>
				<artifactId>jdbi3-bom</artifactId>
				<artifactId>jdbi3-bom</artifactId>
				<type>pom</type>
				<type>pom</type>
                <version>3.12.0</version>
				<version>${jdbi.version}</version>
				<scope>import</scope>
				<scope>import</scope>
			</dependency>
			</dependency>
		</dependencies>
		</dependencies>
@@ -66,63 +32,132 @@
	<dependencies>
	<dependencies>
		<dependency>
		<dependency>
			<groupId>org.glassfish.jersey.containers</groupId>
			<groupId>org.glassfish.jersey.containers</groupId>
            <!-- use the following artifactId if you don't need servlet 2.x compatibility -->
			<artifactId>jersey-container-grizzly2-http</artifactId>
            <artifactId>jersey-container-servlet</artifactId>
		</dependency>
		</dependency>
		<dependency>
		<dependency>
			<groupId>org.glassfish.jersey.inject</groupId>
			<groupId>org.glassfish.jersey.inject</groupId>
			<artifactId>jersey-hk2</artifactId>
			<artifactId>jersey-hk2</artifactId>
		</dependency>
		</dependency>
        <!-- uncomment this to get JSON support -->

		<!-- uncomment this to get JSON support: -->
		<dependency>
		<dependency>
			<groupId>org.glassfish.jersey.media</groupId>
			<groupId>org.glassfish.jersey.media</groupId>
			<artifactId>jersey-media-json-binding</artifactId>
			<artifactId>jersey-media-json-binding</artifactId>
		</dependency>
		</dependency>
		<!-- -->
		<!-- -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
		<dependency>
		<dependency>
			<groupId>org.glassfish.jersey.test-framework.providers</groupId>
			<groupId>org.glassfish.jersey.test-framework.providers</groupId>
            <artifactId>jersey-test-framework-provider-jetty</artifactId>
			<artifactId>jersey-test-framework-provider-grizzly2</artifactId>
            <version>2.30</version>
			<version>${jersey.version}</version>
		</dependency>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
		<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
		<dependency>
		<dependency>
			<groupId>org.xerial</groupId>
			<groupId>org.xerial</groupId>
			<artifactId>sqlite-jdbc</artifactId>
			<artifactId>sqlite-jdbc</artifactId>
            <version>3.30.1</version>
			<version>${sqlite-jdbc.version}</version>
		</dependency>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.jdbi/jdbi3-core -->
		<!-- https://mvnrepository.com/artifact/org.jdbi/jdbi3-core -->
		<dependency>
		<dependency>
			<groupId>org.jdbi</groupId>
			<groupId>org.jdbi</groupId>
			<artifactId>jdbi3-core</artifactId>
			<artifactId>jdbi3-core</artifactId>
            <version>3.12.0</version>
		</dependency>
		</dependency>
		<dependency>
		<dependency>
			<groupId>org.jdbi</groupId>
			<groupId>org.jdbi</groupId>
			<artifactId>jdbi3-sqlobject</artifactId>
			<artifactId>jdbi3-sqlobject</artifactId>
            <version>3.12.0</version>
		</dependency>
		</dependency>
		<dependency>
		<dependency>
			<groupId>org.jdbi</groupId>
			<groupId>org.jdbi</groupId>
			<artifactId>jdbi3-sqlite</artifactId>
			<artifactId>jdbi3-sqlite</artifactId>
            <version>3.12.0</version>
		</dependency>
		</dependency>
		<dependency>
		<dependency>
			<groupId>org.jdbi</groupId>
			<groupId>org.jdbi</groupId>
			<artifactId>jdbi3-testing</artifactId>
			<artifactId>jdbi3-testing</artifactId>
            <version>3.12.0</version>
			<version>3.27.1</version>
			<scope>test</scope>
			<scope>test</scope>
		</dependency>
		</dependency>
        <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
		<dependency>
		<dependency>
            <groupId>ch.qos.logback</groupId>
			<groupId>jakarta.xml.bind</groupId>
            <artifactId>logback-classic</artifactId>
			<artifactId>jakarta.xml.bind-api</artifactId>
            <version>1.2.3</version>
			<version>3.0.1</version>
		</dependency>
		<dependency>
			<groupId>com.sun.xml.bind</groupId>
			<artifactId>jaxb-impl</artifactId>
			<version>3.0.2</version>
			<scope>runtime</scope>
		</dependency>
		</dependency>
		<!-- dependency>
			<groupId></groupId>
			<artifactId></artifactId>
			<version></version>
		</dependency-->
	</dependencies>
	</dependencies>


	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.1</version>
				<inherited>true</inherited>
				<configuration>
					<release>11</release>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.2.1</version>
				<executions>
					<execution>
						<goals>
							<goal>java</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<mainClass>fr.ulille.iut.pizzaland.Main</mainClass>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<version>${shade.version}</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
						<configuration>
							<transformers>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
									<mainClass>fr.ulille.iut.pizzaland.Main</mainClass>
								</transformer>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
							</transformers>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<properties>
	<properties>
        <jersey.version>2.30</jersey.version>
		<jersey.version>3.0.3</jersey.version>
        <jetty-version>9.4.26.v20200117</jetty-version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<shade.version>3.2.4</shade.version>
		<lombok.version>1.18.16</lombok.version>
		<jdbi.version>3.27.0</jdbi.version>
		<sqlite-jdbc.version>3.36.0.3</sqlite-jdbc.version>
		<jaxb.version>2.4.0-b180830.0359</jaxb.version>
	</properties>
	</properties>
</project>
</project>
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@ import org.glassfish.jersey.server.ResourceConfig;


import java.util.logging.Logger;
import java.util.logging.Logger;


import javax.ws.rs.ApplicationPath;
import jakarta.ws.rs.ApplicationPath;


@ApplicationPath("api/v1/")
@ApplicationPath("api/v1/")
public class ApiV1 extends ResourceConfig {
public class ApiV1 extends ResourceConfig {
Original line number Original line Diff line number Diff line
@@ -3,30 +3,42 @@ package fr.ulille.iut.pizzaland;
import java.sql.DatabaseMetaData;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Properties;


import org.jdbi.v3.core.Handle;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.sqlite3.SQLitePlugin;
import org.jdbi.v3.sqlite3.SQLitePlugin;
import org.jdbi.v3.sqlobject.SqlObjectPlugin;
import org.jdbi.v3.sqlobject.SqlObjectPlugin;


import fr.ulille.iut.pizzaland.dao.UUIDArgumentFactory;

public class BDDFactory {
public class BDDFactory {
    private static Jdbi jdbi = null;
    private static Jdbi jdbi = null;
    private static String dbPath = "jdbc:sqlite:"
        + System.getProperty("java.io.tmpdir")
        + System.getProperty("file.separator")
        + System.getProperty("user.name")
        + "_";


    public static Jdbi getJdbi() {
    public static Jdbi getJdbi() {
        if ( jdbi == null ) {
        if ( jdbi == null ) {
            jdbi = Jdbi.create("jdbc:sqlite:"
            Properties properties = new Properties();
                + System.getProperty("java.io.tmpdir")
            properties.setProperty("foreign_keys", "true");
                + System.getProperty("file.separator") + "pizza.db")

            jdbi = Jdbi.create(dbPath + "pizzas.db", properties)
                .installPlugin(new SQLitePlugin())
                .installPlugin(new SQLitePlugin())
                .installPlugin(new SqlObjectPlugin());
                .installPlugin(new SqlObjectPlugin()).registerArgument(new UUIDArgumentFactory());
        }
        }
        return jdbi;
        return jdbi;
    }
    }


    public static void setJdbiForTests() {
    public static void setJdbiForTests() {
        if ( jdbi == null ) {
        if ( jdbi == null ) {
            jdbi = Jdbi.create("jdbc:sqlite:"
            Properties properties = new Properties();
                + System.getProperty("java.io.tmpdir")
            properties.setProperty("foreign_keys", "true");
                + System.getProperty("file.separator") + "pizza_test.db")

            jdbi = Jdbi.create(dbPath + "pizza_test.db", properties)
            .installPlugin(new SQLitePlugin())
            .installPlugin(new SQLitePlugin())
            .installPlugin(new SqlObjectPlugin());
            .installPlugin(new SqlObjectPlugin());
        }
        }
@@ -40,6 +52,17 @@ public class BDDFactory {
        return exist;
        return exist;
    }
    }


    public static void dropTables() throws SQLException {
        Handle handle = getJdbi().open();
        DatabaseMetaData dbm = handle.getConnection().getMetaData();
        ResultSet tables = dbm.getTables(null, null, "", null);
        ArrayList<String> tableNames = new ArrayList<String>();
        while ( tables.next() ) {
            tableNames.add(tables.getString("TABLE_NAME"));
        }
        tableNames.forEach(name -> handle.execute("drop table " + name));
    }

    public static <T> T buildDao(Class<T> daoClass) {
    public static <T> T buildDao(Class<T> daoClass) {
        return getJdbi().onDemand(daoClass);
        return getJdbi().onDemand(daoClass);
    }
    }
Original line number Original line Diff line number Diff line
package fr.ulille.iut.pizzaland;

import java.io.IOException;
import java.net.URI;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;

import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;

/**
 * Main class.
 *
 */
public class Main {
    // Base URI the Grizzly HTTP server will listen on
    public static final String BASE_URI = "http://localhost:8080/api/v1/";
    private static final LogManager logManager = LogManager.getLogManager();

    static {
        try {
            logManager.readConfiguration(Main.class.getClassLoader().getResourceAsStream("logging.properties"));
        }
        catch ( Exception ex ) {
            ex.printStackTrace();
        }
    }
    /**
     * Starts Grizzly HTTP server exposing JAX-RS resources defined in this
     * application.
     *
     * @return Grizzly HTTP server. 
     */
    public static HttpServer startServer() {
        // create a resource config that scans for JAX-RS resources and providers
        // in fr.ulille.iut.todo package

        /*        ResourceConfig rc = new ResourceConfig().packages("fr.ulille.iut.pizzaland");
        // Activation des log des requêtes et réponses
        String logging = System.getenv("LOG_MESSAGES");
        if ( logging != null && logging.equalsIgnoreCase("true") ) {
            rc.register(new LoggingFeature(Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), Level.INFO,
                                           LoggingFeature.Verbosity.PAYLOAD_ANY, 10000));
        }
        String debug = System.getenv("DEBUG_INTERNAL");
        if ( debug != null && debug.equalsIgnoreCase("true") ) {
            rc.register(DebugMapper.class);
            }*/
        // create and start a new instance of grizzly http server
        // exposing the Jersey application at BASE_URI
        return GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), new ApiV1());
    }

    /**
     * Main method.
     * 
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        final HttpServer server = startServer();
        System.out.println(String.format(
                "Jersey app started with WADL available at " + "%sapplication.wadl\nexport LOG_MESSAGES=true pour voir les requêtes et réponses\nexport DEBUG_INTERNAL=true pour voir les erreurs 500\nHit enter to stop it...",
                BASE_URI));
        System.in.read();
        server.stop();
    }
}
Original line number Original line Diff line number Diff line
package fr.ulille.iut.pizzaland.dao;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.UUID;

import org.jdbi.v3.core.argument.Argument;
import org.jdbi.v3.core.statement.StatementContext;

public class UUIDArgument implements Argument {
    private final UUID value;

    public UUIDArgument(UUID value) {
        this.value = value;
    }

    @Override
    public void apply(int position, PreparedStatement statement, StatementContext ctx) throws SQLException {
        statement.setString(position, value.toString());
    }
}
Original line number Original line Diff line number Diff line
package fr.ulille.iut.pizzaland.dao;

import java.sql.Types;
import java.util.UUID;

import org.jdbi.v3.core.argument.AbstractArgumentFactory;
import org.jdbi.v3.core.argument.Argument;
import org.jdbi.v3.core.config.ConfigRegistry;

public class UUIDArgumentFactory extends AbstractArgumentFactory<UUID> {
    public UUIDArgumentFactory() {
        super(Types.VARCHAR); 
    }

    @Override
    protected Argument build(UUID value, ConfigRegistry config) {
        return (position, statement, ctx) -> statement.setString(position, value.toString());
    }
}
Original line number Original line Diff line number Diff line
package fr.ulille.iut.pizzaland.resources;

import java.sql.SQLException;

import fr.ulille.iut.pizzaland.BDDFactory;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;

/**
 * BDDClearRessource
 */
@Path("clearDatabase")
public class BDDClearRessource {

    @GET
    public void clearDatabase()  throws SQLException {
        BDDFactory.dropTables();
    }
}
Original line number Original line Diff line number Diff line
@@ -5,11 +5,11 @@ import java.util.List;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.logging.Logger;
import java.util.logging.Logger;


import javax.ws.rs.GET;
import jakarta.ws.rs.GET;
import javax.ws.rs.Path;
import jakarta.ws.rs.Path;
import javax.ws.rs.core.Context;
import jakarta.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import jakarta.ws.rs.core.UriInfo;


import fr.ulille.iut.pizzaland.dto.IngredientDto;
import fr.ulille.iut.pizzaland.dto.IngredientDto;


@@ -27,6 +27,6 @@ public class IngredientResource {
    public List<IngredientDto> getAll() {
    public List<IngredientDto> getAll() {
        LOGGER.info("IngredientResource:getAll");
        LOGGER.info("IngredientResource:getAll");


	return null;
        return new ArrayList<IngredientDto>();
    }
    }
}
}
Original line number Original line Diff line number Diff line
[
[
    { "name": "mozzarella"},
{ "id": "f38806a8-7c85-49ef-980c-149dcd81d306", "name": "mozzarella"},
{ "name": "jambon"},
{ "id": "d36903e1-0cc0-4bd6-a0ed-e0e9bf7b4037", "name": "jambon"},
{ "name": "champignons"},
{ "id": "bc5b315f-442f-4ee4-96de-486d48f20c2f", "name": "champignons"},
{ "name": "olives"},
{ "id": "6a04320c-3a4f-4570-96d3-61faf3f898b0", "name": "olives"},
{ "name": "tomate"},
{ "id": "c77deeee-d50d-49d5-9695-c98ec811f762", "name": "tomate"},
{ "name": "merguez"},
{ "id": "c9375542-8142-43f6-b54d-0d63597cf614", "name": "merguez"},
{ "name": "lardons"},
{ "id": "dee27dd6-f9b6-4d03-ac4b-216b5c9c8bd7", "name": "lardons"},
{ "name": "fromage"},
{ "id": "657f8dd4-6bc1-4622-9af7-37d248846a23", "name": "fromage"},
{ "name": "oeuf"},
{ "id": "070d8077-a713-49a0-af37-3936b63d5ff2", "name": "oeuf"},
{ "name": "poivrons"},
{ "id": "5d9ca5c4-517f-40fd-aac3-5a823d680c1d", "name": "poivrons"},
{ "name": "ananas"},
{ "id": "52f68024-24ec-46c0-8e77-c499dba1e27e", "name": "ananas"},
{ "name": "reblochon"}
{ "id": "dfdf6fae-f1b2-45fa-8c39-54e522c1933f", "name": "reblochon"}
]
]

src/main/resources/logback.xml

deleted100644 → 0
+0 −12
Original line number Original line Diff line number Diff line
<configuration scan="true">
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
            <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
    </appender>

    <root level="info">
        <appender-ref ref="STDOUT"/>
    </root>

    <logger name="fr.ulille.iut.pizzaland" level="debug"/>

</configuration>
+4 −0
Original line number Original line Diff line number Diff line
handlers= java.util.logging.ConsoleHandler
.level= INFO
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
 No newline at end of file
Original line number Original line Diff line number Diff line
@@ -9,10 +9,10 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Before;
import org.junit.Test;
import org.junit.Test;


import javax.ws.rs.client.Entity;
import jakarta.ws.rs.client.Entity;
import javax.ws.rs.core.GenericType;
import jakarta.ws.rs.core.GenericType;
import javax.ws.rs.core.Application;
import jakarta.ws.rs.core.Application;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Response;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals;


@@ -21,7 +21,7 @@ import java.util.logging.Logger;


/*
/*
 * JerseyTest facilite l'écriture des tests en donnant accès aux
 * JerseyTest facilite l'écriture des tests en donnant accès aux
 * méthodes de l'interface javax.ws.rs.client.Client.
 * méthodes de l'interface jakarta.ws.rs.client.Client.
 * la méthode configure() permet de démarrer la ressource à tester
 * la méthode configure() permet de démarrer la ressource à tester
 */
 */
public class IngredientResourceTest extends JerseyTest {
public class IngredientResourceTest extends JerseyTest {
@@ -32,7 +32,8 @@ public class IngredientResourceTest extends JerseyTest {
        return new ApiV1();
        return new ApiV1();
    }
    }


    // Les méthodes setEnvUp() et tearEnvDown() serviront à terme à initialiser la base de données
    // Les méthodes setEnvUp() et tearEnvDown() serviront à terme à initialiser la
    // base de données
    // et les DAO
    // et les DAO


    // https://stackoverflow.com/questions/25906976/jerseytest-and-junit-throws-nullpointerexception
    // https://stackoverflow.com/questions/25906976/jerseytest-and-junit-throws-nullpointerexception
@@ -55,13 +56,13 @@ public class IngredientResourceTest extends JerseyTest {
        // On vérifie le code de la réponse (200 = OK)
        // On vérifie le code de la réponse (200 = OK)
        assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
        assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());


		  
        // On vérifie la valeur retournée (liste vide)
        // On vérifie la valeur retournée (liste vide)
        // L'entité (readEntity() correspond au corps de la réponse HTTP.
        // L'entité (readEntity() correspond au corps de la réponse HTTP.
	// La classe javax.ws.rs.core.GenericType<T> permet de définir le type
        // La classe jakarta.ws.rs.core.GenericType<T> permet de définir le type
	// de la réponse lue quand on a un type complexe (typiquement une liste).
        // de la réponse lue quand on a un type paramétré (typiquement une liste).
        List<IngredientDto> ingredients;
        List<IngredientDto> ingredients;
        ingredients = response.readEntity(new GenericType<List<IngredientDto>>(){});
        ingredients = response.readEntity(new GenericType<List<IngredientDto>>() {
        });


        assertEquals(0, ingredients.size());
        assertEquals(0, ingredients.size());


+0 −12
Original line number Original line Diff line number Diff line
<configuration scan="true">
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
            <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
    </appender>

    <root level="info">
        <appender-ref ref="STDOUT"/>
    </root>

    <logger name="fr.ulille.iut.pizzaland" level="debug"/>

</configuration>
+4 −0
Original line number Original line Diff line number Diff line
handlers= java.util.logging.ConsoleHandler
.level= INFO
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
 No newline at end of file