Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove jersey #77

Merged
merged 6 commits into from
Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ hs_err_pid*
*.properties
target/
build/
out/
!application.properties
!system.properties
.gradle/
!src/test/resources/credentials.properties
18 changes: 13 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext {
springBootVersion = '2.2.6.RELEASE'
springBootVersion = '2.3.1.RELEASE'
}
repositories {
jcenter()
Expand All @@ -20,7 +20,7 @@ plugins {
apply plugin: 'org.springframework.boot'

group = 'com.tibiawiki'
version = '1.8.2'
version = '1.9.0'
description = 'TibiaWikiApi'
sourceCompatibility = '14'
targetCompatibility = '14'
Expand All @@ -46,21 +46,25 @@ ext {

dependencies {
implementation "org.springframework.boot:spring-boot-starter:${springBootVersion}"
implementation "org.springframework.boot:spring-boot-starter-jersey:${springBootVersion}"
implementation "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
implementation "benjaminkomen:jwiki:2.2.0"
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
implementation "org.slf4j:slf4j-log4j12:${slf4jVersion}"
implementation "org.json:json:20200518"
implementation "io.swagger:swagger-jersey2-jaxrs:1.6.1"
implementation "com.google.guava:guava:29.0-jre"
implementation "io.vavr:vavr:0.10.3"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testImplementation "org.mockito:mockito-core:3.3.3"
testImplementation "org.hamcrest:hamcrest:2.2"
testImplementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
testImplementation("org.springframework.boot:spring-boot-starter-test:${springBootVersion}") {
exclude group: 'com.vaadin.external.google', module: 'android-json'
}
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
compileOnly "org.projectlombok:lombok:${lombokVersion}"

implementation "io.swagger.core.v3:swagger-annotations:2.1.2"
implementation "org.springdoc:springdoc-openapi-ui:1.4.2"
}

sonarqube {
Expand Down Expand Up @@ -108,6 +112,10 @@ configurations {
integrationTestImplementation.extendsFrom testImplementation
}

springBoot {
buildInfo()
}

idea {
module {
testSourceDirs += sourceSets.integrationTest.java.srcDirs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.tibiawiki.serviceinterface;
package com.tibiawiki.controller;

import com.tibiawiki.domain.enums.InfoboxTemplate;
import com.tibiawiki.domain.enums.YesNo;
Expand Down Expand Up @@ -38,20 +38,22 @@ public class AchievementsResourceIT {
private TestRestTemplate restTemplate;

@MockBean
private ArticleRepository articleRepository; // don't instantiate this real class, but use a mock implementation

private static final String INFOBOX_ACHIEVEMENT_TEXT = "{{Infobox Achievement|List={{{1|}}}|GetValue={{{GetValue|}}}\n" +
"| grade = 1\n" +
"| name = Goo Goo Dancer\n" +
"| description = Seeing a mucus plug makes your heart dance and you can't resist to see what it hides. Goo goo away!\n" +
"| spoiler = Obtainable by using 100 [[Muck Remover]]s on [[Mucus Plug]]s.\n" +
"| premium = yes\n" +
"| points = 1\n" +
"| secret = yes\n" +
"| implemented = 9.6\n" +
"| achievementid = 319\n" +
"| relatedpages = [[Muck Remover]], [[Mucus Plug]]\n" +
"}}\n";
private ArticleRepository articleRepository;

private static final String INFOBOX_ACHIEVEMENT_TEXT = """
{{Infobox Achievement|List={{{1|}}}|GetValue={{{GetValue|}}}
| grade = 1
| name = Goo Goo Dancer
| description = Seeing a mucus plug makes your heart dance and you can't resist to see what it hides. Goo goo away!
| spoiler = Obtainable by using 100 [[Muck Remover]]s on [[Mucus Plug]]s.
| premium = yes
| points = 1
| secret = yes
| implemented = 9.6
| achievementid = 319
| relatedpages = [[Muck Remover]], [[Mucus Plug]]
}}
""";

@Test
void givenGetAchievementsNotExpanded_whenCorrectRequest_thenResponseIsOkAndContainsTwoAchievementNames() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.tibiawiki.serviceinterface;
package com.tibiawiki.controller;

import com.tibiawiki.domain.enums.BookType;
import com.tibiawiki.domain.enums.InfoboxTemplate;
Expand Down Expand Up @@ -34,25 +34,22 @@
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class BooksResourceIT {

private static final String INFOBOX_BOOK_TEXT = "{{Infobox Book|List={{{1|}}}|GetValue={{{GetValue|}}}\n" +
"| booktype = Book (Brown)\n" +
"| title = Dungeon Survival Guide\n" +
"| pagename = Dungeon Survival Guide (Book)\n" +
"| location = [[Rookgaard Academy]]\n" +
"| blurb = Tips for exploring dungeons, and warning against being reckless.\n" +
"| returnpage = Rookgaard Libraries\n" +
"| relatedpages = [[Rope]], [[Shovel]]\n" +
"| text = Dungeon Survival Guide<br><br>Don't explore the dungeons before you tested your skills" +
" in the training cellars of our academy. You will find dungeons somewhere in the wilderness. Don't enter" +
" dungeons without equipment. Especially a rope and a shovel will prove valuable. Make sure you have a" +
" supply of torches with you, while wandering into the unknown. It's wise to travel the dungeons in groups" +
" and not alone. For more help read all the books of the academy before you begin exploring. Traveling in" +
" the dungeons will reward the cautious and brave, but punish the reckless.\n" +
"}}\n";
private static final String INFOBOX_BOOK_TEXT = """
{{Infobox Book|List={{{1|}}}|GetValue={{{GetValue|}}}
| booktype = Book (Brown)
| title = Dungeon Survival Guide
| pagename = Dungeon Survival Guide (Book)
| location = [[Rookgaard Academy]]
| blurb = Tips for exploring dungeons, and warning against being reckless.
| returnpage = Rookgaard Libraries
| relatedpages = [[Rope]], [[Shovel]]
| text = Dungeon Survival Guide<br><br>Don't explore the dungeons before you tested your skills in the training cellars of our academy. You will find dungeons somewhere in the wilderness. Don't enter dungeons without equipment. Especially a rope and a shovel will prove valuable. Make sure you have a supply of torches with you, while wandering into the unknown. It's wise to travel the dungeons in groups and not alone. For more help read all the books of the academy before you begin exploring. Traveling in the dungeons will reward the cautious and brave, but punish the reckless.
}}
""";
@Autowired
private TestRestTemplate restTemplate;
@MockBean
private ArticleRepository articleRepository; // don't instantiate this real class, but use a mock implementation
private ArticleRepository articleRepository;

@Test
void givenGetBooksNotExpanded_whenCorrectRequest_thenResponseIsOkAndContainsTwoBookNames() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.tibiawiki.serviceinterface;
package com.tibiawiki.controller;

import com.tibiawiki.domain.enums.Article;
import com.tibiawiki.domain.enums.BestiaryClass;
Expand Down Expand Up @@ -42,87 +42,83 @@
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class CreaturesResourceIT {

private static final String INFOBOX_CREATURE_TEXT = "{{Infobox Creature|List={{{1|}}}|GetValue={{{GetValue|}}}\n" +
"| name = Dragon\n" +
"| article = a\n" +
"| actualname = dragon\n" +
"| plural = dragons\n" +
"| hp = 1000\n" +
"| exp = 700\n" +
"| armor = 25\n" +
"| summon = --\n" +
"| convince = --\n" +
"| illusionable = yes\n" +
"| creatureclass = Reptiles\n" +
"| primarytype = Dragons\n" +
"| bestiaryclass = Dragon\n" +
"| bestiarylevel = Medium\n" +
"| occurrence = Common\n" +
"| spawntype = Regular, Raid\n" +
"| isboss = no\n" +
"| isarenaboss = no\n" +
"| abilities = [[Melee]] (0-120), [[Fire Wave]] (100-170), [[Great Fireball]] (60-140), [[Self-Healing]] (40-70)\n" +
"| maxdmg = 430\n" +
"| pushable = no\n" +
"| pushobjects = yes\n" +
"| walksaround = None\n" +
"| walksthrough = Fire, Energy, Poison\n" +
"| paraimmune = yes\n" +
"| senseinvis = yes\n" +
"| physicalDmgMod = 100%\n" +
"| earthDmgMod = 20%\n" +
"| fireDmgMod = 0%\n" +
"| deathDmgMod = 100%\n" +
"| energyDmgMod = 80%\n" +
"| holyDmgMod = 100%\n" +
"| iceDmgMod = 110%\n" +
"| hpDrainDmgMod = 100%?\n" +
"| drownDmgMod = 100%?\n" +
"| bestiaryname = dragon\n" +
"| bestiarytext = Dragons were\n" +
"| sounds = {{Sound List|FCHHHHH|GROOAAARRR}}\n" +
"| implemented = Pre-6.0\n" +
"| notes = Dragons are\n" +
"| behaviour = Dragons are\n" +
"| runsat = 300\n" +
"| speed = 86\n" +
"| strategy = '''All''' [[player]]s\n" +
"| location = [[Thais]] [[Ancient Temple]], [[Darashia Dragon Lair]], [[Mount Sternum Dragon Cave]]," +
" [[Mintwallin]], deep in [[Fibula Dungeon]], [[Kazordoon Dragon Lair]] (near [[Dwarf Bridge]]), [[Plains" +
" of Havoc]], [[Elven Bane]] castle, [[Maze of Lost Souls]], southern cave and dragon tower in" +
" [[Shadowthorn]], [[Orc Fortress]], [[Venore]] [[Dragon Lair]], [[Pits of Inferno]], [[Behemoth Quest]]" +
" room in [[Edron]], [[Hero Cave]], deep [[Cyclopolis]], [[Edron Dragon Lair]], [[Goroma]], [[Ankrahmun" +
" Dragon Lair]]s, [[Draconia]], [[Dragonblaze Peaks]], some [[Ankrahmun Tombs]], underground of [[Fenrock]]" +
" (on the way to [[Beregar]]), [[Krailos Steppe]] and [[Crystal Lakes]].\n" +
"| loot = {{Loot Table\n" +
" |{{Loot Item|0-105|Gold Coin}}\n" +
" |{{Loot Item|0-3|Dragon Ham}}\n" +
" |{{Loot Item|Steel Shield}}\n" +
" |{{Loot Item|Crossbow}}\n" +
" |{{Loot Item|Dragon's Tail}}\n" +
" |{{Loot Item|0-10|Burst Arrow}}\n" +
" |{{Loot Item|Longsword|semi-rare}}\n" +
" |{{Loot Item|Steel Helmet|semi-rare}}\n" +
" |{{Loot Item|Broadsword|semi-rare}}\n" +
" |{{Loot Item|Plate Legs|semi-rare}}\n" +
" |{{Loot Item|Green Dragon Leather|rare}}\n" +
" |{{Loot Item|Wand of Inferno|rare}}\n" +
" |{{Loot Item|Strong Health Potion|rare}}\n" +
" |{{Loot Item|Green Dragon Scale|rare}}\n" +
" |{{Loot Item|Double Axe|rare}}\n" +
" |{{Loot Item|Dragon Hammer|rare}}\n" +
" |{{Loot Item|Serpent Sword|rare}}\n" +
" |{{Loot Item|Small Diamond|very rare}}\n" +
" |{{Loot Item|Dragon Shield|very rare}}\n" +
" |{{Loot Item|Life Crystal|very rare}}\n" +
" |{{Loot Item|Dragonbone Staff|very rare}}\n" +
"}}\n" +
"| history = Dragons are\n" +
"}}\n";
private static final String INFOBOX_CREATURE_TEXT = """
{{Infobox Creature|List={{{1|}}}|GetValue={{{GetValue|}}}
| name = Dragon
| article = a
| actualname = dragon
| plural = dragons
| hp = 1000
| exp = 700
| armor = 25
| summon = --
| convince = --
| illusionable = yes
| creatureclass = Reptiles
| primarytype = Dragons
| bestiaryclass = Dragon
| bestiarylevel = Medium
| occurrence = Common
| spawntype = Regular, Raid
| isboss = no
| isarenaboss = no
| abilities = [[Melee]] (0-120), [[Fire Wave]] (100-170), [[Great Fireball]] (60-140), [[Self-Healing]] (40-70)
| maxdmg = 430
| pushable = no
| pushobjects = yes
| walksaround = None
| walksthrough = Fire, Energy, Poison
| paraimmune = yes
| senseinvis = yes
| physicalDmgMod = 100%
| earthDmgMod = 20%
| fireDmgMod = 0%
| deathDmgMod = 100%
| energyDmgMod = 80%
| holyDmgMod = 100%
| iceDmgMod = 110%
| hpDrainDmgMod = 100%?
| drownDmgMod = 100%?
| bestiaryname = dragon
| bestiarytext = Dragons were
| sounds = {{Sound List|FCHHHHH|GROOAAARRR}}
| implemented = Pre-6.0
| notes = Dragons are
| behaviour = Dragons are
| runsat = 300
| speed = 86
| strategy = '''All''' [[player]]s
| location = [[Thais]] [[Ancient Temple]], [[Darashia Dragon Lair]], [[Mount Sternum Dragon Cave]], [[Mintwallin]], deep in [[Fibula Dungeon]], [[Kazordoon Dragon Lair]] (near [[Dwarf Bridge]]), [[Plains of Havoc]], [[Elven Bane]] castle, [[Maze of Lost Souls]], southern cave and dragon tower in [[Shadowthorn]], [[Orc Fortress]], [[Venore]] [[Dragon Lair]], [[Pits of Inferno]], [[Behemoth Quest]] room in [[Edron]], [[Hero Cave]], deep [[Cyclopolis]], [[Edron Dragon Lair]], [[Goroma]], [[Ankrahmun Dragon Lair]]s, [[Draconia]], [[Dragonblaze Peaks]], some [[Ankrahmun Tombs]], underground of [[Fenrock]] (on the way to [[Beregar]]), [[Krailos Steppe]] and [[Crystal Lakes]].
| loot = {{Loot Table
|{{Loot Item|0-105|Gold Coin}}
|{{Loot Item|0-3|Dragon Ham}}
|{{Loot Item|Steel Shield}}
|{{Loot Item|Crossbow}}
|{{Loot Item|Dragon's Tail}}
|{{Loot Item|0-10|Burst Arrow}}
|{{Loot Item|Longsword|semi-rare}}
|{{Loot Item|Steel Helmet|semi-rare}}
|{{Loot Item|Broadsword|semi-rare}}
|{{Loot Item|Plate Legs|semi-rare}}
|{{Loot Item|Green Dragon Leather|rare}}
|{{Loot Item|Wand of Inferno|rare}}
|{{Loot Item|Strong Health Potion|rare}}
|{{Loot Item|Green Dragon Scale|rare}}
|{{Loot Item|Double Axe|rare}}
|{{Loot Item|Dragon Hammer|rare}}
|{{Loot Item|Serpent Sword|rare}}
|{{Loot Item|Small Diamond|very rare}}
|{{Loot Item|Dragon Shield|very rare}}
|{{Loot Item|Life Crystal|very rare}}
|{{Loot Item|Dragonbone Staff|very rare}}
}}
| history = Dragons are
}}
""";
@Autowired
private TestRestTemplate restTemplate;
@MockBean
private ArticleRepository articleRepository; // don't instantiate this real class, but use a mock implementation
private ArticleRepository articleRepository;

@Test
void givenGetCreaturesNotExpanded_whenCorrectRequest_thenResponseIsOkAndContainsTwoCreatureNames() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.tibiawiki.serviceinterface;
package com.tibiawiki.controller;

import com.tibiawiki.domain.enums.InfoboxTemplate;
import com.tibiawiki.domain.repositories.ArticleRepository;
Expand Down Expand Up @@ -31,7 +31,7 @@ public class HuntingPlacesIT {
private TestRestTemplate restTemplate;

@MockBean
private ArticleRepository articleRepository; // don't instantiate this real class, but use a mock implementation
private ArticleRepository articleRepository;

private static final String INFOBOX_HUNT_TEXT = """
{{Infobox Hunt
Expand Down
Loading