Search in sources :

Example 1 with MockedPulsarService

use of org.apache.pulsar.broker.admin.AdminApiTest.MockedPulsarService in project incubator-pulsar by apache.

the class IncrementPartitionsTest method setup.

@BeforeMethod
@Override
public void setup() throws Exception {
    conf.setLoadBalancerEnabled(true);
    super.internalSetup();
    // create otherbroker to test redirect on calls that need
    // namespace ownership
    mockPulsarSetup = new MockedPulsarService(this.conf);
    mockPulsarSetup.setup();
    // Setup namespaces
    admin.clusters().createCluster("use", new ClusterData("http://127.0.0.1" + ":" + BROKER_WEBSERVICE_PORT));
    PropertyAdmin propertyAdmin = new PropertyAdmin(Lists.newArrayList("role1", "role2"), Sets.newHashSet("use"));
    admin.properties().createProperty("prop-xyz", propertyAdmin);
    admin.namespaces().createNamespace("prop-xyz/use/ns1");
}
Also used : ClusterData(org.apache.pulsar.common.policies.data.ClusterData) PropertyAdmin(org.apache.pulsar.common.policies.data.PropertyAdmin) MockedPulsarService(org.apache.pulsar.broker.admin.AdminApiTest.MockedPulsarService) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with MockedPulsarService

use of org.apache.pulsar.broker.admin.AdminApiTest.MockedPulsarService in project incubator-pulsar by apache.

the class AdminApiTest2 method testLoadReportApi.

/**
 * It verifies that pulsar with different load-manager generates different load-report and returned by admin-api
 *
 * @throws Exception
 */
@Test
public void testLoadReportApi() throws Exception {
    this.conf.setLoadManagerClassName(SimpleLoadManagerImpl.class.getName());
    MockedPulsarService mockPulsarSetup1 = new MockedPulsarService(this.conf);
    mockPulsarSetup1.setup();
    PulsarService simpleLoadManager = mockPulsarSetup1.getPulsar();
    PulsarAdmin simpleLoadManagerAdmin = mockPulsarSetup1.getAdmin();
    assertNotNull(simpleLoadManagerAdmin.brokerStats().getLoadReport());
    this.conf.setLoadManagerClassName(ModularLoadManagerImpl.class.getName());
    MockedPulsarService mockPulsarSetup2 = new MockedPulsarService(this.conf);
    mockPulsarSetup2.setup();
    PulsarService modularLoadManager = mockPulsarSetup2.getPulsar();
    PulsarAdmin modularLoadManagerAdmin = mockPulsarSetup2.getAdmin();
    assertNotNull(modularLoadManagerAdmin.brokerStats().getLoadReport());
    simpleLoadManagerAdmin.close();
    simpleLoadManager.close();
    modularLoadManagerAdmin.close();
    modularLoadManager.close();
    mockPulsarSetup1.cleanup();
    mockPulsarSetup2.cleanup();
}
Also used : SimpleLoadManagerImpl(org.apache.pulsar.broker.loadbalance.impl.SimpleLoadManagerImpl) MockedPulsarService(org.apache.pulsar.broker.admin.AdminApiTest.MockedPulsarService) PulsarService(org.apache.pulsar.broker.PulsarService) PulsarAdmin(org.apache.pulsar.client.admin.PulsarAdmin) MockedPulsarService(org.apache.pulsar.broker.admin.AdminApiTest.MockedPulsarService) ModularLoadManagerImpl(org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerImpl) Test(org.testng.annotations.Test) MockedPulsarServiceBaseTest(org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)

Example 3 with MockedPulsarService

use of org.apache.pulsar.broker.admin.AdminApiTest.MockedPulsarService in project incubator-pulsar by apache.

the class AdminApiTest2 method setup.

@BeforeMethod
@Override
public void setup() throws Exception {
    conf.setLoadBalancerEnabled(true);
    super.internalSetup();
    // create otherbroker to test redirect on calls that need
    // namespace ownership
    mockPulsarSetup = new MockedPulsarService(this.conf);
    mockPulsarSetup.setup();
    // Setup namespaces
    admin.clusters().createCluster("use", new ClusterData("http://127.0.0.1" + ":" + BROKER_WEBSERVICE_PORT));
    PropertyAdmin propertyAdmin = new PropertyAdmin(Lists.newArrayList("role1", "role2"), Sets.newHashSet("use"));
    admin.properties().createProperty("prop-xyz", propertyAdmin);
    admin.namespaces().createNamespace("prop-xyz/use/ns1");
}
Also used : ClusterData(org.apache.pulsar.common.policies.data.ClusterData) PropertyAdmin(org.apache.pulsar.common.policies.data.PropertyAdmin) MockedPulsarService(org.apache.pulsar.broker.admin.AdminApiTest.MockedPulsarService) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

MockedPulsarService (org.apache.pulsar.broker.admin.AdminApiTest.MockedPulsarService)3 ClusterData (org.apache.pulsar.common.policies.data.ClusterData)2 PropertyAdmin (org.apache.pulsar.common.policies.data.PropertyAdmin)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 PulsarService (org.apache.pulsar.broker.PulsarService)1 MockedPulsarServiceBaseTest (org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)1 ModularLoadManagerImpl (org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerImpl)1 SimpleLoadManagerImpl (org.apache.pulsar.broker.loadbalance.impl.SimpleLoadManagerImpl)1 PulsarAdmin (org.apache.pulsar.client.admin.PulsarAdmin)1 Test (org.testng.annotations.Test)1