Skip to content
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
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<version>0.1.0-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.frameboter</groupId>
<artifactId>template</artifactId>
<groupId>com.tagarena</groupId>
<artifactId>trainer</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>template</name>
<description>template</description>
<name>trainer</name>
<description>trainer</description>
<properties>
<java.version>21</java.version>
</properties>
Expand Down Expand Up @@ -72,8 +72,8 @@
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub frameboter Apache Maven Packages</name>
<url>https://maven.pkg.github.com/frameboter/${project.artifactId}</url>
<name>GitHub tagarena Apache Maven Packages</name>
<url>https://maven.pkg.github.com/tagarena/${project.artifactId}</url>
</repository>
</distributionManagement>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frameboter.template;
package com.tagarena.trainer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.frameboter.template.rest;
package com.tagarena.trainer.rest;

import com.frameboter.rest.AbstractResource;
import com.frameboter.template.rest.model.Ping;
import com.tagarena.trainer.rest.model.Ping;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frameboter.template.rest.model;
package com.tagarena.trainer.rest.model;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
Expand Down
37 changes: 0 additions & 37 deletions src/test/java/com/frameboter/template/rest/PingResourceTest.java

This file was deleted.

38 changes: 38 additions & 0 deletions src/test/java/com/tagarena/trainer/rest/PingResourceTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.tagarena.trainer.rest;

import java.time.LocalDateTime;
import java.util.HashMap;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.oauth2.jwt.Jwt;

import com.tagarena.trainer.Application;
import com.tagarena.trainer.rest.model.Ping;

import static org.junit.jupiter.api.Assertions.*;

@SpringBootTest(classes = Application.class)
class PingResourceTest {

@Autowired
private PingResource pingResource;

@Test
void ping_shouldReturnCurrentTime() {

HashMap<String, Object> headers = new HashMap<>();
headers.put("alg", "RS256");

LocalDateTime beforePing = LocalDateTime.now().minusSeconds(1);
HashMap<String, Object> claims = new HashMap<>();
claims.put("sub", "456b149c-954b-4f91-82a4-577fcee247ca");
String token = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJ3OUhyTHJvWVZPUXVIRnE2MHNTOW8zWnRKclF0b3VBOUxaaGNVTHFxellnIn0" +
".eyJleHAiOjE3MTA0Mzg5MTksImlhdCI6MTcxMDQzODYxOSwianRpIjoiOTg3ZjBmYWQtOTE5My00ZjBiLTg0ZWUtMWEwYjU0MTU5OWI5IiwiaXNzIjoiaHR0cHM6Ly9rZXljbG9hay5yb2JvdGVyNTEyMy5jb20vcmVhbG1zL3JvYm9sb2NrIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6IjQ1NmIxNDljLTk1NGItNGY5MS04MmE0LTU3N2ZjZWUyNDdjYSIsInR5cCI6IkJlYXJlciIsImF6cCI6InRlY2huaWNhbCIsInNlc3Npb25fc3RhdGUiOiIwOWNlNDQ5NS1lMTlkLTQ1OWEtYTY2YS04OWIwYmU2ZDE5MTYiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbIi8qIl0sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJ0ZXN0Iiwib2ZmbGluZV9hY2Nlc3MiLCJkZWZhdWx0LXJvbGVzLXJvYm9sb2NrIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJhY2NvdW50Ijp7InJvbGVzIjpbIm1hbmFnZS1hY2NvdW50IiwibWFuYWdlLWFjY291bnQtbGlua3MiLCJ2aWV3LXByb2ZpbGUiXX19LCJzY29wZSI6ImVtYWlsIHByb2ZpbGUiLCJzaWQiOiIwOWNlNDQ5NS1lMTlkLTQ1OWEtYTY2YS04OWIwYmU2ZDE5MTYiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwibmFtZSI6IlBhc2NhbCBHZWhyaW5nZXIiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJyb2JvdGVyNTEyMyIsImdpdmVuX25hbWUiOiJQYXNjYWwiLCJmYW1pbHlfbmFtZSI6IkdlaHJpbmdlciIsImVtYWlsIjoicGFzY2FsLmdlaHJpbmdlckBvdXRsb29rLmNvbSJ9.rHho1Ba272D5l0hk0FRlM1e9yZHbusZUtt11QBbOIsbf_40r0HwpSs1ok_JoW5Zw4ZMlExLVZ6GxzjHqvBoXZgzO-V0IeDLMB5xfnGY2YLbyKaOb1p-maaBNU9Yyp-msScdPpWQEUF1ThVGk4dYMbITlKmTc_mfNuO2tWOxTW9HuIGFbccOirGTA8pZw7tE0oFdH9ZUUrXpdOK5Qzjo9JwqHmbhp2M8JCoOU2jyl5dtmSKDE47_9Y8LoO6iYy69LioIDJltv0DSVrNUebQdaJrhTe7SDynwYM_lvNib1lq4svo8VgEfhogBiCeQpiKLptxxuA9LiC8vhLDHcDK0IIA";
Ping result = pingResource.createPing(new Jwt(token, null, null, headers, claims));

assertTrue(result.getCreatedAt().isAfter(beforePing));
assertTrue(result.getCreatedAt().isBefore(LocalDateTime.now().plusSeconds(1)));
}
}
Loading