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

add Address.extension #103

Merged
merged 1 commit into from
May 18, 2016
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- added `CliScript`
- improved waiting for server: `OnlineOptions.connectionTimeout`
is now also used when connecting to the server fails
- added `Address.extension`

## 1.1.0 [The Wintermute Edition](https://en.wikipedia.org/wiki/Neuromancer) (2016-04-25)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public static Address root() {
return new Address(Collections.<StringPair>emptyList());
}

public static Address extension(String extension) {
return Address.of(Constants.EXTENSION, extension);
}

public static Address host(String host) {
return Address.of(Constants.HOST, host);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public void twoElementsAddress() {
}

@Test
public void subsystemAddress() {
Address singleElementAddress = Address.subsystem("foo");
public void extensionAddress() {
Address singleElementAddress = Address.extension("org.jboss.as.logging");
ModelNode modelNode = singleElementAddress.toModelNode();

assertTrue(modelNode.isDefined());
Expand All @@ -79,11 +79,11 @@ public void subsystemAddress() {

ModelNode firstElement = modelNode.get(0);
assertEquals(ModelType.PROPERTY, firstElement.getType());
assertEquals(Constants.SUBSYSTEM, firstElement.asProperty().getName());
assertEquals(Constants.EXTENSION, firstElement.asProperty().getName());
assertEquals(ModelType.STRING, firstElement.asProperty().getValue().getType());
assertEquals("foo", firstElement.asProperty().getValue().asString());
assertEquals("org.jboss.as.logging", firstElement.asProperty().getValue().asString());

assertEquals("/subsystem=foo", singleElementAddress.toString());
assertEquals("/extension=org.jboss.as.logging", singleElementAddress.toString());
}

@Test
Expand All @@ -104,4 +104,61 @@ public void hostAddress() {

assertEquals("/host=master", singleElementAddress.toString());
}

@Test
public void subsystemAddress() {
Address singleElementAddress = Address.subsystem("foo");
ModelNode modelNode = singleElementAddress.toModelNode();

assertTrue(modelNode.isDefined());
assertEquals(ModelType.LIST, modelNode.getType());
assertTrue(modelNode.hasDefined(0));
assertFalse(modelNode.hasDefined(1));

ModelNode firstElement = modelNode.get(0);
assertEquals(ModelType.PROPERTY, firstElement.getType());
assertEquals(Constants.SUBSYSTEM, firstElement.asProperty().getName());
assertEquals(ModelType.STRING, firstElement.asProperty().getValue().getType());
assertEquals("foo", firstElement.asProperty().getValue().asString());

assertEquals("/subsystem=foo", singleElementAddress.toString());
}

@Test
public void coreServiceAddress() {
Address singleElementAddress = Address.coreService("management");
ModelNode modelNode = singleElementAddress.toModelNode();

assertTrue(modelNode.isDefined());
assertEquals(ModelType.LIST, modelNode.getType());
assertTrue(modelNode.hasDefined(0));
assertFalse(modelNode.hasDefined(1));

ModelNode firstElement = modelNode.get(0);
assertEquals(ModelType.PROPERTY, firstElement.getType());
assertEquals(Constants.CORE_SERVICE, firstElement.asProperty().getName());
assertEquals(ModelType.STRING, firstElement.asProperty().getValue().getType());
assertEquals("management", firstElement.asProperty().getValue().asString());

assertEquals("/core-service=management", singleElementAddress.toString());
}

@Test
public void deploymentAddress() {
Address singleElementAddress = Address.deployment("simple.war");
ModelNode modelNode = singleElementAddress.toModelNode();

assertTrue(modelNode.isDefined());
assertEquals(ModelType.LIST, modelNode.getType());
assertTrue(modelNode.hasDefined(0));
assertFalse(modelNode.hasDefined(1));

ModelNode firstElement = modelNode.get(0);
assertEquals(ModelType.PROPERTY, firstElement.getType());
assertEquals(Constants.DEPLOYMENT, firstElement.asProperty().getName());
assertEquals(ModelType.STRING, firstElement.asProperty().getValue().getType());
assertEquals("simple.war", firstElement.asProperty().getValue().asString());

assertEquals("/deployment=simple.war", singleElementAddress.toString());
}
}