use of com.predic8.membrane.core.rules.Rule in project service-proxy by membrane.
the class Http11Test method setUp.
@Before
public void setUp() throws Exception {
Rule rule = new ServiceProxy(new ServiceProxyKey("localhost", "POST", ".*", 4000), "thomas-bayer.com", 80);
router = new HttpRouter();
router.getRuleManager().addProxyAndOpenPortIfNew(rule);
router.init();
}
use of com.predic8.membrane.core.rules.Rule in project service-proxy by membrane.
the class ServiceInvocationTest method createServiceRule.
private ServiceProxy createServiceRule() {
ServiceProxy rule = new ServiceProxy(new ServiceProxyKey("localhost", "*", "*", 3012), "thomas-bayer.com", 80);
rule.setName("log");
rule.getInterceptors().add(new MockInterceptor("log"));
return rule;
}
use of com.predic8.membrane.core.rules.Rule in project service-proxy by membrane.
the class ConnectionTest method setUp.
@Before
public void setUp() throws Exception {
Rule rule2000 = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 2000), "predic8.com", 80);
router = new HttpRouter();
router.getRuleManager().addProxyAndOpenPortIfNew(rule2000);
conLocalhost = Connection.open("localhost", 2000, null, null, 30000);
con127_0_0_1 = Connection.open("127.0.0.1", 2000, null, null, 30000);
}
use of com.predic8.membrane.core.rules.Rule in project service-proxy by membrane.
the class Router method tryReinitialization.
public void tryReinitialization() {
boolean stillFailing = false;
ArrayList<Rule> inactive = getInactiveRules();
if (inactive.size() > 0) {
log.info("Trying to activate all inactive rules.");
for (Rule rule : inactive) {
try {
Rule newRule = rule.clone();
if (!newRule.isActive()) {
log.info("New rule is still not active.");
stillFailing = true;
}
getRuleManager().replaceRule(rule, newRule);
} catch (CloneNotSupportedException e) {
log.error("", e);
}
}
}
if (stillFailing)
log.info("There are still inactive rules.");
else {
stopAutoReinitializator();
log.info("All rules have been initialized.");
}
}
use of com.predic8.membrane.core.rules.Rule in project service-proxy by membrane.
the class RuleManager method ruleDown.
public synchronized void ruleDown(Rule rule) {
int index = rules.indexOf(rule);
if (index < 0 || index == (rules.size() - 1))
return;
Collections.swap(rules, index, index + 1);
Collections.swap(ruleSources, index, index + 1);
for (IRuleChangeListener listener : listeners) {
listener.rulePositionsChanged();
}
}
Aggregations