Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tp-1258: Make mirrorpuconfigurer more like partitionedpuconfigurer in gs145 #51

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
20 changes: 20 additions & 0 deletions src/main/java/com/avanza/gs/test/MirrorPuConfigurer.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ public MirrorPuConfigurer(String puXmlPath) {
this.puXmlPath = puXmlPath;
}

/**
* @deprecated Use {@link #contextProperty(String, String)} instead.
* E.g. {@code .contextProperty("configSourceId", serviceRegistry.getConfigSourceId())) }
*/
@Deprecated
public MirrorPuConfigurer contextProperties(Properties properties) {
this.properties = properties;
return this;
}

/**
* @deprecated Use {@link #contextProperty(String, String)} instead.
* E.g. {@code .contextProperty("configSourceId", serviceRegistry.getConfigSourceId())) }
*/
@Deprecated
public MirrorPuConfigurer contextProperties(ContextProperties properties) {
this.properties = properties.getProperties();
return this;
}

public MirrorPuConfigurer contextProperty(String propertyName, String propertyValue) {
this.properties.setProperty(propertyName, propertyValue);
return this;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/avanza/gs/test/PartitionedPu.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public final class PartitionedPu implements PuRunner {
private final Integer numberOfPrimaries;
private final Integer numberOfBackups;
private final Properties contextProperties = new Properties();
private final Map<String, Properties> beanProperies = new HashMap<>();
private final Map<String, Properties> beanProperties = new HashMap<>();
private final String lookupGroupName;
private final boolean autostart;
private final ApplicationContext parentContext;
Expand All @@ -53,7 +53,7 @@ public PartitionedPu(PartitionedPuConfigurer configurer) {
this.numberOfBackups = configurer.numberOfBackups;
this.numberOfPrimaries = configurer.numberOfPrimaries;
this.contextProperties.putAll(configurer.contextProperties);
this.beanProperies.putAll(configurer.beanProperies);
this.beanProperties.putAll(configurer.beanProperties);
this.lookupGroupName = configurer.lookupGroupName;
this.autostart = configurer.autostart;
this.parentContext = configurer.parentContext;
Expand Down Expand Up @@ -115,7 +115,7 @@ private ClusterInfo createClusterInfo() {
private BeanLevelProperties createBeanLevelProperties() {
BeanLevelProperties beanLevelProperties = new BeanLevelProperties();
beanLevelProperties.setContextProperties(contextProperties);
for (Map.Entry<String, Properties> beanProperties : beanProperies.entrySet()) {
for (Map.Entry<String, Properties> beanProperties : beanProperties.entrySet()) {
beanLevelProperties.setBeanProperties(beanProperties.getKey(), beanProperties.getValue());
}
return beanLevelProperties;
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/com/avanza/gs/test/PartitionedPuConfigurer.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public final class PartitionedPuConfigurer {
int numberOfBackups = 0;
boolean startAsync = false;
Properties contextProperties = new Properties();
Map<String, Properties> beanProperies = new HashMap<>();
Map<String, Properties> beanProperties = new HashMap<>();
String lookupGroupName = JVMGlobalLus.getLookupGroupName();
String spaceName = "test-space";
public boolean autostart = true;
Expand All @@ -55,7 +55,7 @@ public PartitionedPuConfigurer numberOfBackups(int numberOfBackups) {
}

public PartitionedPuConfigurer beanProperties(String beanName, Properties beanProperties) {
this.beanProperies.put(beanName, beanProperties);
this.beanProperties.put(beanName, beanProperties);
return this;
}

Expand Down Expand Up @@ -85,11 +85,21 @@ public RunningPu configure() {
return new RunningPuImpl(new PartitionedPu(this));
}

/**
* @deprecated Use {@link #contextProperty(String, String)} instead.
* E.g. {@code .contextProperty("configSourceId", serviceRegistry.getConfigSourceId())) }
*/
@Deprecated
public PartitionedPuConfigurer contextProperties(Properties properties) {
this.contextProperties = properties;
return this;
}


/**
* @deprecated Use {@link #contextProperty(String, String)} instead.
* E.g. {@code .contextProperty("configSourceId", serviceRegistry.getConfigSourceId())) }
*/
@Deprecated
public PartitionedPuConfigurer contextProperties(ContextProperties properties) {
this.contextProperties = properties.getProperties();
return this;
Expand Down