Java Code Examples for org.apache.pulsar.broker.ServiceConfiguration#setAdvertisedListeners()

The following examples show how to use org.apache.pulsar.broker.ServiceConfiguration#setAdvertisedListeners() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultipleListenerValidatorTest.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Test(expectedExceptions = IllegalArgumentException.class)
public void testAppearTogether() {
    ServiceConfiguration config = new ServiceConfiguration();
    config.setAdvertisedAddress("127.0.0.1");
    config.setAdvertisedListeners("internal:pulsar://192.168.1.11:6660,internal:pulsar+ssl://192.168.1.11:6651");
    config.setInternalListenerName("internal");
    MultipleListenerValidator.validateAndAnalysisAdvertisedListener(config);
}
 
Example 2
Source File: MultipleListenerValidatorTest.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Test(expectedExceptions = IllegalArgumentException.class)
public void testListenerDuplicate_1() {
    ServiceConfiguration config = new ServiceConfiguration();
    config.setAdvertisedListeners(" internal:pulsar://127.0.0.1:6660, internal:pulsar+ssl://127.0.0.1:6651,"
            + " internal:pulsar://192.168.1.11:6660, internal:pulsar+ssl://192.168.1.11:6651");
    config.setInternalListenerName("internal");
    MultipleListenerValidator.validateAndAnalysisAdvertisedListener(config);
}
 
Example 3
Source File: MultipleListenerValidatorTest.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Test(expectedExceptions = IllegalArgumentException.class)
public void testListenerDuplicate_2() {
    ServiceConfiguration config = new ServiceConfiguration();
    config.setAdvertisedListeners(" internal:pulsar://127.0.0.1:6660," + " internal:pulsar://192.168.1.11:6660");
    config.setInternalListenerName("internal");
    MultipleListenerValidator.validateAndAnalysisAdvertisedListener(config);
}
 
Example 4
Source File: MultipleListenerValidatorTest.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Test(expectedExceptions = IllegalArgumentException.class)
public void testDifferentListenerWithSameHostPort() {
    ServiceConfiguration config = new ServiceConfiguration();
    config.setAdvertisedListeners(" internal:pulsar://127.0.0.1:6660," + " external:pulsar://127.0.0.1:6660");
    config.setInternalListenerName("internal");
    MultipleListenerValidator.validateAndAnalysisAdvertisedListener(config);
}
 
Example 5
Source File: MultipleListenerValidatorTest.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Test(expectedExceptions = IllegalArgumentException.class)
public void testListenerWithoutTLSPort() {
    ServiceConfiguration config = new ServiceConfiguration();
    config.setAdvertisedListeners(" internal:pulsar://127.0.0.1:6660, internal:pulsar+ssl://127.0.0.1:6651");
    config.setInternalListenerName("internal");
    MultipleListenerValidator.validateAndAnalysisAdvertisedListener(config);
}
 
Example 6
Source File: MultipleListenerValidatorTest.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Test
public void testListenerWithTLSPort() {
    ServiceConfiguration config = new ServiceConfiguration();
    config.setBrokerServicePortTls(Optional.of(6651));
    config.setAdvertisedListeners(" internal:pulsar://127.0.0.1:6660, internal:pulsar+ssl://127.0.0.1:6651");
    config.setInternalListenerName("internal");
    MultipleListenerValidator.validateAndAnalysisAdvertisedListener(config);
}
 
Example 7
Source File: MultipleListenerValidatorTest.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Test(expectedExceptions = IllegalArgumentException.class)
public void testListenerWithoutNonTLSAddress() {
    ServiceConfiguration config = new ServiceConfiguration();
    config.setBrokerServicePortTls(Optional.of(6651));
    config.setAdvertisedListeners(" internal:pulsar+ssl://127.0.0.1:6651");
    config.setInternalListenerName("internal");
    MultipleListenerValidator.validateAndAnalysisAdvertisedListener(config);
}
 
Example 8
Source File: MultipleListenerValidatorTest.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Test(expectedExceptions = IllegalArgumentException.class)
public void testWithoutListenerNameInAdvertisedListeners() {
    ServiceConfiguration config = new ServiceConfiguration();
    config.setBrokerServicePortTls(Optional.of(6651));
    config.setAdvertisedListeners(" internal:pulsar://127.0.0.1:6660, internal:pulsar+ssl://127.0.0.1:6651");
    config.setInternalListenerName("external");
    MultipleListenerValidator.validateAndAnalysisAdvertisedListener(config);
}