Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit b155df0

Browse files
authored
FF-84 Adding remaining functions, writing cucumber steps. (#7)
* added some CommonCucumberSteps * added remaining BusinessServices * WIP! in HATEOAS is too much hate. * Fixed Constructor bug, added some more run configs. * Fixed CucumberTests * Fixed missing run config * refactored file path header to config file, added rest template bean * added rest template to test api endpoints.
1 parent 21978b6 commit b155df0

File tree

50 files changed

+439
-227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+439
-227
lines changed

.run/AllJUnitTests.run.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run All Tests" type="JUnit" factoryName="JUnit">
3+
<module name="RestApi" />
4+
<useClassPathOnly />
5+
<option name="PACKAGE_NAME" value="" />
6+
<option name="MAIN_CLASS_NAME" value="" />
7+
<option name="METHOD_NAME" value="" />
8+
<option name="TEST_OBJECT" value="package" />
9+
<option name="PARAMETERS" value="" />
10+
<method v="2">
11+
<option name="Make" enabled="true" />
12+
</method>
13+
</configuration>
14+
</component>

.run/Run all Cucumber Tests.run.xml renamed to .run/CucumberTests.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<option name="FILE_PATH" value="$PROJECT_DIR$/src/test/cucumber/de/filefighter/rest" />
77
<option name="GLUE" value="de.filefighter.rest.cucumber" />
88
<option name="MAIN_CLASS_NAME" value="io.cucumber.core.cli.Main" />
9-
<module name="rest" />
9+
<module name="RestApi" />
1010
<option name="PROGRAM_PARAMETERS" value=" --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm5SMFormatter" />
1111
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
1212
<method v="2">

.run/JUnit Tests.run.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run only Unit Tests" type="JUnit" factoryName="JUnit">
3+
<module name="RestApi" />
4+
<useClassPathOnly />
5+
<option name="PACKAGE_NAME" value="" />
6+
<option name="MAIN_CLASS_NAME" value="" />
7+
<option name="METHOD_NAME" value="" />
8+
<option name="TEST_OBJECT" value="pattern" />
9+
<option name="PARAMETERS" value="" />
10+
<patterns>
11+
<pattern testClass="^(.*)UnitTest$" />
12+
</patterns>
13+
<method v="2">
14+
<option name="Make" enabled="true" />
15+
</method>
16+
</configuration>
17+
</component>
File renamed without changes.

.run/RestApplication.run.xml renamed to .run/RestApplication-dev.run.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<component name="ProjectRunConfigurationManager">
2-
<configuration name="RestApplication[DEV]" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
3-
<module name="rest" />
2+
<configuration default="false" name="RestApplication[DEV]" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
3+
<module name="RestApi" />
44
<option name="SPRING_BOOT_MAIN_CLASS" value="de.filefighter.rest.RestApplication" />
55
<option name="ACTIVE_PROFILES" value="dev" />
66
<option name="ALTERNATIVE_JRE_PATH" />

.run/RestApplication[PROD].run.xml renamed to .run/RestApplication-prod.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="RestApplication[PROD]" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
3-
<module name="rest" />
3+
<module name="RestApi" />
44
<option name="SPRING_BOOT_MAIN_CLASS" value="de.filefighter.rest.RestApplication" />
55
<option name="ACTIVE_PROFILES" value="prod" />
66
<option name="ALTERNATIVE_JRE_PATH" />
File renamed without changes.

pom.xml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
</parent>
1111
<groupId>de.filefighter</groupId>
1212
<artifactId>rest</artifactId>
13-
<version>0.0.2</version>
14-
<name>rest</name>
15-
<description>RestApi</description>
13+
<version>0.0.3-Snapshot</version>
14+
<name>RestApi</name>
15+
<description>RestApi for FileFighter</description>
1616

1717
<properties>
1818
<java.version>11</java.version>
@@ -43,12 +43,12 @@
4343
<version>1.18.12</version>
4444
</dependency>
4545

46-
<!-- tag::spring-hateoas[] -->
46+
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
4747
<dependency>
48-
<groupId>org.springframework.boot</groupId>
49-
<artifactId>spring-boot-starter-hateoas</artifactId>
48+
<groupId>commons-io</groupId>
49+
<artifactId>commons-io</artifactId>
50+
<version>2.5</version>
5051
</dependency>
51-
<!-- end::spring-hateoas[] -->
5252

5353
<!-- TESTING -->
5454
<dependency>
@@ -76,7 +76,6 @@
7676
<artifactId>spring-boot-starter-test</artifactId>
7777
<scope>test</scope>
7878
</dependency>
79-
8079
<dependency>
8180
<groupId>io.cucumber</groupId>
8281
<artifactId>cucumber-java</artifactId>

src/main/java/de/filefighter/rest/RestApplication.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.context.annotation.Bean;
6+
import org.springframework.web.client.RestTemplate;
57

68
@SpringBootApplication
79
public class RestApplication {
810
public static void main(String[] args) {
911
SpringApplication.run(RestApplication.class, args);
1012
}
13+
14+
@Bean
15+
public RestTemplate getRestTemplate() {
16+
return new RestTemplate();
17+
}
1118
}

src/main/java/de/filefighter/rest/configuration/PrepareDataBaseProd.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package de.filefighter.rest.configuration;
22

3-
import de.filefighter.rest.domain.user.data.persistance.UserEntitiy;
3+
import de.filefighter.rest.domain.user.data.persistance.UserEntity;
44
import de.filefighter.rest.domain.user.data.persistance.UserRepository;
55
import org.slf4j.Logger;
66
import org.slf4j.LoggerFactory;
@@ -22,7 +22,14 @@ CommandLineRunner initUserDataBase(UserRepository repository) {
2222
return args -> {
2323
LOG.info("Starting with clean user collection.");
2424
repository.deleteAll();
25-
LOG.info("Preloading default admin user: " + repository.save(new UserEntitiy(0L, "admin", "admin", "refreshToken1234", 0, 1)));
25+
LOG.info("Preloading default admin user: " + repository.save(UserEntity
26+
.builder()
27+
.userId(0L)
28+
.username("admin")
29+
.password("admin")
30+
.refreshToken("refreshToken1234")
31+
.roleIds(new long[]{0, 1})
32+
.build()));
2633
LOG.info("Loading Users" + (repository.findAll().size() == 1 ? " was successful." : " failed."));
2734
};
2835
}

0 commit comments

Comments
 (0)