Rdf4jServerBootActuatorConfigTest.java

/*******************************************************************************
 * Copyright (c) 2025 Eclipse RDF4J contributors.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Distribution License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *******************************************************************************/
// Some portions generated by Codex
package org.eclipse.rdf4j.server.boot;

import static org.assertj.core.api.Assertions.assertThat;

import java.io.IOException;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Properties;

import org.junit.jupiter.api.Test;

class Rdf4jServerBootActuatorConfigTest {

	@Test
	void distributionConfigDisablesActuator() throws IOException {
		Path configPath = Paths.get("src/main/dist/config/application.properties");
		assertThat(Files.exists(configPath)).as("distribution application.properties should exist").isTrue();

		Properties properties = new Properties();
		try (Reader reader = Files.newBufferedReader(configPath)) {
			properties.load(reader);
		}

		assertThat(properties.getProperty("management.server.port"))
				.as("management endpoints should be disabled by default")
				.isEqualTo("-1");
		assertThat(properties.getProperty("management.endpoints.enabled-by-default"))
				.as("management endpoints should not be enabled")
				.isEqualTo("false");
		assertThat(properties.getProperty("management.endpoints.web.exposure.exclude"))
				.as("management endpoints should not be exposed")
				.isEqualTo("*");
	}
}