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();
}
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);
}
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);
}
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);
}
}
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);
}
}
Aggregations