Skip to content

Commit

Permalink
chore: Remove unused bean.xml files (#18136)
Browse files Browse the repository at this point in the history
  • Loading branch information
teleivo authored Jul 22, 2024
1 parent 4514931 commit 614c51d
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 185 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,30 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.hisp.dhis.system.leader;
package org.hisp.dhis.leader.election;

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

import org.hisp.dhis.leader.election.LeaderManager;
import org.hisp.dhis.system.SystemTest;
import java.util.Properties;
import org.hisp.dhis.external.conf.ConfigurationKey;
import org.hisp.dhis.test.config.TestDhisConfigurationProvider;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

/**
* @author Ameen Mohamed
*/
class LeaderManagerTest extends SystemTest {

@Autowired private LeaderManager leaderManager;
class NoOpLeaderManagerTest {

@Test
void testNodeInfo() {
Properties properties = new Properties();
properties.put(ConfigurationKey.NODE_ID, "1");
TestDhisConfigurationProvider dhisConfigurationProvider =
new TestDhisConfigurationProvider(properties);
NoOpLeaderManager leaderManager = new NoOpLeaderManager(dhisConfigurationProvider);

assertNotNull(leaderManager.getCurrentNodeUuid());
assertNotNull(leaderManager.getLeaderNodeUuid());
assertEquals(leaderManager.getCurrentNodeUuid(), leaderManager.getLeaderNodeUuid());
Expand Down

This file was deleted.

This file was deleted.

11 changes: 6 additions & 5 deletions dhis-2/dhis-test-web-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
<artifactId>dhis-service-tracker</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-support-artemis</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-support-db-migration</artifactId>
Expand Down Expand Up @@ -191,11 +196,6 @@
<artifactId>geojson-jackson</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
Expand Down Expand Up @@ -371,6 +371,7 @@
<ignoredUnusedDeclaredDependency>org.skyscreamer:jsonassert</ignoredUnusedDeclaredDependency>
</ignoredUnusedDeclaredDependencies>
<ignoredNonTestScopedDependencies>
<ignoredNonTestScopedDependency>org.hisp.dhis:dhis-support-artemis</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>org.hisp.dhis:dhis-support-hibernate</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>org.hisp.dhis:dhis-service-setting</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>org.hisp.dhis:dhis-service-dxf2</ignoredNonTestScopedDependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.Map;
import javax.sql.DataSource;
import lombok.extern.slf4j.Slf4j;
import org.hisp.dhis.artemis.config.ArtemisConfig;
import org.hisp.dhis.association.jdbc.JdbcOrgUnitAssociationStoreConfiguration;
import org.hisp.dhis.commons.jackson.config.JacksonObjectMapperConfig;
import org.hisp.dhis.commons.util.DebugUtils;
Expand All @@ -54,6 +55,8 @@
import org.hisp.dhis.security.SystemAuthoritiesProvider;
import org.hisp.dhis.test.config.NoOpFlywayConfiguration;
import org.hisp.dhis.test.h2.H2SqlFunction;
import org.hisp.dhis.tracker.imports.config.TrackerPreheatConfig;
import org.hisp.dhis.webapi.security.config.PasswordEncoderConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
Expand All @@ -62,14 +65,12 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.security.authentication.DefaultAuthenticationEventPublisher;
import org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
import org.springframework.security.web.savedrequest.RequestCache;
Expand All @@ -82,7 +83,6 @@
* @author Gintare Vilkelyte <[email protected]
*/
@Configuration
@ImportResource(locations = {"classpath*:/META-INF/dhis/beans.xml"})
@ComponentScan(
basePackages = {"org.hisp.dhis"},
useDefaultFilters = false,
Expand All @@ -93,6 +93,8 @@
},
excludeFilters = @Filter(Configuration.class))
@Import({
ArtemisConfig.class,
PasswordEncoderConfig.class,
HibernateConfig.class,
DataSourceConfig.class,
AnalyticsDataSourceConfig.class,
Expand All @@ -113,6 +115,7 @@
org.hisp.dhis.validation.config.StoreConfig.class,
org.hisp.dhis.reporting.config.StoreConfig.class,
org.hisp.dhis.analytics.config.ServiceConfig.class,
TrackerPreheatConfig.class,
JacksonObjectMapperConfig.class,
JdbcOrgUnitAssociationStoreConfiguration.class,
StartupConfig.class
Expand Down Expand Up @@ -172,11 +175,6 @@ public DataSource actualDataSource() {
}
}

@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}

@Bean
public DefaultAuthenticationEventPublisher authenticationEventPublisher() {
DefaultAuthenticationEventPublisher defaultAuthenticationEventPublisher =
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.params.provider.Arguments.arguments;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
Expand All @@ -58,11 +60,23 @@
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.ContextConfiguration;

@ContextConfiguration(classes = EventExportTestConfiguration.class)
@ContextConfiguration(classes = EventsExportControllerTest.Configuration.class)
class EventsExportControllerTest extends H2ControllerIntegrationTestBase {

static class Configuration {
@Bean
public EventService eventService() {
EventService eventService = mock(EventService.class);
// Orderable fields are checked within the controller constructor
when(eventService.getOrderableFields())
.thenReturn(new HashSet<>(EventMapper.ORDERABLE_FIELDS.values()));
return eventService;
}
}

@Autowired private IdentifiableObjectManager manager;

@Autowired private EventService eventService;
Expand Down

0 comments on commit 614c51d

Please sign in to comment.