Skip to content

Commit

Permalink
Added RabbitMqProperties as a Component
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhorridge committed May 11, 2024
1 parent 53ee9be commit adca3a2
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-ipc</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
<name>webprotege-ipc</name>
<description>Inter Process Communication framework</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package edu.stanford.protege.webprotege.ipc.impl;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 2024-05-11
*/
@Component
@ConfigurationProperties(prefix = "webprotege.rabbitmq")
public class RabbitMqProperties {

private boolean commandsSubscribe;

private String requestqueue;

private String responsequeue;

private long timeout;

public boolean getCommandsSubscribe() {
return commandsSubscribe;
}

public void setCommandsSubscribe(boolean commandsSubscribe) {
this.commandsSubscribe = commandsSubscribe;
}

public String getRequestqueue() {
return requestqueue;
}

public void setRequestqueue(String requestqueue) {
this.requestqueue = requestqueue;
}

public String getResponsequeue() {
return responsequeue;
}

public void setResponsequeue(String responsequeue) {
this.responsequeue = responsequeue;
}

public long getTimeout() {
return timeout;
}

public void setTimeout(long timeout) {
this.timeout = timeout;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package edu.stanford.protege.webprotege.ipc;

import edu.stanford.protege.webprotege.ipc.impl.RabbitMqProperties;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

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

/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 2024-05-11
*/
@SpringBootTest(properties = {
"webprotege.rabbitmq.timeout=12345",
"webprotege.rabbitmq.commands-subscribe=false",
"webprotege.rabbitmq.requestqueue=abc",
"webprotege.rabbitmq.responsequeue=def"
})
public class RabbitMqPropertiesTest {

@Autowired
private RabbitMqProperties properties;

@Test
void shouldReadTimeout() {
assertThat(properties.getTimeout()).isEqualTo(12345);
}

@Test
void shouldReadCommandsSubscribe() {
assertThat(properties.getCommandsSubscribe()).isEqualTo(false);
}

@Test
void shouldReadRequestQueue() {
assertThat(properties.getRequestqueue()).isEqualTo("abc");
}

@Test
void shouldReadResponseQueue() {
assertThat(properties.getResponsequeue()).isEqualTo("def");
}
}

0 comments on commit adca3a2

Please sign in to comment.