Skip to content

Commit

Permalink
fix(test-sdk): load PermissiveLicenseManager as a bootstrap class
Browse files Browse the repository at this point in the history
(cherry picked from commit 56d9b4f)
  • Loading branch information
ytvnr authored and phiz71 committed Jan 15, 2025
1 parent c06c333 commit 6a742d0
Showing 1 changed file with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
* This class allows to extend the {@link GatewayContainer} in order to override the {@link NodeFactory}
Expand Down Expand Up @@ -71,13 +72,31 @@ protected List<Class<?>> annotatedClasses() {
return classes;
}

@Override
protected List<Class<?>> bootstrapClasses() {
List<Class<?>> classes = super.bootstrapClasses();
classes.add(GatewayTestNodeContainerConfiguration.class);
return classes;
}

@Override
protected void startBootstrapComponents(AnnotationConfigApplicationContext ctx) {
// Execute operations before starting bootstrap components (e.g.: the boot application context has been created).
onBootApplicationContextCreated.accept(ctx);
super.startBootstrapComponents(ctx);
}

@Configuration
public static class GatewayTestNodeContainerConfiguration {

// Force use of the PermissiveLicenseManager
@Primary
@Bean
public LicenseManager licenseManager() {
return new PermissiveLicenseManager();
}
}

@Configuration
public static class GatewayTestConfiguration {

Expand Down Expand Up @@ -155,10 +174,5 @@ public SubscriptionService subscriptionService() {
public MessageStorage messageStorage() {
return new MessageStorage();
}

@Bean
public LicenseManager licenseManager() {
return new PermissiveLicenseManager();
}
}
}

0 comments on commit 6a742d0

Please sign in to comment.