-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added RabbitMqProperties as a Component
- Loading branch information
1 parent
53ee9be
commit adca3a2
Showing
3 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMqProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/test/java/edu/stanford/protege/webprotege/ipc/RabbitMqPropertiesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |