Search in sources :

Example 26 with BeforeClass

use of org.testng.annotations.BeforeClass in project OpenAM by OpenRock.

the class CanBeDeletedAppTest method setup.

@BeforeClass
public void setup() throws Exception {
    if (!migrated) {
        return;
    }
    OrganizationConfigManager ocm = new OrganizationConfigManager(adminToken, "/");
    String subRealm = SUB_REALM.substring(1);
    ocm.createSubOrganization(subRealm, Collections.EMPTY_MAP);
    createAppl();
    createPrivilege();
    createApplicationPrivilege();
}
Also used : OrganizationConfigManager(com.sun.identity.sm.OrganizationConfigManager) BeforeClass(org.testng.annotations.BeforeClass)

Example 27 with BeforeClass

use of org.testng.annotations.BeforeClass in project OpenAM by OpenRock.

the class UmaEnabledFilterTest method setupFactories.

@BeforeClass
public static void setupFactories() throws Exception {
    notYetConfiguredFactory = mock(UmaProviderSettingsFactory.class);
    given(notYetConfiguredFactory.get(anyString())).willThrow(NotFoundException.class);
    UmaProviderSettings notEnabled = mock(UmaProviderSettings.class);
    given(notEnabled.isEnabled()).willReturn(false);
    notEnabledFactory = mock(UmaProviderSettingsFactory.class);
    given(notEnabledFactory.get(anyString())).willReturn(notEnabled);
    UmaProviderSettings enabled = mock(UmaProviderSettings.class);
    given(enabled.isEnabled()).willReturn(true);
    enabledFactory = mock(UmaProviderSettingsFactory.class);
    given(enabledFactory.get(anyString())).willReturn(enabled);
}
Also used : UmaProviderSettings(org.forgerock.openam.uma.UmaProviderSettings) UmaProviderSettingsFactory(org.forgerock.openam.uma.UmaProviderSettingsFactory) BeforeClass(org.testng.annotations.BeforeClass)

Example 28 with BeforeClass

use of org.testng.annotations.BeforeClass in project pulsar by yahoo.

the class NamespacesTest method initNamespace.

@BeforeClass
public void initNamespace() throws Exception {
    testLocalNamespaces = Lists.newArrayList();
    testGlobalNamespaces = Lists.newArrayList();
    testLocalNamespaces.add(new NamespaceName(this.testProperty, this.testLocalCluster, "test-namespace-1"));
    testLocalNamespaces.add(new NamespaceName(this.testProperty, this.testLocalCluster, "test-namespace-2"));
    testLocalNamespaces.add(new NamespaceName(this.testProperty, this.testOtherCluster, "test-other-namespace-1"));
    testGlobalNamespaces.add(new NamespaceName(this.testProperty, "global", "test-global-ns1"));
    uriField = PulsarWebResource.class.getDeclaredField("uri");
    uriField.setAccessible(true);
    uriInfo = mock(UriInfo.class);
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarWebResource(com.yahoo.pulsar.broker.web.PulsarWebResource) UriInfo(javax.ws.rs.core.UriInfo) BeforeClass(org.testng.annotations.BeforeClass)

Example 29 with BeforeClass

use of org.testng.annotations.BeforeClass in project pulsar by yahoo.

the class SLAMonitoringTest method setup.

@BeforeClass
void setup() throws Exception {
    log.info("---- Initializing SLAMonitoringTest -----");
    // Start local bookkeeper ensemble
    bkEnsemble = new LocalBookkeeperEnsemble(3, ZOOKEEPER_PORT, PortManager.nextFreePort());
    bkEnsemble.start();
    // start brokers
    for (int i = 0; i < BROKER_COUNT; i++) {
        brokerWebServicePorts[i] = PortManager.nextFreePort();
        brokerNativeBrokerPorts[i] = PortManager.nextFreePort();
        ServiceConfiguration config = new ServiceConfiguration();
        config.setBrokerServicePort(brokerNativeBrokerPorts[i]);
        config.setClusterName("my-cluster");
        config.setWebServicePort(brokerWebServicePorts[i]);
        config.setZookeeperServers("127.0.0.1" + ":" + ZOOKEEPER_PORT);
        config.setBrokerServicePort(brokerNativeBrokerPorts[i]);
        configurations[i] = config;
        pulsarServices[i] = new PulsarService(config);
        pulsarServices[i].start();
        brokerUrls[i] = new URL("http://127.0.0.1" + ":" + brokerWebServicePorts[i]);
        pulsarAdmins[i] = new PulsarAdmin(brokerUrls[i], (Authentication) null);
    }
    Thread.sleep(100);
    createProperty(pulsarAdmins[BROKER_COUNT - 1]);
    for (int i = 0; i < BROKER_COUNT; i++) {
        String destination = String.format("%s/%s/%s:%s", NamespaceService.SLA_NAMESPACE_PROPERTY, "my-cluster", pulsarServices[i].getAdvertisedAddress(), brokerWebServicePorts[i]);
        pulsarAdmins[0].namespaces().createNamespace(destination);
    }
}
Also used : PulsarAdmin(com.yahoo.pulsar.client.admin.PulsarAdmin) Authentication(com.yahoo.pulsar.client.api.Authentication) LocalBookkeeperEnsemble(com.yahoo.pulsar.zookeeper.LocalBookkeeperEnsemble) URL(java.net.URL) BeforeClass(org.testng.annotations.BeforeClass)

Example 30 with BeforeClass

use of org.testng.annotations.BeforeClass in project OpenAM by OpenRock.

the class OrConditionEvalTest method setup.

@BeforeClass
public void setup() throws Exception {
    if (migrated) {
        Map<String, Boolean> actions = new HashMap<String, Boolean>();
        actions.put("GET", Boolean.TRUE);
        Entitlement ent = new Entitlement(ApplicationTypeManager.URL_APPLICATION_TYPE_NAME, ROOT_RESOURCE_NAME + "/*", actions);
        OrCondition cond = new OrCondition();
        Set<EntitlementCondition> conditions = new HashSet<EntitlementCondition>();
        IPv4Condition ipc = new IPv4Condition();
        ipc.setStartIpAndEndIp(START_IP, END_IP);
        conditions.add(ipc);
        cond.setEConditions(conditions);
        Privilege privilege = Privilege.getNewInstance();
        privilege.setName(PRIVILEGE_NAME);
        privilege.setEntitlement(ent);
        privilege.setSubject(new AnyUserSubject());
        privilege.setCondition(cond);
        PrivilegeManager pm = PrivilegeManager.getInstance("/", adminSubject);
        pm.add(privilege);
        Thread.sleep(1000);
    }
}
Also used : HashMap(java.util.HashMap) IPv4Condition(org.forgerock.openam.entitlement.conditions.environment.IPv4Condition) HashSet(java.util.HashSet) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

BeforeClass (org.testng.annotations.BeforeClass)1186 Series (com.axibase.tsd.api.model.series.Series)178 File (java.io.File)157 ArrayList (java.util.ArrayList)78 HashMap (java.util.HashMap)43 ClusterControllerManager (org.apache.helix.integration.manager.ClusterControllerManager)37 Injector (com.google.inject.Injector)36 Properties (java.util.Properties)35 Path (org.apache.hadoop.fs.Path)33 ClusterSetup (org.apache.helix.tools.ClusterSetup)33 Configuration (org.apache.hadoop.conf.Configuration)31 BigDecimal (java.math.BigDecimal)29 URL (java.net.URL)28 MockParticipantManager (org.apache.helix.integration.manager.MockParticipantManager)27 Date (java.util.Date)26 Server (org.eclipse.jetty.server.Server)25 ServerConnector (org.eclipse.jetty.server.ServerConnector)25 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)23 IOException (java.io.IOException)23 Path (java.nio.file.Path)23