@BeforeSuite public static synchronized void setupForEclipse() { String runInEclipse = System.getenv("RUN_IN_ECLIPSE"); if (StringUtils.isEmpty(runInEclipse) || !runInEclipse.equalsIgnoreCase("true")) { return; } if (!acsStarted) { System.out.println("*** Setting up test for Eclipse ***"); String springProfilesActive = System.getenv("SPRING_PROFILES_ACTIVE"); if (StringUtils.isEmpty(springProfilesActive)) { springProfilesActive = "h2,public,simple-cache"; } System.setProperty("spring.profiles.active", springProfilesActive); AccessControlService.main(new String[] {}); acsStarted = true; } }
@Parameters({"baseURL"}) @BeforeSuite public void beforeSuite(String baseURL) { try { rpr = ReadPropertyFile.getInstance("./TestResources/TestConfig/test.properties"); reportFile = rpr.getKey("reportFile"); emailConfigFile = rpr.getKey("emailConfigFile"); sendEmail = rpr.getKey("sendEmail"); // If the we are testing single Web Application. Mention the same in //test.properties file and uncomment below line. //baseURL = rpr.getKey("baseURL"); // Commnet this line if previous line is uncommented BaseClass.baseURL = baseURL; browserName = rpr.getKey("browserName"); reporter = ReportManager.getReporter(reportFile, true); } catch (Exception e) { e.printStackTrace(); System.out.println("Error occured in @BeforeSuite"); } }
@BeforeSuite public void setup() { communoteWebServiceController = new CommunoteWebServiceController(); communoteWebServiceController.setServletContext(new MockServletContext()); communoteWebServiceDefinition = new CommunoteWebServiceDefinition(); communoteWebServiceDefinition.setEndpointName("HelloWorldImpl"); communoteWebServiceDefinition.setLocalPartName("HelloWorldImpl"); communoteWebServiceDefinition.setNameSpaceUri("http://www.examples.com/wsdl/HelloService"); communoteWebServiceDefinition.setPluginName(PLUGIN_NAME); communoteWebServiceDefinition.setRelativeUrlPattern(REL_URL_PATTERN); communoteWebServiceDefinition.setServiceClass(HelloWorldImpl.class); communoteWebServiceController.registerService(communoteWebServiceDefinition); }
@BeforeSuite public void setup() throws IOException { defaultAttributes = new Attributes(); defaultAttributes.putValue("Manifest-Version", "1.0"); defaultAttributes.putValue("Created-By", "1.8.0-internal"); mrjar1 = Paths.get("mrjar1.jar"); mrjar2 = Paths.get("mrjar2.jar"); nonMRjar = Paths.get("nonMRjar.jar"); mrjarAllCaps = Paths.get("mrjarAllCaps.jar"); Attributes mrJarAttrs = new Attributes(defaultAttributes); mrJarAttrs.putValue(MRJAR_ATTR, "true"); build(mrjar1, mrJarAttrs); build(mrjar2, mrJarAttrs); build(nonMRjar, defaultAttributes); // JEP 238 - "Multi-Release JAR Files" states that the attribute name // and value are case insensitive. Try with all caps to ensure that // jdeps still recognizes a multi-release jar. Attributes allCapsAttrs = new Attributes(defaultAttributes); allCapsAttrs.putValue(MRJAR_ATTR.toUpperCase(), "TRUE"); build(mrjarAllCaps, allCapsAttrs); }
/** * Installation test that creates the DB schema. * * @throws Exception * in case the test fails */ @BeforeSuite(dependsOnMethods = "prepareDatabase") public void installationStep1InitializeDatabase() throws Exception { CommunoteInstaller installer = CommunoteRuntime.getInstance().getInstaller(); Map<CoreConfigurationPropertyConstant, String> settings = new HashMap<CoreConfigurationPropertyConstant, String>(); settings.put(CorePropertyDatabase.DATABASE_HOST, databaseHost); settings.put(CorePropertyDatabase.DATABASE_PORT, databasePort); settings.put(CorePropertyDatabase.DATABASE_NAME, databaseName); settings.put(CorePropertyDatabase.DATABASE_USER_NAME, databaseUsername); settings.put(CorePropertyDatabase.DATABASE_USER_PASSWORD, databasePassword); StartupProperties newSettings = installer.updateDatabaseSettings(this.databaseType, settings); String url = newSettings.getDatabaseUrl(); Assert.assertNotNull(url); LOGGER.info("Database Url: {}", url); boolean success = installer.initializeDatabase(new LogDatabaseInstallationCallback()); Assert.assertTrue(success, "DB-setup failed"); }
@BeforeSuite(groups = { "simple" }, timeOut = SETUP_TIMEOUT) public static void beforeSuite() throws Exception { houseKeepingClient = createRxWrapperDocumentClient().build(); Database d = new Database(); d.setId(DATABASE_ID); createdDatabase = safeCreateDatabase(houseKeepingClient, d); createdCollection = safeCreateCollection(houseKeepingClient, createdDatabase.getSelfLink(), getCollectionDefinition()); for(int i = 0; i < 5; i++) { createDocument(houseKeepingClient, i); } }
@BeforeSuite(groups = { "simple" }, timeOut = SETUP_TIMEOUT) public static void beforeSuite() { houseKeepingClient = createGatewayRxDocumentClient().build(); Database d = new Database(); d.setId(DATABASE_ID); createdDatabase = safeCreateDatabase(houseKeepingClient, d); createdCollection = safeCreateCollection(houseKeepingClient, createdDatabase.getSelfLink(), getCollectionDefinition()); }
@BeforeSuite public void beforeSuiteHtmlEngineBaseTest() throws Exception { UiEngineConfigurator configurator = UiEngineConfigurator.getInstance(); // set the base folder with the map files // configurator.setMapFilesBaseDir( "resources/com/axway/ats/uiengine/maps" ); // overwrite some configuration properties for faster test execution configurator.setCommandDelay(-1); configurator.setElementStateChangeDelay(2000); configurator.setHighlightElements(false); }
@BeforeSuite public void setupProxy(ITestContext testContext) { testContext.getSuite().setAttribute("cleanups", Lists.newArrayList()); String proxyHost = testConfig.getProperty("proxy.host"); String proxyPortString = testConfig.getProperty("proxy.port"); if( proxyPortString != null ) { System.setProperty("http.proxyHost", proxyHost); System.setProperty("http.proxyPort", proxyPortString); } }
/** * @author wasiq.bhamla * @since 13-Apr-2017 10:10:45 PM */ @BeforeSuite (alwaysRun = true) public void setupTestSuite () { this.androidServer = new AppiumServer ("android"); this.androidServer.start (); this.androidDevice = new AndroidDevice (this.androidServer, "test"); this.androidDevice.start (); }
@BeforeSuite public void beforeSuite(){ System.out.println("BaseCase: beforeSuite"); initConfig(); TestReport.startTime = DateUtil.getNow("yyyy-MM-dd HH:mm:ss"); TestReport.startMsTime = DateUtil.getNow("yyyy-MM-dd HH:mm:ss.SSS"); }
/** * Method that takes test suites parameters and sets some environment properties. * @param propFilePath path of the property file data * @param inputWebappName name of the service to test (optional parameter) * @param context testNG context */ @BeforeSuite @Override @Parameters(value = {ENV_PROP_FILE_PATH, WEBAPP_NAME}) public void beforeTestSuite(String propFilePath, @Optional(NO_INPUT_WEBAPP_NAME) String inputWebappName, ITestContext context) { TestSuiteHandler testSuiteHandler = TestSuiteHandler.getInstance(); testSuiteHandler.setPropertyFilePath(propFilePath); testSuiteHandler.populateEnvironmentHandler(); testSuiteHandler.populateTestCaseUtils(); }
/** * Method that takes test suites parameters and sets some environment properties. * @param propFilePath path of the property file data * @param inputWebappName name of the service to test (optional parameter) * @param context testNG context */ @BeforeSuite @Override @Parameters(value = {ENV_PROP_FILE_PATH, WEBAPP_NAME}) public void beforeTestSuite(String propFilePath, @Optional(NO_INPUT_WEBAPP_NAME) String inputWebappName, ITestContext context) { super.beforeTestSuite(propFilePath, inputWebappName, context); TestSuiteHandler.getInstance().setWebappName(inputWebappName); }
@BeforeSuite public static synchronized void setup() { if (!acsStarted) { AccessControlService.main(new String[] {}); acsStarted = true; } }
@BeforeSuite static void setupRegistry() { try { impl = TestLibrary.createRegistryOnEphemeralPort(); port = TestLibrary.getRegistryPort(impl); registry = LocateRegistry.getRegistry("localhost", port); } catch (RemoteException ex) { Assert.fail("initialization of registry", ex); } System.out.printf("RMI Registry filter: %s%n", registryFilter); }
@BeforeSuite static void init() { // create default shared JavaCompiler - reused across multiple // compilations comp = ToolProvider.getSystemJavaCompiler(); fm = comp.getStandardFileManager(null, null, null); }
@BeforeSuite public static void setup() { java.lang.management.OperatingSystemMXBean bean = ManagementFactory.getOperatingSystemMXBean(); if (bean instanceof OperatingSystemMXBean) { OperatingSystemMXBean os = (OperatingSystemMXBean)bean; long physicalMemorySize = os.getTotalPhysicalMemorySize() / (1024 * 1024); System.out.println("System memory size: " + physicalMemorySize + "M"); // when we can get system memory size, and it's larger than 2G, // then we enable large array size test below, // else disable large array size test below. if (physicalMemorySize > (2 * 1024)) { arraySizeCollection = new int[]{ SMALL_ARRAY_SIZE, THRESHOLD_ARRAY_SIZE, MEDIUM_ARRAY_SIZE, LARGE_ARRAY_SIZE }; System.out.println("System memory is large enough, add large array size test"); return; } } arraySizeCollection = new int[]{ SMALL_ARRAY_SIZE, THRESHOLD_ARRAY_SIZE, MEDIUM_ARRAY_SIZE }; System.out.println("System memory is not large enough, remove large array size test"); }
@BeforeSuite(alwaysRun = true) protected void suiteInit() throws Exception { File defaultLog = new File(DEFAULT_SUITE_LOG); if (defaultLog.exists() && !defaultLog.delete()){ logger.warn("Unable to delete default log file [{}].", defaultLog.getAbsolutePath()); } logger.info("Preparing spring context..."); super.springTestContextPrepareTestInstance(); }
/** * @throws IOException If the data provided is not found. */ @BeforeSuite public void setUp() throws IOException{ driver = DriverHolder.getDriver(OSName, driverName, Bit); WebOp = new WebOperation(driver); objectProperties = ReadObjectFile.getObjectData(PropertiesFilePath); // TODO: find way to dynamically change the sheet name //Get row counts }
@BeforeSuite public void beforeSuite() { BasicConfigurator.configure(); BlobStoreContext context = ContextBuilder .newBuilder(provider) .credentials(key, secret) .buildView(BlobStoreContext.class); blobStore = context.getBlobStore(); }
@BeforeSuite public void beforeSuite() { BasicConfigurator.configure(); ComputeServiceContext context = ContextBuilder .newBuilder(provider) .credentials(key, secret) .buildView(ComputeServiceContext.class); computeService = context.getComputeService(); }
@BeforeSuite public void beforeSuite() { BasicConfigurator.configure(); LoadBalancerServiceContext context = ContextBuilder .newBuilder(provider) .credentials(key, secret) .buildView(LoadBalancerServiceContext.class); loadBalancerService = context.getLoadBalancerService(); }
@BeforeSuite public void setup() throws NoSuchFieldException, IllegalAccessException { String home = IdentityEventConfigBuilder.class.getResource("/").getFile(); String config = IdentityEventConfigBuilder.class.getResource("/").getFile(); System.setProperty("carbon.home", home); System.setProperty("carbon.config.dir.path", config); }
/** * The setupSuite method allows you to use the xFramium configuration XML or property file. */ @BeforeSuite public void setupSuite( ITestContext tC ) { // // Register our Test Artifact // String xFID = UUID.randomUUID().toString(); Initializable.xFID.set( xFID ); Map<String,String> customConfig = new HashMap<String,String>(5); customConfig.put( "xF-ID", Initializable.xFID.get() ); ArtifactManager.instance( xFID ).registerArtifact( ArtifactTime.AFTER_TEST, "TAB_WEBHOME", WebHomeArtifact.class ); // // Specify your xFramium configuration file here as TXT or XML // File configurationFile = new File( "resources\\driverConfig.xml" ); System.out.println( configurationFile.getAbsolutePath() ); if ( configurationFile.getName().toLowerCase().endsWith( ".xml" ) ) cR = new XMLConfigurationReader(); else if ( configurationFile.getName().toLowerCase().endsWith( ".txt" ) ) cR = new TXTConfigurationReader(); cR.readConfiguration( configurationFile, false, customConfig ); }
@BeforeSuite public void setUp() throws Exception { KeyStore keyStore = KeyStore.getInstance("PKCS12"); keyStore.load(getClass().getClassLoader().getResourceAsStream("test-keystore.pfx"), PASSWORD); Key clientPrivateKey = keyStore.getKey(CLIENT_ALIAS, PASSWORD); if (clientPrivateKey instanceof PrivateKey) { clientCertificate = (X509Certificate) keyStore.getCertificate(CLIENT_ALIAS); clientCertificateBytes = clientCertificate.getEncoded(); PublicKey clientPublicKey = clientCertificate.getPublicKey(); clientKeyPair = new KeyPair(clientPublicKey, (PrivateKey) clientPrivateKey); } Key serverPrivateKey = keyStore.getKey(SERVER_ALIAS, PASSWORD); if (serverPrivateKey instanceof PrivateKey) { serverCertificate = (X509Certificate) keyStore.getCertificate(SERVER_ALIAS); serverCertificateBytes = serverCertificate.getEncoded(); PublicKey serverPublicKey = serverCertificate.getPublicKey(); serverKeyPair = new KeyPair(serverPublicKey, (PrivateKey) serverPrivateKey); } serverCertificateManager = new TestCertificateManager( serverKeyPair, serverCertificate ); serverCertificateValidator = new TestCertificateValidator(clientCertificate); }
@BeforeSuite protected void setup() { validator = new AvroValidator(getPersonSchema(), false); System.out.println("Validator config:"); System.out.println(validator); }
@BeforeSuite public void setup() throws SchemaException, SAXException, IOException { PrettyPrinter.setDefaultNamespacePrefix(MidPointConstants.NS_MIDPOINT_PUBLIC_PREFIX); PrismTestUtil.resetPrismContext(MidPointPrismContextFactory.FACTORY); // just something to fill into c:actor expression variable MidPointPrincipal principal = new MidPointPrincipal(new UserType(PrismTestUtil.getPrismContext())); SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = new UsernamePasswordAuthenticationToken(principal, null); securityContext.setAuthentication(authentication); }
@BeforeSuite public void setup() throws SchemaException, SAXException, IOException { PrettyPrinter.setDefaultNamespacePrefix(MidPointConstants.NS_MIDPOINT_PUBLIC_PREFIX); PrismTestUtil.resetPrismContext(MidPointPrismContextFactory.FACTORY); prismContext = PrismTestUtil.createInitializedPrismContext(); ObjectResolver resolver = new DirectoryFileObjectResolver(MidPointTestConstants.OBJECTS_DIR); ProtectorImpl protector = ExpressionTestUtil.createInitializedProtector(prismContext); expressionFactory = ExpressionTestUtil.createInitializedExpressionFactory(resolver, protector, prismContext, null); }
@BeforeSuite public void setup() throws SchemaException, SAXException, IOException { PrettyPrinter.setDefaultNamespacePrefix(DEFAULT_NAMESPACE_PREFIX); PrismTestUtil.resetPrismContext(new PrismInternalTestUtil()); matchingRuleRegistry = MatchingRuleRegistryFactory.createRegistry(); }
@BeforeSuite public void initTestSuite(ITestContext context) throws FileNotFoundException, IOException { Reporter.log("Invoked init test suite method \n", true); String propertiesFile = context.getCurrentXmlTest().getParameter("propertiesFile"); if (StringHelper.isEmpty(propertiesFile)) { propertiesFile = "target/test-classes/testng.properties"; } // Load test paramters //propertiesFile = "/Users/JAVIER/IdeaProjects/oxAuth/Client/target/test-classes/testng.properties"; FileInputStream conf = new FileInputStream(propertiesFile); Properties prop = new Properties(); prop.load(conf); Map<String, String> parameters = new HashMap<String, String>(); for (Entry<Object, Object> entry : prop.entrySet()) { Object key = entry.getKey(); Object value = entry.getValue(); if (StringHelper.isEmptyString(key) || StringHelper.isEmptyString(value)) { continue; } parameters.put(key.toString(), value.toString()); } // Overrided test paramters context.getSuite().getXmlSuite().setParameters(parameters); }
@BeforeSuite public void setupDebug() throws SchemaException, SAXException, IOException { PrettyPrinter.setDefaultNamespacePrefix(DEFAULT_NAMESPACE_PREFIX); PrismTestUtil.resetPrismContext(new PrismInternalTestUtil()); matchingRuleRegistry = MatchingRuleRegistryFactory.createRegistry(); }
@BeforeSuite public void setUpClientServer() throws Exception { UaTcpStackServerConfig serverConfig = configureServer( UaTcpStackServerConfig.builder() .setServerName("test") .setCertificateManager(serverCertificateManager) .setCertificateValidator(serverCertificateValidator) ).build(); server = new UaTcpStackServer(serverConfig); server .addEndpoint("opc.tcp://localhost:12685/test", null) .addEndpoint("opc.tcp://localhost:12685/test", null, serverCertificate, SecurityPolicy.Basic128Rsa15, MessageSecurityMode.Sign) .addEndpoint("opc.tcp://localhost:12685/test", null, serverCertificate, SecurityPolicy.Basic256, MessageSecurityMode.Sign) .addEndpoint("opc.tcp://localhost:12685/test", null, serverCertificate, SecurityPolicy.Basic256Sha256, MessageSecurityMode.Sign) .addEndpoint("opc.tcp://localhost:12685/test", null, serverCertificate, SecurityPolicy.Basic128Rsa15, MessageSecurityMode.SignAndEncrypt) .addEndpoint("opc.tcp://localhost:12685/test", null, serverCertificate, SecurityPolicy.Basic256, MessageSecurityMode.SignAndEncrypt) .addEndpoint("opc.tcp://localhost:12685/test", null, serverCertificate, SecurityPolicy.Basic256Sha256, MessageSecurityMode.SignAndEncrypt); server.startup().get(); EndpointDescription endpoint = selectEndpoint( UaTcpStackClient.getEndpoints( "opc.tcp://localhost:12685/test").get() ); UaTcpStackClientConfig clientConfig = configureClient( UaTcpStackClientConfig.builder() .setEndpoint(endpoint) .setKeyPair(clientKeyPair) .setCertificate(clientCertificate) ).build(); client = new UaTcpStackClient(clientConfig); client.connect().get(); }
/** * Installation step that initializes the application. * * @throws Exception * if the test failed */ @BeforeSuite(dependsOnMethods = "installationStep4InitializeCommunoteAccount") public void installationStep5InitializeApplication() throws Exception { CommunoteRuntime.getInstance().getInstaller().initializeApplicationAfterInstallation(); // set the global client as current client ClientTO client = ServiceLocator.findService(ClientRetrievalService.class) .findClient(ClientHelper.getGlobalClientId()); ClientAndChannelContextHolder.setClient(client); Date creationDate = client.getCreationDate(); Timestamp encryptedCreationDate = ClientHelper.getCreationDate(); Assert.assertEquals(creationDate, encryptedCreationDate); }