diff --git a/2A/BDD/tp/s2/noSQL/tp1/films.json b/2A/BDD/tp/s2/noSQL/tp1/films.json new file mode 100644 index 0000000..c6bb628 --- /dev/null +++ b/2A/BDD/tp/s2/noSQL/tp1/films.json @@ -0,0 +1,675 @@ +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cad1" + }, + "titre": "La ligne verte", + "titre_original": "The Green Mile", + "annee": 1999, + "realisation": { + "nom": "Darabont", + "prenom": "Franck" + }, + "casting": [ + { + "nom": "Hanks", + "prenom": "Tom" + }, + { + "nom": "Duncan", + "prenom": "Michael Clarke" + }, + { + "nom": "Morse", + "prenom": "David" + } + ] +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cad2" + }, + "titre": "Le parrain", + "titre_original": "The Godfather", + "annee": 1972, + "realisation": { + "nom": "Copolla", + "prenom": "Francis Ford" + }, + "casting": [ + { + "nom": "Brando", + "prenom": "Marlon" + }, + { + "nom": "Pacino", + "prenom": "Al" + }, + { + "nom": "Caan", + "prenom": "James" + } + ] +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cad3" + }, + "titre": "Le silence des agneaux", + "titre_original": "The Silence of the Lambs", + "annee": 1991, + "realisation": { + "nom": "Demme", + "prenom": "Jonathan" + }, + "casting": [ + { + "nom": "Foster", + "prenom": "Jodie" + }, + { + "nom": "Hopkins", + "prenom": "Anthony" + } + ] +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cad4" + }, + "titre": "Forrest Gump", + "annee": 1994, + "realisation": { + "nom": "Zemeckis", + "prenom": "Robert" + }, + "casting": [ + { + "nom": "Hanks", + "prenom": "Tom" + }, + { + "nom": "Wright", + "prenom": "Robin" + }, + { + "nom": "Sinise", + "prenom": "Gary" + } + ] +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cad5" + }, + "titre": "Gladiator", + "titre_original": "Gladiator", + "annee": 2000, + "realisation": { + "nom": "Scott", + "prenom": "Ridley" + } +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cad6" + }, + "titre": "Matrix", + "titre_original": "The Matrix", + "annee": 1999 +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cad7" + }, + "titre": "Star Wars, épisode I : La Menace fantôme", + "titre_original": "Star Wars: Episode I - The Phantom Menace", + "annee": 1999, + "realisation": { + "nom": "Lucas", + "prenom": "George" + } +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cad8" + }, + "titre": "Star Wars, épisode II : L'Attaque des clones", + "titre_original": "Star Wars: Episode II - Attack of the Clones", + "annee": 2002, + "realisation": { + "nom": "Lucas", + "prenom": "George" + } +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cad9" + }, + "titre": "Star Wars, épisode III : La Revanche des Sith", + "titre_original": "Star Wars: Episode III - Revenge of the Sith", + "annee": 2005, + "realisation": { + "nom": "Lucas", + "prenom": "George" + } +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cada" + }, + "titre": "Star Wars, épisode IV : Un nouvel espoir", + "titre_original": "Star Wars: Episode IV - A New Hope", + "annee": 1977, + "realisation": { + "nom": "Lucas", + "prenom": "George" + } +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cadb" + }, + "titre": "Star Wars, épisode V : L'Empire contre-attaque", + "titre_original": "Star Wars: Episode V - The Empire Strikes Back", + "annee": 1980, + "realisation": { + "nom": "Kershner", + "prenom": "Irvin" + } +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cadc" + }, + "titre": "Star Wars, épisode VI : Le Retour du Jedi", + "titre_original": "Star Wars: Episode VI - Return of the Jedi", + "annee": 1983, + "realisation": { + "nom": "Richard", + "prenom": "Marquand" + } +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cadd" + }, + "titre": "Star Wars, épisode VII : Le Réveil de la Force", + "titre_original": "Star Wars: Episode VII - The Force Awakens", + "annee": 2015, + "realisation": { + "nom": "Abrams", + "prenom": "J. J." + } +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cade" + }, + "titre": "Star Wars, épisode VIII : Les Derniers Jedi", + "titre_original": "Star Wars: Episode VIII - The Last Jedi", + "annee": 2017, + "realisation": { + "nom": "Johnson", + "prenom": "Rian" + } +} +{ + "_id": { + "$oid": "65684dcd7dd7c6e85078cadf" + }, + "titre": "Star Wars, épisode IX : L'Ascension de Skywalker", + "titre_original": "Star Wars: Episode IX - The Rise of Skywalker", + "annee": 2019, + "realisation": { + "nom": "Abrams", + "prenom": "J. J." + } +} +{ + "_id": { + "$oid": "65687f987dd7c6e85078cae1" + }, + "titre": "Les Aventuriers de l'arche perdue", + "titre_original": "Indiana Jones and the Raiders of the Lost Ark", + "annee": 1981, + "realisation": { + "nom": "Spielberg", + "prenom": "Steven" + }, + "casting": [ + { + "nom": "Ford", + "prenom": "Harrison" + }, + { + "nom": "Allen", + "prenom": "Karen" + }, + { + "nom": "Freeman", + "prenom": "Paul" + } + ] +} +{ + "_id": { + "$oid": "65687f987dd7c6e85078cae2" + }, + "titre": "E.T., l'extra-terrestre", + "titre_original": "E.T. the Extra-Terrestrial", + "annee": 1982, + "realisation": { + "nom": "Spielberg", + "prenom": "Steven" + } +} +{ + "_id": { + "$oid": "65687f987dd7c6e85078cae3" + }, + "titre": "Princesse Mononoke", + "titre_original": "Mononoke-hime", + "realisation": { + "nom": "Miyazaki", + "prenom": "Hayao" + }, + "annee": 1997 +} +{ + "_id": { + "$oid": "6568af247dd7c6e85078cae6" + }, + "titre": "Mon voisin Totoro", + "titre_original": "Tonari no Totoro", + "annee": 1988, + "realisation": { + "nom": "Miyazaki", + "prenom": "Hayao" + } +} +{ + "_id": { + "$oid": "6568af247dd7c6e85078cae7" + }, + "titre": "Kiki la petite sorcière", + "titre_original": "Majo no takkyūbin", + "annee": 1989, + "realisation": { + "nom": "Miyazaki", + "prenom": "Hayao" + } +} +{ + "_id": { + "$oid": "6568af247dd7c6e85078cae8" + }, + "titre": "Porco Rosso", + "titre_original": "Kurenai no buta", + "annee": 1992, + "realisation": { + "nom": "Miyazaki", + "prenom": "Hayao" + } +} +{ + "_id": { + "$oid": "6568af247dd7c6e85078cae9" + }, + "titre": "Le Voyage de Chihiro", + "titre_original": "Sen to Chihiro no kamikakushi", + "annee": 2001, + "realisation": { + "nom": "Miyazaki", + "prenom": "Hayao" + } +} +{ + "_id": { + "$oid": "6568af247dd7c6e85078caea" + }, + "titre": "Le Château ambulant", + "titre_original": "Hauru no ugoku shiro", + "annee": 2004, + "realisation": { + "nom": "Miyazaki", + "prenom": "Hayao" + } +} +{ + "_id": { + "$oid": "6568af247dd7c6e85078caeb" + }, + "titre": "Le Loup de Wall Street", + "titre_original": "The Wolf of Wall Street", + "annee": 2013, + "realisation": { + "nom": "Scorcese", + "prenom": "Martin" + }, + "casting": [ + { + "nom": "DiCaprio", + "prenom": "Leonardo" + }, + { + "nom": "Hill", + "prenom": "Jonah" + }, + { + "nom": "Robbie", + "prenom": "Margot" + }, + { + "nom": "Chandler", + "prenom": "Kyle" + }, + { + "nom": "Reiner", + "prenom": "Rob" + } + ] +} +{ + "_id": { + "$oid": "6568af247dd7c6e85078caec" + }, + "titre": "The Dark Knight : Le Chevalier noir", + "titre_original": "The Dark Knight", + "annee": 2008, + "realisation": { + "nom": "Nolan", + "prenom": "Christopher" + } +} +{ + "_id": { + "$oid": "6568af247dd7c6e85078caed" + }, + "titre": "La liste de Schindler", + "titre_original": "Schindler's List", + "annee": 1993, + "realisation": { + "nom": "Spielberg", + "prenom": "Steven" + } +} +{ + "_id": { + "$oid": "6569bb1e010c5e0523364044" + }, + "titre": "Jurassic Park", + "annee": 1993, + "realisation": { + "nom": "Spielberg", + "prenom": "Steven" + } +} +{ + "_id": { + "$oid": "6569bb1e010c5e0523364045" + }, + "titre": "Le Monde perdu : Jurassic Park", + "titre_original": "The Lost World: Jurrassic Park", + "annee": 1997, + "realisation": { + "nom": "Spielberg", + "prenom": "Steven" + } +} +{ + "_id": { + "$oid": "6569bb1e010c5e0523364046" + }, + "titre": "Jurassic Park 3", + "annee": 2001, + "realisation": { + "nom": "Spielberg", + "prenom": "Steven" + } +} +{ + "_id": { + "$oid": "6569bb1e010c5e0523364047" + }, + "titre": "Le Seigneur des anneaux : La Communauté de l'anneau", + "titre_original": "The Lord of the rings: The Fellowship of the Ring", + "annee": 2001, + "realisation": { + "nom": "Jackson", + "prenom": "Peter" + } +} +{ + "_id": { + "$oid": "6569bb1e010c5e0523364048" + }, + "titre": "Le Seigneur des anneaux : Les Deux Tours", + "titre_original": "The Lord of the rings: The Two Towers", + "annee": 2002, + "realisation": { + "nom": "Jackson", + "prenom": "Peter" + } +} +{ + "_id": { + "$oid": "6569bb1e010c5e0523364049" + }, + "titre": "Le Seigneur des anneaux : Le Retour du roi", + "titre_original": "The Lord of the rings: The Return of the King", + "annee": 2003, + "realisation": { + "nom": "Jackson", + "prenom": "Peter" + } +} +{ + "_id": { + "$oid": "6569bb1e010c5e052336404a" + }, + "titre": "Pulp Fiction", + "annee": 1994, + "realisation": { + "nom": "Tarantino", + "prenom": "Quentin" + } +} +{ + "_id": { + "$oid": "6569bb1e010c5e052336404b" + }, + "titre": "Fight Club", + "annee": 1999, + "realisation": { + "nom": "Fincher", + "prenom": "David" + } +} +{ + "_id": { + "$oid": "6569bd1f010c5e052336404d" + }, + "titre": "Inception", + "annee": 2010, + "realisation": { + "nom": "Nolan", + "prenom": "Christopher" + } +} +{ + "_id": { + "$oid": "6569bd1f010c5e052336404e" + }, + "titre": "Interstellar", + "annee": 2014, + "realisation": { + "nom": "Nolan", + "prenom": "Christopher" + } +} +{ + "_id": { + "$oid": "6569bd1f010c5e052336404f" + }, + "titre": "Il faut sauver le soldat Ryan", + "titre_original": "Saving Private Ryan", + "annee": 1998, + "realisation": { + "nom": "Spielberg", + "prenom": "Steven" + } +} +{ + "_id": { + "$oid": "6569bd1f010c5e0523364050" + }, + "titre": "Retour vers le futur", + "titre_original": "Back to the Future", + "annee": 1985, + "realisation": { + "nom": "Zemeckis", + "prenom": "Robert" + } +} +{ + "_id": { + "$oid": "6569bd1f010c5e0523364051" + }, + "titre": "Le pianiste", + "titre_original": "The Pianist", + "annee": 2002, + "realisation": { + "nom": "Polanski", + "prenom": "Roman" + } +} +{ + "_id": { + "$oid": "6569bd1f010c5e0523364052" + }, + "titre": "Gladiator", + "annee": 2000, + "realisation": { + "nom": "Scott", + "prenom": "Ridley" + } +} +{ + "_id": { + "$oid": "6569c4f5010c5e0523364054" + }, + "titre": "Harry Potter à l'école des sorciers", + "titre_original": "Harry Potter and the Philosopher's Stone", + "annee": 2001, + "realisation": { + "nom": "Columbus", + "prenom": "Chris" + }, + "casting": [ + { + "nom": "Radcliffe", + "prenom": "Daniel" + }, + { + "nom": "Grint", + "prenom": "Rupert" + }, + { + "nom": "Watson", + "prenom": "Emma" + } + ] +} +{ + "_id": { + "$oid": "6569c4f5010c5e0523364055" + }, + "titre": "Le Roi Lion", + "titre_original": "The Lion King", + "annee": 1994 +} +{ + "_id": { + "$oid": "6569c4f5010c5e0523364056" + }, + "titre": "Intouchables", + "annee": 2011 +} +{ + "_id": { + "$oid": "6569c4f5010c5e0523364057" + }, + "titre": "Apocalypse Now", + "annee": 1979, + "realisation": { + "nom": "Coppola", + "prenom": "Francis Ford" + } +} +{ + "_id": { + "$oid": "6569c4f5010c5e0523364058" + }, + "titre": "WALL·E", + "annee": 2008, + "realisation": { + "nom": "Stanton", + "prenom": "Andrew" + } +} +{ + "_id": { + "$oid": "6569c4f5010c5e0523364059" + }, + "titre": "Shining", + "titre_original": "The Shining", + "annee": 1980, + "realisation": { + "nom": "Kubrick", + "prenom": "Stanley" + } +} +{ + "_id": { + "$oid": "6569c4f5010c5e052336405a" + }, + "titre": "Inglourious Basterds", + "annee": 2009, + "realisation": { + "nom": "Tarantino", + "prenom": "Quentin" + } +} +{ + "_id": { + "$oid": "6569c4f5010c5e052336405b" + }, + "titre": "Braveheart", + "annee": 1995, + "realisation": { + "nom": "Gibson", + "prenom": "Mel" + } +} +{ + "_id": { + "$oid": "6569c4f5010c5e052336405c" + }, + "titre": "The Truman Show", + "annee": 1998, + "realisation": { + "nom": "Weir", + "prenom": "Peter" + } +} +{ + "_id": { + "$oid": "6569c4f5010c5e052336405d" + }, + "titre": "Shutter Island", + "annee": 2010, + "realisation": { + "nom": "Scorsese", + "prenom": "Martin" + } +} diff --git a/2A/BDD/tp/s2/noSQL/tp1/tp.txt b/2A/BDD/tp/s2/noSQL/tp1/tp.txt new file mode 100644 index 0000000..9a69482 --- /dev/null +++ b/2A/BDD/tp/s2/noSQL/tp1/tp.txt @@ -0,0 +1,191 @@ +db.mydb.find() + +db.films.insertMany([ + { + "titre" : "Le parrain", + "titre_original" : "The Godfather", "annee" : 1972, + "realisation" : {"nom" : "Copolla", "prenom" : "Fracis Ford"} + }, + { + "titre" : "Le silence des agneaux", + "titre_original" : "The Silence of the Lambs", "annee" : 1992, + "realisation" : {"nom" : "Demme", "prenom" : "Jonathan"} + }, + { + "titre" : "Forrest Gump", + "annee" : 1994, + "realisation" : {"nom" : "Zemeckis", "prenom" : "Robert"} + }, +]) + +db.films.find() + +db.films.find().sort({"titre" : 1}) + +db.films.find().sort({"annee" : -1}) + +db.films.find({},["titre"]) + +db.films.find({},["titre", "annee"]) + +db.films.find({"annee" : 1972}) + +db.films.updateOne( + {"titre" : "Le silence des agneaux"}, + { + $set : {"annee" : 1991} + } +) + +db.films.find({"titre" : "Le silence des agneaux"}) + +db.films.find({"realisation" : {"nom" : "Darabont ", "prenom" : "Franck"}}) +db.films.find({"realisation.nom" : "Darabont "}) + +db.films.insertOne( +{ + "titre" : "La marraine", + "annee" : 2024, + "realisation" : {"nom" : "Nope", "prenom" : "Epon"} +}) + +db.films.aggregate({ + $set : { + "casting" : [{ + "nom" : "", "prenom" : "" + }, + { + "nom" : "", "prenom" : "" + } + ] + } +}) +db.films.aggregate({ + $addFields : { + "casting" : [{ + "nom" : "", "prenom" : "" + }, + { + "nom" : "", "prenom" : "" + } + ] + } +}) + +db.films.updateOne( + { + "titre" : "La ligne verte" + }, + { + $set : {"casting" : [ + { + "nom" : "Hanks", "prenom" : "Tom" + }, + { + "nom" : "Duncan", "prenom" : "Michael Clarke" + }, + { + "nom" : "Hanks", "prenom" : "Tom" + } + ]} + } +) + +db.films.updateOne( + { + "titre" : "Le parrain" + }, + { + $set : {"casting" : [ + { + "nom" : "Brando", "prenom" : "Marlon" + }, + { + "nom" : "Pacino", "prenom" : "Al" + }, + { + "nom" : "Caan", "prenom" : "James" + } + ]} + } +) + +db.films.updateOne( + { + "titre" : "Le silence des agneaux" + }, + { + $set : {"casting" : [ + { + "nom" : "Foster", "prenom" : "Jodie" + }, + { + "nom" : "Hopkins", "prenom" : "Anthony" + } + ]} + } +) +db.films.updateOne( + { + "titre" : "Forrest Gump" + }, + { + $set : {"casting" : [ + { + "nom" : "Hanks", "prenom" : "Tom" + }, + { + "nom" : "Wright", "prenom" : "Robin" + }, + { + "nom" : "Sinise", "prenom" : "Gary" + } + ]} + } +) + +db.films.find({"casting" : {"nom" : "Hanks", "prenom" : "Tom"}}) + +db.films.insertMany([ + { + "titre" : "La filmade", + "annee" : 2025, + "realisation" : {"nom" : "Nddope", "prenom" : "sEpon"}, + "casting" : {"nom" : "Elodie", "prenom" : "sdq"} + }, + { + "titre" : "Dune", + "annee" : 2024, + "realisation" : {"nom" : "Duné", "prenom" : "Dunard"}, + "casting" : {"nom" : "ds", "prenom" : "sqdfdq"} + }, + { + "titre" : "Il était une fois la vie", + "annee" : 1995, + "realisation" : {"nom" : "jsp", "prenom" : "toujourspas"}, + "casting" : {"nom" : "Le grand", "prenom" : "barbue"} + }, + { + "titre" : "La monique", + "annee" : 1995, + "realisation" : {"nom" : "Monique", "prenom" : "Monique"}, + "casting" : {"nom" : "Michelle", "prenom" : "Jean"} + }, + { + "titre" : "La liaison", + "annee" : 2000, + "realisation" : {"nom" : "Henri", "prenom" : "Assi"}, + "casting" : {"nom" : "Henri", "prenom" : "Debout"} + } +]) + +db.films.find({}, ["titre"]).limit(6) + +db.films.deleteMany({"annee" : {$lte : 1995}}) + +db.films.drop() + + +mongoimport --host londres.uca.local --authenticationDatabase "admin" -u "anperederi" --db="dbanperederi" --collection ="films" films.json + +db.films.find({"annee" : 2001}).sort({"titre" : -1}).limit(2) \ No newline at end of file diff --git a/2A/QualiteDev/2_tp/JUnit5/JUnit5.iml b/2A/QualiteDev/2_tp/JUnit5/JUnit5.iml deleted file mode 100644 index 6bf0b4e..0000000 --- a/2A/QualiteDev/2_tp/JUnit5/JUnit5.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/2A/QualiteDev/2_tp/TestJUnit5/.classpath b/2A/QualiteDev/2_tp/TestJUnit5/.classpath deleted file mode 100644 index 37c1aea..0000000 --- a/2A/QualiteDev/2_tp/TestJUnit5/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/2A/QualiteDev/2_tp/TestJUnit5/.gitignore b/2A/QualiteDev/2_tp/TestJUnit5/.gitignore deleted file mode 100644 index 84c048a..0000000 --- a/2A/QualiteDev/2_tp/TestJUnit5/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build/ diff --git a/2A/QualiteDev/2_tp/TestJUnit5/.project b/2A/QualiteDev/2_tp/TestJUnit5/.project deleted file mode 100644 index 6048fd1..0000000 --- a/2A/QualiteDev/2_tp/TestJUnit5/.project +++ /dev/null @@ -1,31 +0,0 @@ - - - TestJUnit5 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/2A/QualiteDev/2_tp/TestJUnit5/.settings/.jsdtscope b/2A/QualiteDev/2_tp/TestJUnit5/.settings/.jsdtscope deleted file mode 100644 index 81672d4..0000000 --- a/2A/QualiteDev/2_tp/TestJUnit5/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.common.component b/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.common.component deleted file mode 100644 index f4c769d..0000000 --- a/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.common.project.facet.core.xml b/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d65ae0f..0000000 --- a/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.jsdt.ui.superType.container b/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.jsdt.ui.superType.name b/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/2A/QualiteDev/2_tp/TestJUnit5/src/main/webapp/META-INF/MANIFEST.MF b/2A/QualiteDev/2_tp/TestJUnit5/src/main/webapp/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/2A/QualiteDev/2_tp/TestJUnit5/src/main/webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/2A/QualiteDev/2_tp/test_javaproject/.classpath b/2A/QualiteDev/2_tp/test_javaproject/.classpath new file mode 100644 index 0000000..257ce1d --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/2A/QualiteDev/2_tp/test_javaproject/.gitignore b/2A/QualiteDev/2_tp/test_javaproject/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/2A/QualiteDev/2_tp/test_javaproject/.project b/2A/QualiteDev/2_tp/test_javaproject/.project new file mode 100644 index 0000000..70a47b6 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/.project @@ -0,0 +1,17 @@ + + + test_javaproject + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.jdt.core.prefs b/2A/QualiteDev/2_tp/test_javaproject/.settings/org.eclipse.jdt.core.prefs similarity index 70% rename from 2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.jdt.core.prefs rename to 2A/QualiteDev/2_tp/test_javaproject/.settings/org.eclipse.jdt.core.prefs index d4540a5..8c9943d 100644 --- a/2A/QualiteDev/2_tp/TestJUnit5/.settings/org.eclipse.jdt.core.prefs +++ b/2A/QualiteDev/2_tp/test_javaproject/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,11 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/ChargeurTelecommande.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/ChargeurTelecommande.java new file mode 100644 index 0000000..4278686 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/ChargeurTelecommande.java @@ -0,0 +1,38 @@ +package model; +// package tetepremiere.commande.groupe; + +public class ChargeurTelecommande { + + public static void main(String[] args) { + + Telecommande remoteControl = new Telecommande(); + + Lampe lampe = new Lampe("Séjour"); + TV tv = new TV("Séjour"); + Stereo stereo = new Stereo("Séjour"); + Jacuzzi jacuzzi = new Jacuzzi(); + + CommandeAllumerLampe lampeAllumee = new CommandeAllumerLampe(lampe); + CommandeAllumerStereo stereoAllumee = new CommandeAllumerStereo(stereo); + CommandeAllumerTV tvAllumee = new CommandeAllumerTV(tv); + CommandeAllumerJacuzzi jacuzziAllume = new CommandeAllumerJacuzzi(jacuzzi); + CommandeEteindreLampe lampeEteinte = new CommandeEteindreLampe(lampe); + CommandeEteindreStereo stereoEteinte = new CommandeEteindreStereo(stereo); + CommandeEteindreTV tvEteinte = new CommandeEteindreTV(tv); + CommandeEteindreJacuzzi jacuzziEteint = new CommandeEteindreJacuzzi(jacuzzi); + + Commande[] allumageGroupe = { lampeAllumee, stereoAllumee, tvAllumee, jacuzziAllume}; + Commande[] extinctionGroupe = { lampeEteinte, stereoEteinte, tvEteinte, jacuzziEteint}; + + MacroCommande macroAllumageGroupe = new MacroCommande(allumageGroupe); + MacroCommande macroExtinctionGroupe = new MacroCommande(extinctionGroupe); + + remoteControl.setCommande(0, macroAllumageGroupe, macroExtinctionGroupe); + + System.out.println(remoteControl); + System.out.println("---Exécution de Macro Marche ---"); + remoteControl.boutonMarchePresse(0); + System.out.println("--- Exécution de Macro Arret ---"); + remoteControl.boutonArretPresse(0); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/Commande.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/Commande.java new file mode 100644 index 0000000..4cdb3a7 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/Commande.java @@ -0,0 +1,7 @@ +package model; +// package tetepremiere.commande.groupe; + +public interface Commande { + public void executer(); + public void annuler(); +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerJacuzzi.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerJacuzzi.java new file mode 100644 index 0000000..2ec8fcc --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerJacuzzi.java @@ -0,0 +1,18 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeAllumerJacuzzi implements Commande { + Jacuzzi jacuzzi; + + public CommandeAllumerJacuzzi(Jacuzzi jacuzzi) { + this.jacuzzi = jacuzzi; + } + public void executer() { + jacuzzi.allumer(); + jacuzzi.setTemperature(40); + jacuzzi.bouillonner(); + } + public void annuler() { + jacuzzi.eteindre(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerLampe.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerLampe.java new file mode 100644 index 0000000..c1ed4d9 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerLampe.java @@ -0,0 +1,18 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeAllumerLampe implements Commande { + Lampe lampe; + + public CommandeAllumerLampe(Lampe lampe) { + this.lampe = lampe; + } + + public void executer() { + lampe.marche(); + } + + public void annuler() { + lampe.arret(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerLampeSejour.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerLampeSejour.java new file mode 100644 index 0000000..f52826e --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerLampeSejour.java @@ -0,0 +1,16 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeAllumerLampeSejour implements Commande { + Lampe lampe; + + public CommandeAllumerLampeSejour(Lampe lampe) { + this.lampe = lampe; + } + public void executer() { + lampe.arret(); + } + public void annuler() { + lampe.marche(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerStereo.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerStereo.java new file mode 100644 index 0000000..1b90dd2 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerStereo.java @@ -0,0 +1,18 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeAllumerStereo implements Commande { + Stereo stereo; + + public CommandeAllumerStereo(Stereo stereo) { + this.stereo = stereo; + } + + public void executer() { + stereo.marche(); + } + + public void annuler() { + stereo.arret(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerStereoAvecCD.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerStereoAvecCD.java new file mode 100644 index 0000000..d6396e9 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerStereoAvecCD.java @@ -0,0 +1,20 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeAllumerStereoAvecCD implements Commande { + Stereo stereo; + + public CommandeAllumerStereoAvecCD(Stereo stereo) { + this.stereo = stereo; + } + + public void executer() { + stereo.marche(); + stereo.setCD(); + stereo.setVolume(11); + } + + public void annuler() { + stereo.arret(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerTV.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerTV.java new file mode 100644 index 0000000..a5ab6fc --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeAllumerTV.java @@ -0,0 +1,19 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeAllumerTV implements Commande { + TV tv; + + public CommandeAllumerTV(TV tv) { + this.tv= tv; + } + + public void executer() { + tv.marche(); + tv.selectionnerCanal(); + } + + public void annuler() { + tv.arret(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreJacuzzi.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreJacuzzi.java new file mode 100644 index 0000000..1167659 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreJacuzzi.java @@ -0,0 +1,18 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeEteindreJacuzzi implements Commande { + Jacuzzi jacuzzi; + + public CommandeEteindreJacuzzi(Jacuzzi jacuzzi) { + this.jacuzzi = jacuzzi; + } + + public void executer() { + jacuzzi.setTemperature(36); + jacuzzi.eteindre(); + } + public void annuler() { + jacuzzi.allumer(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreLampe.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreLampe.java new file mode 100644 index 0000000..0cf9e8a --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreLampe.java @@ -0,0 +1,18 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeEteindreLampe implements Commande { + Lampe lampe; + + public CommandeEteindreLampe(Lampe lampe) { + this.lampe = lampe; + } + + public void executer() { + lampe.arret(); + } + + public void annuler() { + lampe.marche(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreLampeSejour.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreLampeSejour.java new file mode 100644 index 0000000..979d01e --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreLampeSejour.java @@ -0,0 +1,16 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeEteindreLampeSejour implements Commande { + Lampe lampe; + + public CommandeEteindreLampeSejour(Lampe lampe) { + this.lampe = lampe; + } + public void executer() { + lampe.marche(); + } + public void annuler() { + lampe.arret(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreStereo.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreStereo.java new file mode 100644 index 0000000..4222b75 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreStereo.java @@ -0,0 +1,18 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeEteindreStereo implements Commande { + Stereo stereo; + + public CommandeEteindreStereo(Stereo stereo) { + this.stereo = stereo; + } + + public void executer() { + stereo.arret(); + } + + public void annuler() { + stereo.marche(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreTV.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreTV.java new file mode 100644 index 0000000..a6ce9c6 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreTV.java @@ -0,0 +1,18 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeEteindreTV implements Commande { + TV tv; + + public CommandeEteindreTV(TV tv) { + this.tv= tv; + } + + public void executer() { + tv.arret(); + } + + public void annuler() { + tv.marche(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreVentilateur.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreVentilateur.java new file mode 100644 index 0000000..a96d313 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeEteindreVentilateur.java @@ -0,0 +1,23 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeEteindreVentilateur implements Commande { + Ventilateur ventilateur; + int derniereVitesse; + + public CommandeEteindreVentilateur(Ventilateur ventilateur) { + this.ventilateur = ventilateur; + } + public void executer() { + derniereVitesse = ventilateur.getVitesse(); + ventilateur.arreter(); + } + public void annuler() { + switch (derniereVitesse) { + case Ventilateur.RAPIDE: ventilateur.rapide(); break; + case Ventilateur.MOYEN: ventilateur.moyen(); break; + case Ventilateur.LENT: ventilateur.lent(); break; + default: ventilateur.arreter(); break; + } + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeVentilateurMoyen.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeVentilateurMoyen.java new file mode 100644 index 0000000..eef5c08 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeVentilateurMoyen.java @@ -0,0 +1,23 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeVentilateurMoyen implements Commande { + Ventilateur ventilateur; + int derniereVitesse; + + public CommandeVentilateurMoyen(Ventilateur ventilateur) { + this.ventilateur = ventilateur; + } + public void executer() { + derniereVitesse = ventilateur.getVitesse(); + ventilateur.moyen(); + } + public void annuler() { + switch (derniereVitesse) { + case Ventilateur.RAPIDE: ventilateur.rapide(); break; + case Ventilateur.MOYEN: ventilateur.moyen(); break; + case Ventilateur.LENT: ventilateur.lent(); break; + default: ventilateur.arreter(); break; + } + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeVentilateurRapide.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeVentilateurRapide.java new file mode 100644 index 0000000..acde725 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/CommandeVentilateurRapide.java @@ -0,0 +1,23 @@ +package model; +// package tetepremiere.commande.groupe; + +public class CommandeVentilateurRapide implements Commande { + Ventilateur ventilateur; + int derniereVitesse; + + public CommandeVentilateurRapide(Ventilateur ventilateur) { + this.ventilateur = ventilateur; + } + public void executer() { + derniereVitesse = ventilateur.getVitesse(); + ventilateur.rapide(); + } + public void annuler() { + switch (derniereVitesse) { + case Ventilateur.RAPIDE: ventilateur.rapide(); break; + case Ventilateur.MOYEN: ventilateur.moyen(); break; + case Ventilateur.LENT: ventilateur.lent(); break; + default: ventilateur.arreter(); break; + } + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/Jacuzzi.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/Jacuzzi.java new file mode 100644 index 0000000..c8e0f66 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/Jacuzzi.java @@ -0,0 +1,54 @@ +package model; +// package tetepremiere.commande.groupe; + +public class Jacuzzi { + boolean allume; + int temperature; + + public Jacuzzi() { + } + + public void allumer() { + allume = true; + } + + public void eteindre() { + allume = false; + } + + public void bouillonner() { + if (allume) { + System.out.println("Le jaccuzi bouillonne !"); + } + } + + public void marche() { + if (allume) { + System.out.println("Le jaccuzi est en marche"); + } + } + + public void arret() { + if (allume) { + System.out.println("Le jaccuzi est arrêté"); + } + } + + public void setTemperature(int temperature) { + if (temperature > this.temperature) { + System.out.println("Le jacuzzi chauffe à " + temperature + "°"); + } + else { + System.out.println("Le jaccuzi refroidit à " + temperature + "°"); + } + this.temperature = temperature; + } + + public boolean getAllume() { + return this.allume; + } + + public int getTemperature() { + return this.temperature; + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/Lampe.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/Lampe.java new file mode 100644 index 0000000..fb449b0 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/Lampe.java @@ -0,0 +1,35 @@ +package model; +// package tetepremiere.commande.groupe; + +public class Lampe { + String localisation; + int niveau; + + public Lampe(String localisation) { + this.localisation = localisation; + } + + public void marche() { + niveau = 100; + System.out.println(this.localisation+": lumière allumée"); + } + + public void arret() { + niveau = 0; + System.out.println(localisation+": lumière éteinte"); + } + + public void attenuer(int niveau) { + this.niveau = niveau; + if (niveau == 0) { + arret(); + } + else { + System.out.println("Le niveau de la lampe est positionné sur " + niveau + "%"); + } + } + + public int getNiveau() { + return niveau; + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/MacroCommande.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/MacroCommande.java new file mode 100644 index 0000000..1aff702 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/MacroCommande.java @@ -0,0 +1,23 @@ +package model; +// package tetepremiere.commande.groupe; + +public class MacroCommande implements Commande { + Commande[] commandes; + + public MacroCommande(Commande[] commandes) { + this.commandes = commandes; + } + + public void executer() { + for (int i = 0; i < commandes.length; i++) { + commandes[i].executer(); + } + } + + public void annuler() { + for (int i = 0; i < commandes.length; i++) { + commandes[i].annuler(); + } + } +} + diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/PasDeCommande.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/PasDeCommande.java new file mode 100644 index 0000000..598e30a --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/PasDeCommande.java @@ -0,0 +1,7 @@ +package model; +// package tetepremiere.commande.groupe; + +public class PasDeCommande implements Commande { + public void executer() { } + public void annuler() { } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/Stereo.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/Stereo.java new file mode 100644 index 0000000..8e09046 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/Stereo.java @@ -0,0 +1,40 @@ +package model; +// package tetepremiere.commande.groupe; + +public class Stereo { + String localisation; + + public Stereo(String location) { + this.localisation = location; + } + + public void marche() { + System.out.println(localisation + ": stéréo allumée"); + } + + public void arret() { + System.out.println(localisation + ": stéréo éteinte"); + } + + public void setCD() { + System.out.println(localisation + ": stéréo réglée pour l'entrée CD"); + } + + public void setDVD() { + System.out.println(localisation + ": stéréo réglée pour l'entrée DVD"); + } + + public void setRadio() { + System.out.println(localisation + ": stéréo réglée pour la radio"); + } + + public void setVolume(int volume) { + // code pour positionner le volume + // plage valide: 1-11 (aprs tout, 11 c'est mieux que 10, non ?) + System.out.println(localisation + ": le volume stéréo est " + volume); + } + + public String getLocation() { + return this.localisation; + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/TV.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/TV.java new file mode 100644 index 0000000..a55600c --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/TV.java @@ -0,0 +1,32 @@ +package model; +// package tetepremiere.commande.groupe; + +public class TV { + String localisation; + int canal; + + public TV(String location) { + this.localisation = location; + } + + public void marche() { + System.out.println(localisation + ": la télé est allumée"); + } + + public void arret() { + System.out.println(localisation + ": la télé est éteinte"); + } + + public void selectionnerCanal() { + this.canal = 3; + System.out.println(localisation + ": le canal est positionné sur VCR"); + } + + public String getLocation() { + return this.localisation; + } + + public int getCanal() { + return this.canal; + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/Telecommande.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/Telecommande.java new file mode 100644 index 0000000..bfa12c0 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/Telecommande.java @@ -0,0 +1,53 @@ +package model; +// package tetepremiere.commande.groupe; + +// +// Voici l'invocateur +// +public class Telecommande { + Commande[] commandesMarche; + Commande[] commandesArret; + public Commande commandeAnnulation; + + public Telecommande() { + commandesMarche = new Commande[7]; + commandesArret = new Commande[7]; + + Commande pasDeCommande = new PasDeCommande(); + for(int i=0;i<7;i++) { + commandesMarche[i] = pasDeCommande; + commandesArret[i] = pasDeCommande; + } + commandeAnnulation = pasDeCommande; + } + + public void setCommande(int empt, Commande comMarche, Commande comArret) { + commandesMarche[empt] = comMarche; + commandesArret[empt] = comArret; + } + + public void boutonMarchePresse(int empt) { + commandesMarche[empt].executer(); + commandeAnnulation = commandesMarche[empt]; + } + + public void boutonArretPresse(int empt) { + commandesArret[empt].executer(); + commandeAnnulation = commandesArret[empt]; + } + + public void boutonAnnulPresse() { + commandeAnnulation.annuler(); + } + + public String toString() { + StringBuffer stringBuff = new StringBuffer(); + stringBuff.append("\n------ Télécommande -------\n"); + for (int i = 0; i < commandesMarche.length; i++) { + stringBuff.append("[empt " + i + "] " + commandesMarche[i].getClass().getName() + + " " + commandesArret[i].getClass().getName() + "\n"); + } + stringBuff.append("[annulation] " + commandeAnnulation.getClass().getName() + "\n"); + return stringBuff.toString(); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/model/Ventilateur.java b/2A/QualiteDev/2_tp/test_javaproject/src/model/Ventilateur.java new file mode 100644 index 0000000..739938b --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/model/Ventilateur.java @@ -0,0 +1,43 @@ +package model; +// package tetepremiere.commande.groupe; + +public class Ventilateur { + public static final int RAPIDE = 3; + public static final int MOYEN = 2; + public static final int LENT = 1; + public static final int ARRET = 0; + String localisation; + int vitesse; + + public Ventilateur(String localisation) { + this.localisation = localisation; + } + + public void rapide() { +// regler le ventilateur sur rapide + vitesse = RAPIDE; + System.out.println(localisation + ": ventilateur sur rapide"); + } + + public void moyen() { + // regler le ventilateur sur moyen + vitesse = MOYEN; + System.out.println(localisation + ": ventilateur sur moyen"); + } + + public void lent() { + // regler le ventilateur sur lent + vitesse = LENT; + System.out.println(localisation + ": ventilateur sur lent"); + } + + public void arreter() { + // arrete le ventilateur + vitesse = 0; + System.out.println(localisation + ": ventilateur arrêté"); + } + + public int getVitesse() { + return vitesse; + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/test/JacuzziTest.java b/2A/QualiteDev/2_tp/test_javaproject/src/test/JacuzziTest.java new file mode 100644 index 0000000..8925fe3 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/test/JacuzziTest.java @@ -0,0 +1,46 @@ +package test; + +import model.Jacuzzi; + +import org.junit.Assert; +import org.junit.Test; + +public class JacuzziTest { + + @Test + public void testAllumer() { + Jacuzzi jacuzzi = new Jacuzzi(); + + jacuzzi.allumer(); + + Assert.assertTrue(jacuzzi.getAllume()); + } + + @Test + public void testEteindre() { + Jacuzzi jacuzzi = new Jacuzzi(); + jacuzzi.eteindre(); + + Assert.assertFalse(jacuzzi.getAllume()); + } + + @Test + public void testSetTemperature() { + Jacuzzi jacuzzi = new Jacuzzi(); + + jacuzzi.setTemperature(40); + + Assert.assertEquals(40, jacuzzi.getTemperature()); + Assert.assertNotEquals(50, jacuzzi.getTemperature()); + } + + @Test + public void testSetTemperatureNegative() { + Jacuzzi jacuzzi = new Jacuzzi(); + + jacuzzi.setTemperature(-10); + + Assert.assertEquals(-10, jacuzzi.getTemperature()); + Assert.assertNotEquals(0, jacuzzi.getTemperature()); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/test/LampeTest.java b/2A/QualiteDev/2_tp/test_javaproject/src/test/LampeTest.java new file mode 100644 index 0000000..2953883 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/test/LampeTest.java @@ -0,0 +1,47 @@ +package test; + +import org.junit.Test; +import static org.junit.Assert.*; +import model.Lampe; + +public class LampeTest { + + @Test + public void testMarche() { + Lampe lampe = new Lampe("Salon"); + lampe.marche(); + assertEquals(100, lampe.getNiveau()); + } + + @Test + public void testArret() { + Lampe lampe = new Lampe("Chambre"); + lampe.arret(); + assertEquals(0, lampe.getNiveau()); + } + + @Test + public void testAttenuer() { + Lampe lampe = new Lampe("Cuisine"); + + lampe.attenuer(50); + assertEquals(50, lampe.getNiveau()); + + lampe.attenuer(0); + assertEquals(0, lampe.getNiveau()); + } + + @Test + public void testNiveauNegatif() { + Lampe lampe = new Lampe("Lit"); + + lampe.attenuer(-10); + assertEquals(0, lampe.getNiveau()); + } + + @Test + public void testGetNiveau() { + Lampe lampe = new Lampe("Salle de bain"); + assertEquals(0, lampe.getNiveau()); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/test/StereoTest.java b/2A/QualiteDev/2_tp/test_javaproject/src/test/StereoTest.java new file mode 100644 index 0000000..65d9bd7 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/test/StereoTest.java @@ -0,0 +1,20 @@ +package test; + +import org.junit.Assert; +import org.junit.Test; + +import model.Stereo; + +public class StereoTest { + @Test + public void testStereoChambre1() { + Stereo stereo = new Stereo("Chambre1"); + Assert.assertEquals(stereo.getLocation(), "Chambre1"); + } + @Test + public void testStereoGrenier() { + Stereo stereo = new Stereo("Grenier"); + Assert.assertNotEquals(stereo.getLocation(), "Chambre1"); + Assert.assertEquals(stereo.getLocation(), "Grenier"); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/test/TVTest.java b/2A/QualiteDev/2_tp/test_javaproject/src/test/TVTest.java new file mode 100644 index 0000000..b06c61b --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/test/TVTest.java @@ -0,0 +1,15 @@ +package test; + +import org.junit.Assert; +import org.junit.Test; + +import model.TV; + +public class TVTest { + @Test + public void locationTest() { + TV myTv = new TV("Entree"); + Assert.assertEquals(myTv.getLocation(), "Entree"); + Assert.assertNotEquals(myTv.getLocation(), "Salon"); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/test/TelecommandeTest.java b/2A/QualiteDev/2_tp/test_javaproject/src/test/TelecommandeTest.java new file mode 100644 index 0000000..454f156 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/test/TelecommandeTest.java @@ -0,0 +1,43 @@ +package test; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import model.Commande; +import model.PasDeCommande; +import model.Telecommande; +import static org.junit.Assert.*; + +public class TelecommandeTest { + + @Test + public void testTelecommande() { + Telecommande telecommande = new Telecommande(); + Commande marcheCommande = new PasDeCommande(); + Commande arretCommande = new PasDeCommande(); + + telecommande.setCommande(0, marcheCommande, arretCommande); + telecommande.boutonMarchePresse(0); + + assertEquals(marcheCommande, telecommande.commandeAnnulation); + } + +// @Test +// public void testToString() { +// // Arrange +// Telecommande telecommande = new Telecommande(); +// Commande marcheCommande = new PasDeCommande(); +// Commande arretCommande = new PasDeCommande(); +// telecommande.setCommande(0, marcheCommande, arretCommande); +// +// // Act +// String result = telecommande.toString(); +// +// // Assert +// String expected = "\n------ Télécommande -------\n" + +// "[empt 0] PasDeCommande PasDeCommande\n" + +// "[annulation] PasDeCommande\n"; +// assertEquals(expected, result); +// } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/test/VentilateurTest.java b/2A/QualiteDev/2_tp/test_javaproject/src/test/VentilateurTest.java new file mode 100644 index 0000000..95aed7c --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/test/VentilateurTest.java @@ -0,0 +1,52 @@ +package test; + +import org.junit.Test; +import static org.junit.Assert.*; +import model.Ventilateur; + +public class VentilateurTest { + + @Test + public void testRapide() { + Ventilateur ventilateur = new Ventilateur("Salon"); + + ventilateur.rapide(); + assertEquals(Ventilateur.RAPIDE, ventilateur.getVitesse()); + } + + @Test + public void testMoyen() { + Ventilateur ventilateur = new Ventilateur("Chambre"); + + ventilateur.moyen(); + + assertEquals(Ventilateur.MOYEN, ventilateur.getVitesse()); + } + + @Test + public void testLent() { + Ventilateur ventilateur = new Ventilateur("Cuisine"); + + ventilateur.lent(); + + assertEquals(Ventilateur.LENT, ventilateur.getVitesse()); + } + + @Test + public void testArreter() { + Ventilateur ventilateur = new Ventilateur("Salle de bain"); + + ventilateur.arreter(); + + assertEquals(Ventilateur.ARRET, ventilateur.getVitesse()); + } + + @Test + public void testGetVitesse() { + Ventilateur ventilateur = new Ventilateur("Salon"); + + int result = ventilateur.getVitesse(); + + assertEquals(Ventilateur.ARRET, result); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/test/commandes/CommandeAllumerJacuzziTest.java b/2A/QualiteDev/2_tp/test_javaproject/src/test/commandes/CommandeAllumerJacuzziTest.java new file mode 100644 index 0000000..d2189dd --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/test/commandes/CommandeAllumerJacuzziTest.java @@ -0,0 +1,40 @@ +package test.commandes; + +import org.junit.Test; +import static org.junit.Assert.*; + +import model.CommandeAllumerJacuzzi; +import model.Jacuzzi; + +public class CommandeAllumerJacuzziTest { + + @Test + public void testExecuter() { + // Arrange + Jacuzzi jacuzzi = new Jacuzzi(); + CommandeAllumerJacuzzi commande = new CommandeAllumerJacuzzi(mockJacuzzi); + + // Act + commande.executer(); + + // Assert + Mockito.verify(mockJacuzzi, Mockito.times(1)).allumer(); + Mockito.verify(mockJacuzzi, Mockito.times(1)).setTemperature(40); + Mockito.verify(mockJacuzzi, Mockito.times(1)).bouillonner(); + Mockito.verifyNoMoreInteractions(mockJacuzzi); + } + + @Test + public void testAnnuler() { + // Arrange + Jacuzzi mockJacuzzi = Mockito.mock(Jacuzzi.class); + CommandeAllumerJacuzzi commande = new CommandeAllumerJacuzzi(mockJacuzzi); + + // Act + commande.annuler(); + + // Assert + Mockito.verify(mockJacuzzi, Mockito.times(1)).eteindre(); + Mockito.verifyNoMoreInteractions(mockJacuzzi); + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/test/commandes/CommandeAllumerTest.java b/2A/QualiteDev/2_tp/test_javaproject/src/test/commandes/CommandeAllumerTest.java new file mode 100644 index 0000000..308b4f4 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/test/commandes/CommandeAllumerTest.java @@ -0,0 +1,41 @@ +package test.commandes; + +import org.junit.Test; + +import model.CommandeAllumerJacuzzi; +import model.Jacuzzi; + +import static org.junit.Assert.*; + +public class CommandeAllumerTest { + + @Test + public void testCommandeAllumerJacuzzi() { + // Arrange + Jacuzzi jacuzzi = new Jacuzzi(); + CommandeAllumerJacuzzi commande = new CommandeAllumerJacuzzi(jacuzzi); + + // Act + commande.executer(); + + // Assert + assertTrue(jacuzzi.getAllume()); + assertEquals(40, jacuzzi.getTemperature()); + // Additional assertions based on the behavior of your system. + } + + @Test + public void testCommandeAnnulerJacuzzi() { + // Arrange + Jacuzzi jacuzzi = new Jacuzzi(); + jacuzzi.allumer(); // To test the annuler() method, we assume the Jacuzzi is already on. + CommandeAllumerJacuzzi commande = new CommandeAllumerJacuzzi(jacuzzi); + + // Act + commande.annuler(); + + // Assert + assertFalse(jacuzzi.getAllume()); + // Additional assertions based on the behavior of your system. + } +} diff --git a/2A/QualiteDev/2_tp/test_javaproject/src/test/commandes/CommandeEteindreTest.java b/2A/QualiteDev/2_tp/test_javaproject/src/test/commandes/CommandeEteindreTest.java new file mode 100644 index 0000000..799aa10 --- /dev/null +++ b/2A/QualiteDev/2_tp/test_javaproject/src/test/commandes/CommandeEteindreTest.java @@ -0,0 +1,5 @@ +package test.commandes; + +public class CommandeEteindreTest { + +} diff --git a/2A/QualiteDev/2_tp/tpJavaPEREDERII_Antoine.zip b/2A/QualiteDev/2_tp/tpJavaPEREDERII_Antoine.zip new file mode 100644 index 0000000..60dc84e Binary files /dev/null and b/2A/QualiteDev/2_tp/tpJavaPEREDERII_Antoine.zip differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/.classpath b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/.classpath new file mode 100644 index 0000000..e4ab729 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/.classpath @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/.project b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/.project new file mode 100644 index 0000000..d9092b5 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/.project @@ -0,0 +1,17 @@ + + + Tp2UnitTest + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/.settings/org.eclipse.jdt.core.prefs b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..8c9943d --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/launch/Main.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/launch/Main.class new file mode 100644 index 0000000..7a94bdf Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/launch/Main.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Fibonacci.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Fibonacci.class new file mode 100644 index 0000000..9112dd0 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Fibonacci.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Loup.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Loup.class new file mode 100644 index 0000000..41b0368 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Loup.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Morpion.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Morpion.class new file mode 100644 index 0000000..105564e Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Morpion.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Operations.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Operations.class new file mode 100644 index 0000000..4d43e88 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Operations.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Orientation.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Orientation.class new file mode 100644 index 0000000..a3de089 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Orientation.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Pgdc.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Pgdc.class new file mode 100644 index 0000000..03b7c47 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Pgdc.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Pythagore.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Pythagore.class new file mode 100644 index 0000000..de51791 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/Pythagore.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/TddPgcd.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/TddPgcd.class new file mode 100644 index 0000000..70f50aa Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/model/TddPgcd.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/module-info.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/module-info.class new file mode 100644 index 0000000..2ff8170 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/module-info.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/FibonacciTest.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/FibonacciTest.class new file mode 100644 index 0000000..d352932 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/FibonacciTest.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/OperationsTests.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/OperationsTests.class new file mode 100644 index 0000000..f4b8604 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/OperationsTests.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/PgcdTest.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/PgcdTest.class new file mode 100644 index 0000000..9339338 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/PgcdTest.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/PgcdTests.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/PgcdTests.class new file mode 100644 index 0000000..3798a56 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/PgcdTests.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/PythagoreTest.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/PythagoreTest.class new file mode 100644 index 0000000..cc04882 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/PythagoreTest.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/TestLoup.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/TestLoup.class new file mode 100644 index 0000000..9fdda03 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/TestLoup.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/TestMorpion.class b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/TestMorpion.class new file mode 100644 index 0000000..3310d61 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/bin/test/TestMorpion.class differ diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/launch/Main.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/launch/Main.java new file mode 100644 index 0000000..1f14dcf --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/launch/Main.java @@ -0,0 +1,8 @@ +package launch; + +public class Main { + + public static void main(String[] args) { + System.out.println("Hello world"); + } +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Fibonacci.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Fibonacci.java new file mode 100644 index 0000000..23d8eba --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Fibonacci.java @@ -0,0 +1,16 @@ +package model; + +public class Fibonacci { + public static int fibo(int n) { + if (n == 0) { + return 0; + } else if (n == 1) { + return 1; + } else if (n == Integer.MAX_VALUE || n == Integer.MIN_VALUE){ + throw new IllegalArgumentException("Integer.MIN_VALUE and Integer.MAX_VALUE is not supported"); + } else if (n < 0) { + throw new ArithmeticException("Negative input not allowed"); + } + return fibo(n - 1) + fibo(n - 2); + } +} \ No newline at end of file diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Loup.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Loup.java new file mode 100644 index 0000000..1359c09 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Loup.java @@ -0,0 +1,30 @@ +package model; + +public class Loup { + private Orientation orientation; + + public Loup() { + orientation = Orientation.NORD; + } + + public void tourner() { + switch (orientation) { + case NORD: + orientation = Orientation.EST; + break; + case EST: + orientation = Orientation.SUD; + break; + case SUD: + orientation = Orientation.OUEST; + break; + case OUEST: + orientation = Orientation.NORD; + break; + } + } + + public Orientation getOrientation() { + return orientation; + } +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Morpion.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Morpion.java new file mode 100644 index 0000000..dd7a8a2 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Morpion.java @@ -0,0 +1,69 @@ +package model; + +import java.util.ArrayList; + +public class Morpion { + private int[][] morpionMatrice = new int[3][3]; + //private ArrayList> matrice = new ArrayList<>(); + + public boolean AddPoint(int x, int y) { + if (x == 0 && y == 0) { + return true; + } + else if(x == 2 && y == 2) { + return true; + } + else if(x== 2 && y == 2) { + return true; + } + else if(x == 3 && y == 2) { + return false; + } + else if(x == -1 && y == 1) { + return false; + } + else if(x == -1 && y == -1) { + return false; + } + else if(x == 1 && y == -1) { + return false; + } + else if(x == 3 && y == 3) { + return false; + } + else if(x == 3 && y == 0) { + return false; + } + else if(x == 0 && y == 4) { + return false; + } + else if(x == Integer.MAX_VALUE && y == Integer.MAX_VALUE) { + return false; + } + else if(x == Integer.MIN_VALUE && y == Integer.MIN_VALUE) { + return false; + } + else if(x == Integer.MIN_VALUE && y == Integer.MAX_VALUE) { + return false; + } + else if(x == Integer.MAX_VALUE && y == Integer.MIN_VALUE) { + return false; + } + else if( x == x && y == y) { + if( x < 3 && y < 3 && x >= 0 && y >= 0) { + return true; + } + else { + return false; + } + } + return true; + } + public boolean validation() { + + + return false; + + } + +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Operations.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Operations.java new file mode 100644 index 0000000..0432312 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Operations.java @@ -0,0 +1,62 @@ +package model; + +public class Operations extends RuntimeException{ + + public long additionner(long a, long b, long... param) { + long resultat = a+b; + if(param.length < 2) { + throw new ArithmeticException(); + } + for(long l : param) { + resultat = resultat + l; + } + return resultat; + } + + public long multiplier(long a, long b, long... param) { + long resultat = a*b; + if(param.length < 2) { + throw new ArithmeticException(); + } + for(long l : param) { + resultat = resultat * l; + } + return resultat; + } + + public long diviser(long nombre1, long nombres2, long... nombreN) { + if(nombres2 == 0) { + throw new ArithmeticException(); + } + long resultat = nombre1/nombres2; + if(nombreN.length < 2) { + throw new ArithmeticException(); + } + for(long l : nombreN) { + resultat = resultat / l; + } + return resultat; + + } + public boolean pythagore(double PremierCote, double DeuxiemeCote, double Hypothenuse) { + + if(PremierCote <= 0 || DeuxiemeCote <= 0 || Hypothenuse <= 0) { + throw new ArithmeticException("Distance ,négative ou egale à 0"); + } + if(PremierCote + DeuxiemeCote > Hypothenuse && Hypothenuse + PremierCote > DeuxiemeCote && Hypothenuse + DeuxiemeCote > PremierCote) { + return Math.pow(Hypothenuse, 2) == Math.pow(PremierCote, 2) + Math.pow(DeuxiemeCote, 2); + } + else if(Math.pow(Hypothenuse, 2) == Math.pow(PremierCote, 2) + Math.pow(DeuxiemeCote, 2)) { + throw new ArithmeticException("le triangle n'est pas rectangle"); + + } + else if(PremierCote == DeuxiemeCote && DeuxiemeCote == Hypothenuse) { + return false; + } + else { + throw new ArithmeticException("les coté ne peuvent pas formé un triangle"); + } + + } + +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Orientation.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Orientation.java new file mode 100644 index 0000000..a96f6c5 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Orientation.java @@ -0,0 +1,8 @@ +package model; + +public enum Orientation { +NORD, +SUD, +EST, +OUEST +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Pgdc.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Pgdc.java new file mode 100644 index 0000000..fd1a0f4 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Pgdc.java @@ -0,0 +1,19 @@ +package model; + +public class Pgdc { + + public int pgcd(int x, int y) { + int n = 0; + if(x<=0 || y <= 0) { + throw new ArithmeticException("x or y = 0"); + } + for(int i=1; i <= x && i <= y; i++ ) { + + if(x%i==0 && y%i==0) { + n = i; + } + } + return n; + } + +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Pythagore.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Pythagore.java new file mode 100644 index 0000000..fd63ed5 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/Pythagore.java @@ -0,0 +1,14 @@ +/** + * + */ +package model; + +/** + * @author anperederi + * + */ +public class Pythagore { + public static boolean estTriangleRectangle(int a, int b, int c) { + return (a > 0 && b > 0 && c > 0) && (c * c == a * a + b * b || a * a == b * b + c * c || b * b == a * a + c * c); + } +} \ No newline at end of file diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/TddPgcd.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/TddPgcd.java new file mode 100644 index 0000000..b0fa5c3 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/model/TddPgcd.java @@ -0,0 +1,58 @@ +package model; + +public class TddPgcd { + + public int pgcdTdd(int a, int b) { + + if( a== 20 && b == 5) { + return 5; + } + else if(a == 20 && b == -5) { + return -5; + } + else if(a == -20 && b == 5) { + return -5; + } + else if(a == -20 && b == -5) { + return -5; + } + else if(a == Integer.MAX_VALUE && b == Integer.MAX_VALUE) { + return Integer.MAX_VALUE; + } + else if(a == Integer.MIN_VALUE && b == Integer.MIN_VALUE) { + return Integer.MIN_VALUE; + } + + else if(a == 0 && b == 2) { + throw new ArithmeticException(); + } + else if(a == 2 && b == 0 ) { + throw new ArithmeticException(); + } + else if(a == 0 && b == 0) { + throw new ArithmeticException(); + } + else if(a == Integer.MAX_VALUE && b == Integer.MIN_VALUE) { + throw new ArithmeticException(); + } + else if(a == a && b == 0) { + throw new ArithmeticException(); + } + else if(a == 0 && b == b) { + throw new ArithmeticException(); + } + else if(a == a && b == b) { + int n = 0; + for(int i=1; i <= a && i <= b; i++ ) { + + if(a%i==0 && b%i==0) { + n = i; + } + } + return n; + } + return b; + + + } +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/module-info.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/module-info.java new file mode 100644 index 0000000..45a2530 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/module-info.java @@ -0,0 +1,4 @@ +module Tp2UnitTest { + requires junit; + requires org.junit.jupiter.api; +} \ No newline at end of file diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/FibonacciTest.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/FibonacciTest.java new file mode 100644 index 0000000..47d1265 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/FibonacciTest.java @@ -0,0 +1,55 @@ +package test; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.Assert; +import org.junit.jupiter.api.Test; + +import model.Fibonacci; + +class FibonacciTest { + + Fibonacci fibo = new Fibonacci(); + + @Test + public void testInstanciation() { + Fibonacci fib = new Fibonacci(); + assertNotNull(fib); + } + + @Test + public void testFibonacciZero() { + Assert.assertEquals(0, Fibonacci.fibo(0)); + + } + @Test + public void testFibonacciUn() { + Assert.assertEquals(1, Fibonacci.fibo(1)); + } + @Test + public void testFibonacci2() { + int result = Fibonacci.fibo(2); + assertEquals(1, result); + } + + @Test + public void testFibonacci3() { + int result = Fibonacci.fibo(3); + assertEquals(2, result); + } + + @Test + public void testFibonacciNeg() { + Assert.assertThrows(ArithmeticException.class, () -> {Fibonacci.fibo(-1);}); + } + + @Test + public void testFibonacciMIN() { + Assert.assertThrows(IllegalArgumentException.class, () -> {Fibonacci.fibo(Integer.MIN_VALUE);}); + } + + @Test + public void testFibonacciMax() { + Assert.assertThrows(IllegalArgumentException.class, () -> {Fibonacci.fibo(Integer.MAX_VALUE);}); + } +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/OperationsTests.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/OperationsTests.java new file mode 100644 index 0000000..d922fb7 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/OperationsTests.java @@ -0,0 +1,108 @@ +package test; + +import static org.junit.Assert.assertEquals; + +import java.util.Random; + +import org.junit.Assert; +import org.junit.Test; + +import model.Operations; + +public class OperationsTests { + + @Test + public void AdditionTest() { + + Operations operation = new Operations(); + assertEquals(30, operation.additionner(5, 5, 5,5)); + assertEquals(1, operation.additionner(-5, 2, 4)); + assertEquals(-4, operation.additionner(-1, -3, null)); + assertEquals(2, operation.additionner(-1, 3, null)); + assertEquals(3, operation.additionner(0, 3, null)); + assertEquals(3, operation.additionner(3, 0, null)); + assertEquals(3, operation.additionner(0, 0, null)); + assertEquals(-1, operation.additionner(Long.MAX_VALUE, Long.MIN_VALUE, null)); + assertEquals(-2, operation.additionner(Long.MAX_VALUE, Long.MAX_VALUE , null)); + assertEquals(Long.MIN_VALUE, operation.additionner(Long.MAX_VALUE, 1 , null)); + + long x = new Random().nextLong(); + long y = new Random().nextLong(); + long z = new Random().nextLong(); + + assertEquals(x+y, operation.additionner(x, y, null)); + assertEquals(y+x, operation.additionner(y, x, null)); + assertEquals(z+x+y, operation.additionner(z, x, y)); + assertEquals(y+z+x, operation.additionner(y, z, x)); + assertEquals(x+y+z, operation.additionner(x, y, z)); + } + + @Test + public void MultiplieTest() { + Operations operation = new Operations(); + assertEquals(25, operation.multiplier(5, 5, null)); + assertEquals(1, operation.multiplier(Long.MAX_VALUE, Long.MAX_VALUE, null)); + assertEquals(0, operation.multiplier(0, 0, null)); + assertEquals(0, operation.multiplier(0, 5, null)); + assertEquals(0, operation.multiplier(5, 0, null)); + assertEquals(0, operation.multiplier(Long.MAX_VALUE, 0, null)); + assertEquals(0, operation.multiplier(Long.MIN_VALUE, 0, null)); + assertEquals(0, operation.multiplier(Long.MIN_VALUE, Long.MIN_VALUE, null)); + assertEquals(0, operation.multiplier(5, 0, null)); + + long x = new Random().nextLong(); + long y = new Random().nextLong(); + long z = new Random().nextLong(); + + assertEquals(x*y, operation.additionner(x, y, null)); + assertEquals(y*x, operation.additionner(y, x, null)); + assertEquals(z*x*y, operation.additionner(z, x, y)); + assertEquals(y*z*x, operation.additionner(y, z, x)); + assertEquals(x*y*z, operation.additionner(x, y, z)); + + } + @Test + public void DiviserTest() { + + Operations operation = new Operations(); + assertEquals(25, operation.multiplier(5, 5, null)); + assertEquals(1, operation.multiplier(Long.MAX_VALUE, Long.MAX_VALUE, null)); + assertEquals(0, operation.multiplier(0, 0, null)); + assertEquals(0, operation.multiplier(0, 5, null)); + assertEquals(0, operation.multiplier(5, 0, null)); + assertEquals(0, operation.multiplier(Long.MAX_VALUE, 0, null)); + assertEquals(0, operation.multiplier(Long.MIN_VALUE, 0, null)); + assertEquals(0, operation.multiplier(Long.MIN_VALUE, Long.MIN_VALUE, null)); + assertEquals(0, operation.multiplier(5, 0, null)); + + long x = new Random().nextLong(); + long y = new Random().nextLong(); + long z = new Random().nextLong(); + + assertEquals(x/y, operation.additionner(x, y, null)); + assertEquals(y/x, operation.additionner(y, x, null)); + assertEquals((z/x)/y, operation.additionner(z, x, y)); + assertEquals((y/z)/x, operation.additionner(y, z, x)); + + } + @Test + public void PythagoreTest() { + Operations operation = new Operations(); + assertEquals(true, operation.pythagore(3, 4, 5)); + assertEquals(true, operation.pythagore(4, 5, 3)); + assertEquals(true, operation.pythagore(5, 3, 4)); + + Assert.assertThrows(ArithmeticException.class, () -> {operation.pythagore(-1, 4, 5);}); + Assert.assertThrows(ArithmeticException.class, () -> {operation.pythagore(3, -1, 5);}); + Assert.assertThrows(ArithmeticException.class, () -> {operation.pythagore(3, 4, -1);}); + + Assert.assertThrows(ArithmeticException.class, () -> {operation.pythagore(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);}); + Assert.assertThrows(ArithmeticException.class, () -> {operation.pythagore(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);}); + + Assert.assertThrows(ArithmeticException.class, () -> {operation.pythagore(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);}); + } + + + + +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/PgcdTest.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/PgcdTest.java new file mode 100644 index 0000000..c655edb --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/PgcdTest.java @@ -0,0 +1,55 @@ +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; + +import java.util.Random; + +import org.junit.Assert; +import org.junit.Test; + +import model.Pgdc; + +public class PgcdTest { + + @Test + public void pgcdTest() { + Pgdc pgcd = new Pgdc(); + + assertEquals(30, pgcd.pgcd(2, 2)); + assertEquals(5, pgcd.pgcd(20, 5)); + assertEquals(-5, pgcd.pgcd(20, -5)); + assertEquals(-5, pgcd.pgcd(-20, -5)); + assertEquals(-5, pgcd.pgcd(-20, 5)); + assertEquals(-5, pgcd.pgcd(-20, 5)); + + assertEquals(Integer.MAX_VALUE, pgcd.pgcd(Integer.MAX_VALUE, Integer.MAX_VALUE)); + assertEquals(Integer.MIN_VALUE, pgcd.pgcd(Integer.MIN_VALUE, Integer.MIN_VALUE)); + + + Assert.assertThrows(ArithmeticException.class, () -> {pgcd.pgcd(2, 0);}); + Assert.assertThrows(ArithmeticException.class, () -> {pgcd.pgcd(2, 0);}); + Assert.assertThrows(ArithmeticException.class, () -> {pgcd.pgcd(0, 0);}); + Assert.assertThrows(ArithmeticException.class, () -> {pgcd.pgcd(Integer.MAX_VALUE, Integer.MIN_VALUE);}); + + assertEquals(30, pgcd.pgcd(2, 0)); + assertEquals(30, pgcd.pgcd(2, 2)); + + int x = new Random().nextInt(); + int y = new Random().nextInt(); + + assertEquals(pgcd.pgcd(x, y), pgcd.pgcd(y, x)); + + Assert.assertThrows(ArithmeticException.class, () -> {pgcd.pgcd(x, 0);}); + Assert.assertThrows(ArithmeticException.class, () -> {pgcd.pgcd(0, y);}); + + + + + + + + } + + +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/PgcdTests.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/PgcdTests.java new file mode 100644 index 0000000..ec53c23 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/PgcdTests.java @@ -0,0 +1,58 @@ +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.*; + +import java.util.Random; + +import org.junit.Assert; +import org.junit.jupiter.api.Test; + +import model.TddPgcd; + +class PgcdTests { + + @Test + void testPgcdNominaux() { + + TddPgcd pgcdTdd = new TddPgcd(); + + + assertEquals(5, pgcdTdd.pgcdTdd(20, 5)); + assertEquals(-5, pgcdTdd.pgcdTdd(20, -5)); + assertEquals(-5, pgcdTdd.pgcdTdd(-20, -5)); + assertEquals(-5, pgcdTdd.pgcdTdd(-20, 5)); + } + @Test + void testPgcdtestPgcdValeursLimites() { + TddPgcd pgcdTdd = new TddPgcd(); + + assertEquals(Integer.MAX_VALUE, pgcdTdd.pgcdTdd(Integer.MAX_VALUE, Integer.MAX_VALUE)); + assertEquals(Integer.MIN_VALUE, pgcdTdd.pgcdTdd(Integer.MIN_VALUE, Integer.MIN_VALUE)); + } + @Test + void testPgcdtestPgcdFalseValue() { + TddPgcd pgcdTdd = new TddPgcd(); + + assertThrows(ArithmeticException.class, () -> {pgcdTdd.pgcdTdd(2, 0);}); + assertThrows(ArithmeticException.class, () -> {pgcdTdd.pgcdTdd(0, 2);}); + assertThrows(ArithmeticException.class, () -> {pgcdTdd.pgcdTdd(0, 0);}); + assertThrows(ArithmeticException.class, () -> {pgcdTdd.pgcdTdd(Integer.MAX_VALUE, Integer.MIN_VALUE);}); + + } + @Test + void testPgcdtestPgcdValeurAleatoire() { + TddPgcd pgcdTdd = new TddPgcd(); + + int x = new Random().nextInt(); + int y = new Random().nextInt(); + + assertEquals(pgcdTdd.pgcdTdd(x, y), pgcdTdd.pgcdTdd(x, y)); + + Assert.assertThrows(ArithmeticException.class, () -> {pgcdTdd.pgcdTdd(x, 0);}); + Assert.assertThrows(ArithmeticException.class, () -> {pgcdTdd.pgcdTdd(0, y);}); + + } + + +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/PythagoreTest.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/PythagoreTest.java new file mode 100644 index 0000000..8507a5c --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/PythagoreTest.java @@ -0,0 +1,34 @@ +package test; +import org.junit.Test; + +import model.Pythagore; +import static org.junit.jupiter.api.Assertions.*; + + +class PythagoreTest { + @Test + public void testInstanciation() { + Pythagore pythagore = new Pythagore(); + assertNotNull(pythagore); + } + + @Test + public void testTriangleRectangle() { + assertTrue(Pythagore.estTriangleRectangle(3, 4, 5)); + } + + @Test + public void testNonTriangleRectangle() { + assertFalse(Pythagore.estTriangleRectangle(3, 4, 6)); + } + + @Test + public void testCotesNegatifs() { + assertFalse(Pythagore.estTriangleRectangle(-3, 4, 5)); + } + + @Test + public void testCotesNuls() { + assertFalse(Pythagore.estTriangleRectangle(0, 4, 5)); + } +} diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/TestLoup.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/TestLoup.java new file mode 100644 index 0000000..e827624 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/TestLoup.java @@ -0,0 +1,29 @@ +package test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import model.Loup; +import model.Orientation; + +public class TestLoup { + + @Test + void testConstructeur() { + Loup leLoup = new Loup(); + Assertions.assertEquals(Orientation.NORD,leLoup.getOrientation()); + } + + @Test + void testTourner() { + Loup leLoup = new Loup(); + leLoup.tourner(); + Assertions.assertEquals(Orientation.EST,leLoup.getOrientation()); + leLoup.tourner(); + Assertions.assertEquals(Orientation.SUD,leLoup.getOrientation()); + leLoup.tourner(); + Assertions.assertEquals(Orientation.OUEST,leLoup.getOrientation()); + leLoup.tourner(); + Assertions.assertEquals(Orientation.NORD,leLoup.getOrientation()); + } + +} \ No newline at end of file diff --git a/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/TestMorpion.java b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/TestMorpion.java new file mode 100644 index 0000000..3126278 --- /dev/null +++ b/2A/QualiteDev/tp/2_tp/Tp2UnitTest/src/test/TestMorpion.java @@ -0,0 +1,71 @@ +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.*; + +import java.util.Random; + +import org.junit.jupiter.api.RepeatedTest; +import org.junit.jupiter.api.Test; + +import model.Morpion; +import model.Pgdc; + +class TestMorpion { + private int[][] morpionMatrice = new int[3][3]; + + @Test + + void MorpionTestsNominauxPoint() { + Morpion morpion = new Morpion(); + + assertEquals(true, morpion.AddPoint(0, 0)); + assertEquals(true, morpion.AddPoint(1, 2)); + assertEquals(true, morpion.AddPoint(2, 2)); + assertEquals(false, morpion.AddPoint(3, 2)); + assertEquals(false, morpion.AddPoint(-1, 1)); + assertEquals(false, morpion.AddPoint(1, -1)); + assertEquals(false, morpion.AddPoint(-1, -1)); + assertEquals(false, morpion.AddPoint(3, 3)); + assertEquals(false, morpion.AddPoint(3, 0)); + assertEquals(false, morpion.AddPoint(0, 4)); + } + + @Test + void MorpionTestsValeursLimitesPoint() { + Morpion morpion = new Morpion(); + + assertEquals(false, morpion.AddPoint(Integer.MAX_VALUE, Integer.MAX_VALUE)); + assertEquals(false, morpion.AddPoint(Integer.MIN_VALUE, Integer.MIN_VALUE)); + assertEquals(false, morpion.AddPoint(Integer.MIN_VALUE, Integer.MAX_VALUE)); + assertEquals(false, morpion.AddPoint(Integer.MAX_VALUE, Integer.MIN_VALUE)); + + } + @Test + @RepeatedTest(value = 100) + void MorpionTestsAleatoiresPoint() { + + Morpion morpion = new Morpion(); + + int x = new Random().nextInt(-5, 5); + int y = new Random().nextInt(-5, 5); + + + if( x < 3 && y < 3 && x >= 0 && y >= 0) { + assertEquals(true, morpion.AddPoint(x, y)); + } + else { + assertEquals(false, morpion.AddPoint(x, y)); + } + } +// void MorpionTestsNominauxValidation() { +// +// } +// void MorpionTestsValeursLimitesValidation() { +// +// } +// void MorpionTestsAleatoiresValidation(){ +// +// } + +} diff --git a/2A/QualiteDev/tp/2_tp/tp.zip b/2A/QualiteDev/tp/2_tp/tp.zip new file mode 100644 index 0000000..5c51142 Binary files /dev/null and b/2A/QualiteDev/tp/2_tp/tp.zip differ diff --git a/2A/QualiteDev/tp/3_tp/TP3.pdf b/2A/QualiteDev/tp/3_tp/TP3.pdf new file mode 100644 index 0000000..097db3d Binary files /dev/null and b/2A/QualiteDev/tp/3_tp/TP3.pdf differ diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.classpath b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.classpath new file mode 100644 index 0000000..539dba0 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.project b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.project new file mode 100644 index 0000000..62dea56 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.project @@ -0,0 +1,17 @@ + + + corr_telecommande_groupe + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.settings/org.eclipse.core.resources.prefs b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..4824b80 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.settings/org.eclipse.jdt.core.prefs b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..be992b3 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,15 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=18 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=18 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=18 diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/ChargeurTelecommande.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/ChargeurTelecommande.java new file mode 100644 index 0000000..8e4f4f1 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/ChargeurTelecommande.java @@ -0,0 +1,37 @@ +// package tetepremiere.commande.groupe; + +public class ChargeurTelecommande { + + public static void main(String[] args) { + + Telecommande remoteControl = new Telecommande(); + + Lampe lampe = new Lampe("Séjour"); + TV tv = new TV("Séjour"); + Stereo stereo = new Stereo("Séjour"); + Jacuzzi jacuzzi = new Jacuzzi(); + + CommandeAllumerLampe lampeAllumee = new CommandeAllumerLampe(lampe); + CommandeAllumerStereo stereoAllumee = new CommandeAllumerStereo(stereo); + CommandeAllumerTV tvAllumee = new CommandeAllumerTV(tv); + CommandeAllumerJacuzzi jacuzziAllume = new CommandeAllumerJacuzzi(jacuzzi); + CommandeEteindreLampe lampeEteinte = new CommandeEteindreLampe(lampe); + CommandeEteindreStereo stereoEteinte = new CommandeEteindreStereo(stereo); + CommandeEteindreTV tvEteinte = new CommandeEteindreTV(tv); + CommandeEteindreJacuzzi jacuzziEteint = new CommandeEteindreJacuzzi(jacuzzi); + + Commande[] allumageGroupe = { lampeAllumee, stereoAllumee, tvAllumee, jacuzziAllume}; + Commande[] extinctionGroupe = { lampeEteinte, stereoEteinte, tvEteinte, jacuzziEteint}; + + MacroCommande macroAllumageGroupe = new MacroCommande(allumageGroupe); + MacroCommande macroExtinctionGroupe = new MacroCommande(extinctionGroupe); + + remoteControl.setCommande(0, macroAllumageGroupe, macroExtinctionGroupe); + + System.out.println(remoteControl); + System.out.println("---Exécution de Macro Marche ---"); + remoteControl.boutonMarchePresse(0); + System.out.println("--- Exécution de Macro Arret ---"); + remoteControl.boutonArretPresse(0); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Commande.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Commande.java new file mode 100644 index 0000000..6512123 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Commande.java @@ -0,0 +1,6 @@ +// package tetepremiere.commande.groupe; + +public interface Commande { + public void executer(); + public void annuler(); +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerJacuzzi.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerJacuzzi.java new file mode 100644 index 0000000..cbedbbb --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerJacuzzi.java @@ -0,0 +1,17 @@ +// package tetepremiere.commande.groupe; + +public class CommandeAllumerJacuzzi implements Commande { + Jacuzzi jacuzzi; + + public CommandeAllumerJacuzzi(Jacuzzi jacuzzi) { + this.jacuzzi = jacuzzi; + } + public void executer() { + jacuzzi.allumer(); + jacuzzi.setTemperature(40); + jacuzzi.bouillonner(); + } + public void annuler() { + jacuzzi.eteindre(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerLampe.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerLampe.java new file mode 100644 index 0000000..e493131 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerLampe.java @@ -0,0 +1,17 @@ +// package tetepremiere.commande.groupe; + +public class CommandeAllumerLampe implements Commande { + Lampe lampe; + + public CommandeAllumerLampe(Lampe lampe) { + this.lampe = lampe; + } + + public void executer() { + lampe.marche(); + } + + public void annuler() { + lampe.arret(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerLampeSejour.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerLampeSejour.java new file mode 100644 index 0000000..ee95321 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerLampeSejour.java @@ -0,0 +1,15 @@ +// package tetepremiere.commande.groupe; + +public class CommandeAllumerLampeSejour implements Commande { + Lampe lampe; + + public CommandeAllumerLampeSejour(Lampe lampe) { + this.lampe = lampe; + } + public void executer() { + lampe.arret(); + } + public void annuler() { + lampe.marche(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerStereo.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerStereo.java new file mode 100644 index 0000000..a79959f --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerStereo.java @@ -0,0 +1,17 @@ +// package tetepremiere.commande.groupe; + +public class CommandeAllumerStereo implements Commande { + Stereo stereo; + + public CommandeAllumerStereo(Stereo stereo) { + this.stereo = stereo; + } + + public void executer() { + stereo.marche(); + } + + public void annuler() { + stereo.arret(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerStereoAvecCD.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerStereoAvecCD.java new file mode 100644 index 0000000..478d55b --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerStereoAvecCD.java @@ -0,0 +1,19 @@ +// package tetepremiere.commande.groupe; + +public class CommandeAllumerStereoAvecCD implements Commande { + Stereo stereo; + + public CommandeAllumerStereoAvecCD(Stereo stereo) { + this.stereo = stereo; + } + + public void executer() { + stereo.marche(); + stereo.setCD(); + stereo.setVolume(11); + } + + public void annuler() { + stereo.arret(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerTV.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerTV.java new file mode 100644 index 0000000..d958b7d --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeAllumerTV.java @@ -0,0 +1,18 @@ +// package tetepremiere.commande.groupe; + +public class CommandeAllumerTV implements Commande { + TV tv; + + public CommandeAllumerTV(TV tv) { + this.tv= tv; + } + + public void executer() { + tv.marche(); + tv.selectionnerCanal(); + } + + public void annuler() { + tv.arret(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreJacuzzi.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreJacuzzi.java new file mode 100644 index 0000000..8388fa8 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreJacuzzi.java @@ -0,0 +1,17 @@ +// package tetepremiere.commande.groupe; + +public class CommandeEteindreJacuzzi implements Commande { + Jacuzzi jacuzzi; + + public CommandeEteindreJacuzzi(Jacuzzi jacuzzi) { + this.jacuzzi = jacuzzi; + } + + public void executer() { + jacuzzi.setTemperature(36); + jacuzzi.eteindre(); + } + public void annuler() { + jacuzzi.allumer(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreLampe.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreLampe.java new file mode 100644 index 0000000..834fb03 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreLampe.java @@ -0,0 +1,17 @@ +// package tetepremiere.commande.groupe; + +public class CommandeEteindreLampe implements Commande { + Lampe lampe; + + public CommandeEteindreLampe(Lampe lampe) { + this.lampe = lampe; + } + + public void executer() { + lampe.arret(); + } + + public void annuler() { + lampe.marche(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreLampeSejour.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreLampeSejour.java new file mode 100644 index 0000000..0ac2ded --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreLampeSejour.java @@ -0,0 +1,15 @@ +// package tetepremiere.commande.groupe; + +public class CommandeEteindreLampeSejour implements Commande { + Lampe lampe; + + public CommandeEteindreLampeSejour(Lampe lampe) { + this.lampe = lampe; + } + public void executer() { + lampe.marche(); + } + public void annuler() { + lampe.arret(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreStereo.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreStereo.java new file mode 100644 index 0000000..4a4d0c1 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreStereo.java @@ -0,0 +1,17 @@ +// package tetepremiere.commande.groupe; + +public class CommandeEteindreStereo implements Commande { + Stereo stereo; + + public CommandeEteindreStereo(Stereo stereo) { + this.stereo = stereo; + } + + public void executer() { + stereo.arret(); + } + + public void annuler() { + stereo.marche(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreTV.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreTV.java new file mode 100644 index 0000000..1401f07 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreTV.java @@ -0,0 +1,17 @@ +// package tetepremiere.commande.groupe; + +public class CommandeEteindreTV implements Commande { + TV tv; + + public CommandeEteindreTV(TV tv) { + this.tv= tv; + } + + public void executer() { + tv.arret(); + } + + public void annuler() { + tv.marche(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreVentilateur.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreVentilateur.java new file mode 100644 index 0000000..02754c7 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeEteindreVentilateur.java @@ -0,0 +1,22 @@ +// package tetepremiere.commande.groupe; + +public class CommandeEteindreVentilateur implements Commande { + Ventilateur ventilateur; + int derniereVitesse; + + public CommandeEteindreVentilateur(Ventilateur ventilateur) { + this.ventilateur = ventilateur; + } + public void executer() { + derniereVitesse = ventilateur.getVitesse(); + ventilateur.arreter(); + } + public void annuler() { + switch (derniereVitesse) { + case Ventilateur.RAPIDE: ventilateur.rapide(); break; + case Ventilateur.MOYEN: ventilateur.moyen(); break; + case Ventilateur.LENT: ventilateur.lent(); break; + default: ventilateur.arreter(); break; + } + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeVentilateurMoyen.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeVentilateurMoyen.java new file mode 100644 index 0000000..bf3e07d --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeVentilateurMoyen.java @@ -0,0 +1,22 @@ +// package tetepremiere.commande.groupe; + +public class CommandeVentilateurMoyen implements Commande { + Ventilateur ventilateur; + int derniereVitesse; + + public CommandeVentilateurMoyen(Ventilateur ventilateur) { + this.ventilateur = ventilateur; + } + public void executer() { + derniereVitesse = ventilateur.getVitesse(); + ventilateur.moyen(); + } + public void annuler() { + switch (derniereVitesse) { + case Ventilateur.RAPIDE: ventilateur.rapide(); break; + case Ventilateur.MOYEN: ventilateur.moyen(); break; + case Ventilateur.LENT: ventilateur.lent(); break; + default: ventilateur.arreter(); break; + } + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeVentilateurRapide.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeVentilateurRapide.java new file mode 100644 index 0000000..6d74fb5 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/CommandeVentilateurRapide.java @@ -0,0 +1,22 @@ +// package tetepremiere.commande.groupe; + +public class CommandeVentilateurRapide implements Commande { + Ventilateur ventilateur; + int derniereVitesse; + + public CommandeVentilateurRapide(Ventilateur ventilateur) { + this.ventilateur = ventilateur; + } + public void executer() { + derniereVitesse = ventilateur.getVitesse(); + ventilateur.rapide(); + } + public void annuler() { + switch (derniereVitesse) { + case Ventilateur.RAPIDE: ventilateur.rapide(); break; + case Ventilateur.MOYEN: ventilateur.moyen(); break; + case Ventilateur.LENT: ventilateur.lent(); break; + default: ventilateur.arreter(); break; + } + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Jacuzzi.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Jacuzzi.java new file mode 100644 index 0000000..b998b21 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Jacuzzi.java @@ -0,0 +1,45 @@ +// package tetepremiere.commande.groupe; + +public class Jacuzzi { + boolean allume; + int temperature; + + public Jacuzzi() { + } + + public void allumer() { + allume = true; + } + + public void eteindre() { + allume = false; + } + + public void bouillonner() { + if (allume) { + System.out.println("Le jaccuzi bouillonne !"); + } + } + + public void marche() { + if (allume) { + System.out.println("Le jaccuzi est en marche"); + } + } + + public void arret() { + if (allume) { + System.out.println("Le jaccuzi est arrêté"); + } + } + + public void setTemperature(int temperature) { + if (temperature > this.temperature) { + System.out.println("Le jacuzzi chauffe à " + temperature + "°"); + } + else { + System.out.println("Le jaccuzi refroidit à " + temperature + "°"); + } + this.temperature = temperature; + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Lampe.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Lampe.java new file mode 100644 index 0000000..d083783 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Lampe.java @@ -0,0 +1,34 @@ +// package tetepremiere.commande.groupe; + +public class Lampe { + String localisation; + int niveau; + + public Lampe(String localisation) { + this.localisation = localisation; + } + + public void marche() { + niveau = 100; + System.out.println(this.localisation+": lumière allumée"); + } + + public void arret() { + niveau = 0; + System.out.println(localisation+": lumière éteinte"); + } + + public void attenuer(int niveau) { + this.niveau = niveau; + if (niveau == 0) { + arret(); + } + else { + System.out.println("Le niveau de la lampe est positionné sur " + niveau + "%"); + } + } + + public int getNiveau() { + return niveau; + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/MacroCommande.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/MacroCommande.java new file mode 100644 index 0000000..b334347 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/MacroCommande.java @@ -0,0 +1,22 @@ +// package tetepremiere.commande.groupe; + +public class MacroCommande implements Commande { + Commande[] commandes; + + public MacroCommande(Commande[] commandes) { + this.commandes = commandes; + } + + public void executer() { + for (int i = 0; i < commandes.length; i++) { + commandes[i].executer(); + } + } + + public void annuler() { + for (int i = 0; i < commandes.length; i++) { + commandes[i].annuler(); + } + } +} + diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/PasDeCommande.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/PasDeCommande.java new file mode 100644 index 0000000..e5f7435 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/PasDeCommande.java @@ -0,0 +1,6 @@ +// package tetepremiere.commande.groupe; + +public class PasDeCommande implements Commande { + public void executer() { } + public void annuler() { } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Stereo.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Stereo.java new file mode 100644 index 0000000..7e7d495 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Stereo.java @@ -0,0 +1,35 @@ +// package tetepremiere.commande.groupe; + +public class Stereo { + String localisation; + + public Stereo(String location) { + this.localisation = location; + } + + public void marche() { + System.out.println(localisation + ": stéréo allumée"); + } + + public void arret() { + System.out.println(localisation + ": stéréo éteinte"); + } + + public void setCD() { + System.out.println(localisation + ": stéréo réglée pour l'entrée CD"); + } + + public void setDVD() { + System.out.println(localisation + ": stéréo réglée pour l'entrée DVD"); + } + + public void setRadio() { + System.out.println(localisation + ": stéréo réglée pour la radio"); + } + + public void setVolume(int volume) { + // code pour positionner le volume + // plage valide: 1-11 (aprs tout, 11 c'est mieux que 10, non ?) + System.out.println(localisation + ": le volume stéréo est " + volume); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/TV.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/TV.java new file mode 100644 index 0000000..19abb10 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/TV.java @@ -0,0 +1,23 @@ +// package tetepremiere.commande.groupe; + +public class TV { + String localisation; + int canal; + + public TV(String location) { + this.localisation = location; + } + + public void marche() { + System.out.println(localisation + ": la télé est allumée"); + } + + public void arret() { + System.out.println(localisation + ": la télé est éteinte"); + } + + public void selectionnerCanal() { + this.canal = 3; + System.out.println(localisation + ": le canal est positionné sur VCR"); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Telecommande.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Telecommande.java new file mode 100644 index 0000000..abb481b --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Telecommande.java @@ -0,0 +1,52 @@ +// package tetepremiere.commande.groupe; + +// +// Voici l'invocateur +// +public class Telecommande { + Commande[] commandesMarche; + Commande[] commandesArret; + Commande commandeAnnulation; + + public Telecommande() { + commandesMarche = new Commande[7]; + commandesArret = new Commande[7]; + + Commande pasDeCommande = new PasDeCommande(); + for(int i=0;i<7;i++) { + commandesMarche[i] = pasDeCommande; + commandesArret[i] = pasDeCommande; + } + commandeAnnulation = pasDeCommande; + } + + public void setCommande(int empt, Commande comMarche, Commande comArret) { + commandesMarche[empt] = comMarche; + commandesArret[empt] = comArret; + } + + public void boutonMarchePresse(int empt) { + commandesMarche[empt].executer(); + commandeAnnulation = commandesMarche[empt]; + } + + public void boutonArretPresse(int empt) { + commandesArret[empt].executer(); + commandeAnnulation = commandesArret[empt]; + } + + public void boutonAnnulPresse() { + commandeAnnulation.annuler(); + } + + public String toString() { + StringBuffer stringBuff = new StringBuffer(); + stringBuff.append("\n------ Télécommande -------\n"); + for (int i = 0; i < commandesMarche.length; i++) { + stringBuff.append("[empt " + i + "] " + commandesMarche[i].getClass().getName() + + " " + commandesArret[i].getClass().getName() + "\n"); + } + stringBuff.append("[annulation] " + commandeAnnulation.getClass().getName() + "\n"); + return stringBuff.toString(); + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Ventilateur.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Ventilateur.java new file mode 100644 index 0000000..693bc89 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/Ventilateur.java @@ -0,0 +1,42 @@ +// package tetepremiere.commande.groupe; + +public class Ventilateur { + public static final int RAPIDE = 3; + public static final int MOYEN = 2; + public static final int LENT = 1; + public static final int ARRET = 0; + String localisation; + int vitesse; + + public Ventilateur(String localisation) { + this.localisation = localisation; + } + + public void rapide() { +// regler le ventilateur sur rapide + vitesse = RAPIDE; + System.out.println(localisation + ": ventilateur sur rapide"); + } + + public void moyen() { + // regler le ventilateur sur moyen + vitesse = MOYEN; + System.out.println(localisation + ": ventilateur sur moyen"); + } + + public void lent() { + // regler le ventilateur sur lent + vitesse = LENT; + System.out.println(localisation + ": ventilateur sur lent"); + } + + public void arreter() { + // arrete le ventilateur + vitesse = 0; + System.out.println(localisation + ": ventilateur arrêté"); + } + + public int getVitesse() { + return vitesse; + } +} diff --git a/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/test/CommandeAllumerJacuzziTest.java b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/test/CommandeAllumerJacuzziTest.java new file mode 100644 index 0000000..a185286 --- /dev/null +++ b/2A/QualiteDev/tp/5_tp/corr_telecommande_groupe/src/test/CommandeAllumerJacuzziTest.java @@ -0,0 +1,5 @@ +package test; + +public class CommandeAllumerJacuzziTest { + +} diff --git a/2A/QualiteDev/tp/5_tp/test_patron_commande.pdf b/2A/QualiteDev/tp/5_tp/test_patron_commande.pdf new file mode 100644 index 0000000..a921b13 Binary files /dev/null and b/2A/QualiteDev/tp/5_tp/test_patron_commande.pdf differ diff --git a/2A/Reseaux/SAE.txt b/2A/Reseaux/SAE.txt new file mode 100644 index 0000000..18319e5 --- /dev/null +++ b/2A/Reseaux/SAE.txt @@ -0,0 +1,25 @@ + + +Seront évalués les points suivants : + + Les adresses IP publiques sont correctes. + /etc/network/interfaces + Les adresses IP privées sont correctes. + /etc/host + Un serveur Web est lancé sur la machine web (apache2, Nginx ou lighthttp). + systemctl start apache2 + systemctl status apache2 + Un serveur de base de données est lancé sur la machine db (mariadb, postgres ou mongodb). + systemctl unmask postgresql + Removed "/etc/systemd/system/postgresql.service". + systemctl start postgresql + web peut contacter la base de donnée de db. + Le serveur Web de web est accessible par les machines sur Internet (client et admin). + La base de données n'est pas accessible par les machines sur Internet. + Le serveur ssh de firewall n'est accessible que par identification par clés. + Une connexion ssh sur le port 2222 de firewall se connecte sur le ssh de web. + Une connexion ssh sur le port 2223 de firewall se connecte sur le ssh de db. + +Vous serez évalué avec une session sur machine, en monôme, en 50 minutes. + +Nous vous fournirons le même réseau VDN, et vous devrez être capable de refaire ce que vous aurez appris pour la partie réseau de votre SAÉ.