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
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

/**
* Starts the standalone mightyETL Eureka service registry.
*
* <p>The registry provides service discovery for deployment profiles that explicitly include
* Eureka. Authentication and production service-identity policy are separate security controls;
* this bootstrap class only owns starting the Spring Cloud Netflix server.</p>
*/
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {

/**
* Launches the Eureka registry through Spring Boot.
*
* @param args command-line arguments passed to Spring Boot
*/
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.xtrmetl.eureka;

import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* Verifies the standalone Eureka bootstrap contract and its beginner-readable public documentation.
*/
class EurekaServerApplicationContractTest {

@Test
void bootstrapClassKeepsTheRequiredServerAnnotations() {
assertNotNull(EurekaServerApplication.class.getAnnotation(SpringBootApplication.class));
assertNotNull(EurekaServerApplication.class.getAnnotation(EnableEurekaServer.class));
}

@Test
void mainEntryPointRemainsPublicStatic() throws NoSuchMethodException {
Method main = EurekaServerApplication.class.getDeclaredMethod("main", String[].class);

assertTrue(Modifier.isPublic(main.getModifiers()));
assertTrue(Modifier.isStatic(main.getModifiers()));
}

@Test
void publicBootstrapApiHasBeginnerReadableJavadoc() throws IOException {
String source = Files.readString(
Path.of("src/main/java/com/xtrmetl/eureka/EurekaServerApplication.java"),
StandardCharsets.UTF_8
);

assertTrue(source.contains("Starts the standalone mightyETL Eureka service registry"));
assertTrue(source.contains("Launches the Eureka registry through Spring Boot"));
assertTrue(source.contains("@param args command-line arguments passed to Spring Boot"));
}
}
Loading