Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Revert router workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulf Lilleengen committed Oct 25, 2019
1 parent 299e8d9 commit 42a7ad2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,19 +435,19 @@ private RouterConfig generateConfig(AddressSpace addressSpace, AuthenticationSer
List<Address> addresses = new ArrayList<>();
Address mqttAddress = new Address();
mqttAddress.setName("override.mqtt");
mqttAddress.setPrefix("$${dummy}mqtt");
mqttAddress.setPrefix("$mqtt");
mqttAddress.setDistribution(Distribution.balanced);
addresses.add(mqttAddress);

Address subctrlAddress = new Address();
subctrlAddress.setName("override.subctrl");
subctrlAddress.setPrefix("$${dummy}subctrl");
subctrlAddress.setPrefix("$subctrl");
subctrlAddress.setDistribution(Distribution.balanced);
addresses.add(subctrlAddress);

Address tempAddress = new Address();
tempAddress.setName("override.temp");
tempAddress.setPrefix("$${dummy}temp");
tempAddress.setPrefix("$temp");
tempAddress.setDistribution(Distribution.balanced);
addresses.add(tempAddress);

Expand All @@ -471,14 +471,14 @@ private RouterConfig generateConfig(AddressSpace addressSpace, AuthenticationSer
List<LinkRoute> linkRoutes = new ArrayList<>();
LinkRoute mqttLwtInLinkRoute = new LinkRoute();
mqttLwtInLinkRoute.setName("override.lwt_in");
mqttLwtInLinkRoute.setPrefix("$${dummy}lwt");
mqttLwtInLinkRoute.setPrefix("$lwt");
mqttLwtInLinkRoute.setDirection(LinkDirection.in);
mqttLwtInLinkRoute.setContainerId("lwt-service");
linkRoutes.add(mqttLwtInLinkRoute);

LinkRoute mqttLwtOutLinkRoute = new LinkRoute();
mqttLwtOutLinkRoute.setName("override.lwt_out");
mqttLwtOutLinkRoute.setPrefix("$${dummy}lwt");
mqttLwtOutLinkRoute.setPrefix("$lwt");
mqttLwtOutLinkRoute.setDirection(LinkDirection.out);
mqttLwtOutLinkRoute.setContainerId("lwt-service");
linkRoutes.add(mqttLwtOutLinkRoute);
Expand Down Expand Up @@ -648,7 +648,7 @@ static List<VhostPolicy> createVhostPolices(RouterPolicySpec policy) {
vhostPolicy.setMaxConnectionsPerUser(policy.getMaxConnectionsPerUser());
}

vhostPolicy.setGroups(Collections.singletonMap("$${dummy}default", group));
vhostPolicy.setGroups(Collections.singletonMap("$default", group));

VhostPolicyGroup internalGroup = new VhostPolicyGroup();
internalGroup.setRemoteHosts("*");
Expand All @@ -658,9 +658,9 @@ static List<VhostPolicy> createVhostPolices(RouterPolicySpec policy) {
internalGroup.setAllowAnonymousSender(true);

VhostPolicy internalVhostPolicy = new VhostPolicy();
internalVhostPolicy.setHostname("$${dummy}default");
internalVhostPolicy.setHostname("$default");
internalVhostPolicy.setAllowUnknownUser(true);
internalVhostPolicy.setGroups(Collections.singletonMap("$${dummy}default", internalGroup));
internalVhostPolicy.setGroups(Collections.singletonMap("$default", internalGroup));

return Arrays.asList(internalVhostPolicy, vhostPolicy);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,23 @@ public void testReconcile() throws Exception {
assertEquals(20, amqpPublic.getInitialHandshakeTimeoutSeconds());
assertEquals(50, amqpPublic.getLinkCapacity());

VhostPolicy internal = getPolicyForHostname("$${dummy}default", actual.getVhosts());
VhostPolicy internal = getPolicyForHostname("$default", actual.getVhosts());
assertNotNull(internal);
assertNull(internal.getMaxConnections());
assertNull(internal.getMaxConnectionsPerHost());
assertNull(internal.getMaxConnectionsPerUser());
assertNull(internal.getGroups().get("$${dummy}default").getMaxSessions());
assertNull(internal.getGroups().get("$${dummy}default").getMaxSenders());
assertNull(internal.getGroups().get("$${dummy}default").getMaxReceivers());
assertNull(internal.getGroups().get("$default").getMaxSessions());
assertNull(internal.getGroups().get("$default").getMaxSenders());
assertNull(internal.getGroups().get("$default").getMaxReceivers());

VhostPolicy pub = getPolicyForHostname("public", actual.getVhosts());
assertNotNull(pub);
assertEquals(30, pub.getMaxConnections());
assertEquals(10, pub.getMaxConnectionsPerUser());
assertEquals(10, pub.getMaxConnectionsPerHost());
assertEquals(4, pub.getGroups().get("$${dummy}default").getMaxSessions());
assertEquals(3, pub.getGroups().get("$${dummy}default").getMaxSenders());
assertEquals(2, pub.getGroups().get("$${dummy}default").getMaxReceivers());
assertEquals(4, pub.getGroups().get("$default").getMaxSessions());
assertEquals(3, pub.getGroups().get("$default").getMaxSenders());
assertEquals(2, pub.getGroups().get("$default").getMaxReceivers());


appliedConfig.getSpec().getRouter().setIdleTimeout(20);
Expand Down Expand Up @@ -368,23 +368,23 @@ public void testVhostPolicyGen() {

assertEquals(2, policyList.size());

VhostPolicy internal = getPolicyForHostname("$${dummy}default", policyList);
VhostPolicy internal = getPolicyForHostname("$default", policyList);
assertNotNull(internal);
assertNull(internal.getMaxConnections());
assertNull(internal.getMaxConnectionsPerHost());
assertNull(internal.getMaxConnectionsPerUser());
assertNull(internal.getGroups().get("$${dummy}default").getMaxSessions());
assertNull(internal.getGroups().get("$${dummy}default").getMaxSenders());
assertNull(internal.getGroups().get("$${dummy}default").getMaxReceivers());
assertNull(internal.getGroups().get("$default").getMaxSessions());
assertNull(internal.getGroups().get("$default").getMaxSenders());
assertNull(internal.getGroups().get("$default").getMaxReceivers());

VhostPolicy pub = getPolicyForHostname("public", policyList);
assertNotNull(pub);
assertEquals(1000, pub.getMaxConnections());
assertEquals(10, pub.getMaxConnectionsPerUser());
assertEquals(10, pub.getMaxConnectionsPerHost());
assertEquals(5, pub.getGroups().get("$${dummy}default").getMaxSessions());
assertEquals(5, pub.getGroups().get("$${dummy}default").getMaxSenders());
assertEquals(5, pub.getGroups().get("$${dummy}default").getMaxReceivers());
assertEquals(5, pub.getGroups().get("$default").getMaxSessions());
assertEquals(5, pub.getGroups().get("$default").getMaxSenders());
assertEquals(5, pub.getGroups().get("$default").getMaxReceivers());
}

private Listener getListenerOnPort(int port, List<Listener> listeners) {
Expand Down

0 comments on commit 42a7ad2

Please sign in to comment.