Java 类org.testng.annotations.BeforeGroups 实例源码

项目:riot-automated-tests    文件:RiotParentTest.java   
@BeforeGroups(groups="1driver_android")
public void setUp1AndroidDriver() throws Exception{
    //Start appium server 1 if necessary.
    startAppiumServer1();

    //Create android driver 1 if necessary
    //if(appiumFactory.getAndroidDriver1()==null || appiumFactory.getAndroidDriver1()!=null && appiumFactory.getAndroidDriver1().getSessionId()==null){
    if(appiumFactory.getAndroidDriver1()==null || appiumFactory.getAndroidDriver1().getSessionId()==null){
        Map<String, String> androidDevice1=ReadConfigFile.getInstance().getDevicesMap().get("androiddevice1");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.UDID,androidDevice1.get(MobileCapabilityType.UDID));
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,androidDevice1.get(MobileCapabilityType.DEVICE_NAME));
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,androidDevice1.get(MobileCapabilityType.PLATFORM_NAME));
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, androidDevice1.get(MobileCapabilityType.PLATFORM_VERSION));
        capabilities.setCapability("appPackage", Constant.PACKAGE_APP_NAME);
        capabilities.setCapability("appActivity", Constant.APPLICATION_LOGIN_ACTIVITY);
        capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
        capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 1200);
        capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
        //Set android driver 1
        appiumFactory.setAndroidDriver1(new URL(Constant.getServer1HttpAddress()), capabilities);
        System.out.println("Application "+Constant.PACKAGE_APP_NAME+" started on device "+capabilities.getCapability(MobileCapabilityType.DEVICE_NAME) +" with AppiumDriver 1.");   
    }
}
项目:communote-server    文件:GroupManagementTest.java   
/**
 * Prepares the hierarchical group tests.
 *
 * @throws Exception
 *             if the setup fails
 */
@BeforeGroups(groups = { "hierarchical-groups" })
public void beforeHgroup() throws Exception {
    UserGroupManagement gm = getGroupManagement();
    int[] usersToAdd = { 3, 3, 2, 2 };
    for (int i = 1; i <= 4; i++) {
        String alias = getHierarchicalGroupAlias(i);
        GroupVO vo = new GroupVO(getHierarchicalGroupName(i), alias, null);
        gm.createGroup(vo);
        Group group = UserAndGroupTestUtils.findGroup(alias);
        Assert.assertNotNull(group);
        String userAliasPattern = getHierarchicalGroupUserAliasPattern(i);
        UserAndGroupTestUtils.createDummyUsers(userAliasPattern,
                getHierarchicalGroupUserEmailPattern(i), 3);
        UserAndGroupTestUtils.addUsersToGroup(group, userAliasPattern, usersToAdd[i - 1], null);
    }
}
项目:communote-server    文件:BlogRightsTest.java   
/**
 * Prepare before running tests of modGroupBlogMemberTestsGroup.
 *
 * @throws Exception
 *             if setup fails
 */
@BeforeGroups(groups = { "modGroupBlogMemberTestsGroup" })
public void beforeModGroupBlogMemberTestsGroup() throws Exception {
    AuthenticationTestUtils.setSecurityContext(UserAndGroupTestUtils.findNthUser(
            BLOG_MANAGER_ALIAS_PATTERN_PREFIX, 2));
    Long blogId = getBlogManagement().findBlogByIdentifier(BLOG_2_ALIAS).getId();
    Long groupId1 = UserAndGroupTestUtils.findGroup(GROUP_1_ALIAS).getId();
    getBlogRightsManagement().addEntity(blogId, groupId1, BlogRole.VIEWER);
    Long groupId2 = UserAndGroupTestUtils.findGroup(GROUP_2_ALIAS).getId();
    getBlogRightsManagement().addEntity(blogId, groupId2, BlogRole.MEMBER);
    Long userId = UserAndGroupTestUtils.findNthUser(USER_NO_GROUP_ALIAS_PATTERN_PREFIX, 1)
            .getId();
    getBlogRightsManagement().addEntity(blogId, userId, BlogRole.MANAGER);
    AuthenticationHelper.removeAuthentication();
    // put a manager in security context
    AuthenticationTestUtils.setSecurityContext(UserAndGroupTestUtils.findNthUser(
            InstallerTest.TEST_MANAGER_USER_ALIAS, -1));
}
项目:microservice-mock    文件:ConfigurationManagerTest.java   
@BeforeGroups (groups = TEST_CONFIG_MANAGER_REQUIRED, inheritGroups = true)
public void initTestConfigManager() throws JAXBException, IOException, SAXException {
    LOGGER.info("About to initialize test config manager");
    final String CONFIG_LOCATION = "src/test/resources/config/mock/config-for-ConfigurationManagerTest.xml";
    final String DATA_LOCATION = "src/test/resources/data/response";
    this.configurationManager = new ConfigurationManager(CONFIG_LOCATION, DATA_LOCATION);
    Assert.assertNotNull(this.configurationManager);
}
项目:microservice-mock    文件:ConfigurationManagerTest.java   
@BeforeGroups (groups = TEST_QUERY_GROUP_CONFIG_MANAGER_REQUIRED, inheritGroups = true)
public void initTestQueryGroupConfigManager() throws JAXBException, IOException, SAXException {
    LOGGER.info("About to initialize test queryGroup config manager");
    final String CONFIG_LOCATION = "src/test/resources/config/mock/test-configuration-with-queryParams.xml";
    final String DATA_LOCATION = "src/test/resources/data/response";
    this.configurationManager = new ConfigurationManager(CONFIG_LOCATION, DATA_LOCATION);
    Assert.assertNotNull(this.configurationManager);
}
项目:qaf    文件:TestNGTestCase.java   
@BeforeGroups(alwaysRun = true)
@BeforeClass(alwaysRun = true)
final public void setup(ITestContext context) {

    ConfigurationManager.getBundle().addProperty(ApplicationProperties.CURRENT_TEST_CONTEXT.key, context);
    this.context = context;
}
项目:riot-automated-tests    文件:RiotParentTest.java   
@BeforeGroups(groups="1driver_ios")
public void setUp1IosDriver() throws Exception{
    //Start appium server 1 if necessary.
    startAppiumServer1();

    //Create ios driver 1 if necessary
    if(appiumFactory.getiOsDriver1()==null || appiumFactory.getiOsDriver1().getSessionId()==null){
        Map<String, String> iosDevice1=ReadConfigFile.getInstance().getDevicesMap().get("iosdevice1");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.UDID, iosDevice1.get(MobileCapabilityType.UDID));
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,iosDevice1.get(MobileCapabilityType.DEVICE_NAME));
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,iosDevice1.get(MobileCapabilityType.PLATFORM_NAME));
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, iosDevice1.get(MobileCapabilityType.PLATFORM_VERSION));
        capabilities.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "im.vector.app");
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,iosDevice1.get(MobileCapabilityType.AUTOMATION_NAME));
        capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
        capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
        capabilities.setCapability("xcodeOrgId", ReadConfigFile.getInstance().getConfMap().get("development_team"));
        capabilities.setCapability("xcodeSigningId", ReadConfigFile.getInstance().getConfMap().get("code_sign_identity"));
        //capabilities.setCapability("xcodeConfigFile", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Configurations/ProjectSettings.xcconfig");
        //capabilities.setCapability("keychainPath","/Users/matrix/Library/Keychains/appiumKeychain.keychain");
        //capabilities.setCapability("keychainPassword","appium6754");
        capabilities.setCapability("autoDismissAlerts", false);
        capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 1200);

        appiumFactory.setiOSDriver1(new URL(Constant.getServer1HttpAddress()), capabilities);
        System.out.println("Application "+Constant.APPLICATION_NAME+" started on IOS device "+capabilities.getCapability(MobileCapabilityType.DEVICE_NAME) +" with DRIVER 1.");
    }
}
项目:riot-automated-tests    文件:RiotParentTest.java   
@BeforeGroups(groups="1driver_ios_install")
public void setUp1IosDriverForInstallation() throws Exception{
    //Start appium server 1 if necessary.
    startAppiumServer1();
    Map<String, String> iosDevice1=ReadConfigFile.getInstance().getDevicesMap().get("iosdevice1");

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.UDID, iosDevice1.get(MobileCapabilityType.UDID));
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,iosDevice1.get(MobileCapabilityType.DEVICE_NAME));
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,iosDevice1.get(MobileCapabilityType.PLATFORM_NAME));
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, iosDevice1.get(MobileCapabilityType.PLATFORM_VERSION));
    capabilities.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir")+Constant.PATH_TO_IOS_IPA);
    //capabilities.setCapability("bundleId", "im.vector.app");
    //XCUITest is used because Appium Ios driver doesn't support xcode version 8.0
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,iosDevice1.get(MobileCapabilityType.AUTOMATION_NAME));
    capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
    capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
    capabilities.setCapability("xcodeOrgId", ReadConfigFile.getInstance().getConfMap().get("development_team"));
    capabilities.setCapability("xcodeSigningId", ReadConfigFile.getInstance().getConfMap().get("code_sign_identity"));
    capabilities.setCapability(IOSMobileCapabilityType.AUTO_DISMISS_ALERTS, false);
    capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 1200);
    //      capabilities.setCapability("autoWebview", true);

    AppiumFactory appiumFactory=AppiumFactory.getInstance();
    appiumFactory.setiOSDriver1(new URL(Constant.getServer1HttpAddress()), capabilities);
    System.out.println("Application "+Constant.APPLICATION_NAME+" started on IOS device "+capabilities.getCapability(MobileCapabilityType.DEVICE_NAME) +" with DRIVER 1.");
}
项目:riot-automated-tests    文件:RiotRegisterTests.java   
/**
 * Log-out the user if it can't see the login page.
 * @throws InterruptedException
 */
@BeforeGroups(groups="loginpage")
private void logOutIfNecessary() throws InterruptedException{
    if(false==waitUntilDisplayed(appiumFactory.getiOsDriver1(),"AuthenticationVCView", true, 5)){
        System.out.println("Can't access to the login page, a user must be logged. Forcing the log-out.");
        RiotHomePageTabObjects homePage = new RiotHomePageTabObjects(appiumFactory.getiOsDriver1());
        homePage.logOutFromTabs();
    }
}
项目:riot-automated-tests    文件:RiotLoginTests.java   
/**
 * Log-out the user if it can't see the login page.
 * @throws InterruptedException
 */
@BeforeGroups(groups="loginpage")
private void logOutIfNecessary() throws InterruptedException{
    if(false==waitUntilDisplayed(appiumFactory.getiOsDriver1(),"AuthenticationVCView", true, 5)){
        System.out.println("Can't access to the login page, a user must be logged. Forcing the log-out.");
        RiotHomePageTabObjects homePage = new RiotHomePageTabObjects(appiumFactory.getiOsDriver1());
        homePage.logOutFromTabs();
    }
}
项目:riot-automated-tests    文件:RiotDirectMessagesTests.java   
/**
 * Open settings from recents list and check if contacts permission are checked on both devices.
 * @throws InterruptedException
 */
@BeforeGroups("check_contacts_permission")
private void checkContactPermissionChecked() throws InterruptedException{
    System.out.println("Check if contact permission is checked on device1.");
    RiotHomePageTabObjects homePage1=new RiotHomePageTabObjects(appiumFactory.getAndroidDriver1());
    RiotSettingsPageObjects settingsView1= homePage1.openRiotSettingsFromLateralMenu();
    settingsView1.checkContactsPermissionIfNecessary(true);
    settingsView1.actionBarBackButton.click();

    System.out.println("Check if contact permission is checked on device2.");
    RiotHomePageTabObjects homePage2=new RiotHomePageTabObjects(appiumFactory.getAndroidDriver1());
    RiotSettingsPageObjects settingsView2= homePage2.openRiotSettingsFromLateralMenu();
    settingsView2.checkContactsPermissionIfNecessary(true);
    settingsView2.actionBarBackButton.click();
}
项目:riot-automated-tests    文件:RiotNoConnectionTests.java   
@BeforeGroups(groups="nointernet")
private void setWifiOffForNoConnectionTests(){
    if(!appiumFactory.getAndroidDriver1().getConnection().equals(Connection.NONE)){
        System.out.println("Setting up the connection to NONE for the tests without internet connection.");
        appiumFactory.getAndroidDriver1().setConnection(Connection.NONE);
    }
}
项目:product-ei    文件:HumanTaskXpathExtensionsTest.java   
/**
 * Initialize the test by deploying required artifacts.
 * @throws Exception
 */
@BeforeGroups(groups = { "wso2.bps.task.people.assignment" })
protected void initialize() throws Exception {
    log.info("Initializing HumanTask task creation Test...");
    userManagementClient = new UserManagementClient(backEndUrl, sessionCookie);
    addRoles();
    humanTaskPackageManagementClient = new HumanTaskPackageManagementClient(backEndUrl, sessionCookie);
    log.info("Add users success !");
    humanTaskPackageManagementClient
            .unDeployHumanTask(HumanTaskTestConstants.CLAIMS_APPROVAL_PACKAGE_ORG_ENTITY_NAME, "ApproveClaim");
    deployArtifact();
    requestSender.waitForProcessDeployment(backEndUrl + "ClaimService");
}
项目:product-ei    文件:HumanTaskPeopleAssignment.java   
@BeforeGroups(groups = {"wso2.bps.task.people.assignment"})
protected void initialize() throws Exception {
    log.info("Initializing HumanTask task creation Test...");
    userManagementClient = new UserManagementClient(backEndUrl, sessionCookie);
    addRoles();
    humanTaskPackageManagementClient = new HumanTaskPackageManagementClient(backEndUrl, sessionCookie);
    log.info("Add users success !");
    deployArtifact();
    requestSender.waitForProcessDeployment(backEndUrl + HumanTaskTestConstants.CLAIM_SERVICE);
}
项目:ZTVDC    文件:DownloaderTest.java   
@BeforeGroups(groups = {"downloadLight", "downloadFull"})
public static void clearDownloads() {
    File downloadDir = new File(EzHttp.getDownloadLocation());
    String[]entries = downloadDir.list();
    System.out.println("blah");
    for(String s: entries != null ? entries : new String[0]){ //ternary operator lol
        File currentFile = new File(downloadDir.getPath(),s);
        currentFile.delete();
    }
}
项目:communote-server    文件:PublicAccessProcessingFilterTest.java   
/**
 * Setups "allow anonymous access".
 */
@BeforeGroups(groups = { "allowAnonymous" })
public void setupAllowAnonymous() {
    CommunoteRuntime
    .getInstance()
    .getConfigurationManager()
    .updateClientConfigurationProperty(ClientProperty.CLIENT_BLOG_ALLOW_PUBLIC_ACCESS,
            Boolean.toString(true));

    AnonymousAuthenticationToken authToken = new AnonymousAuthenticationToken("login",
            "anonymous", Arrays.asList(new GrantedAuthority[] { new SimpleGrantedAuthority(
                    AuthenticationHelper.ROLE_ANONYMOUS) }));
    SecurityContextHolder.getContext().setAuthentication(authToken);
}
项目:communote-server    文件:PublicAccessProcessingFilterTest.java   
/**
 * Setups "not allow anonymous access".
 */
@BeforeGroups(groups = { "notAllowAnonymous" })
public void setupDontAllowAnonymous() {
    CommunoteRuntime
    .getInstance()
    .getConfigurationManager()
    .updateClientConfigurationProperty(ClientProperty.CLIENT_BLOG_ALLOW_PUBLIC_ACCESS,
            Boolean.toString(false));

    AnonymousAuthenticationToken authToken = new AnonymousAuthenticationToken("login",
            "anonymous", Arrays.asList(new GrantedAuthority[] { new SimpleGrantedAuthority(
                    AuthenticationHelper.ROLE_ANONYMOUS) }));
    SecurityContextHolder.getContext().setAuthentication(authToken);
}
项目:communote-server    文件:UserManagementTest.java   
/**
 * Prepare deletion
 */
@BeforeGroups(groups = { "DeleteTestUserByManager" })
public void prepareDeleteTestUserByManagerTests() {
    try {
        createUserForDeletion();
        AuthenticationTestUtils.setSecurityContext(
                userManagement.findUserByAlias(InstallerTest.TEST_MANAGER_USER_ALIAS));
    } catch (Exception e) {
        Assert.fail("Preparing the user deletion by manager failed.", e);
    }
}
项目:communote-server    文件:UserManagementTest.java   
/**
 * Prepare deletion
 */
@BeforeGroups(groups = { "DeleteTestUserByUser" })
public void prepareDeleteTestUserByUserTests() {
    try {
        User userToDel = createUserForDeletion();
        AuthenticationTestUtils.setSecurityContext(userToDel);
    } catch (Exception e) {
        Assert.fail("Preparing the user deletion by user failed.", e);
    }
}
项目:communote-server    文件:UserManagementTest.java   
/**
 * Prepare deletion
 */
@BeforeGroups(groups = { "DeleteTestUserWithBlogs" })
public void prepareDeleteTestUserWithBlogTests() {
    try {
        User userToDel = createUserForDeletion(TEST_DEL_USER_2_EMAIL, TEST_DEL_USER_2_ALIAS);
        createTestBlogsAndPost(userToDel);
        AuthenticationTestUtils.setSecurityContext(
                userManagement.findUserByAlias(InstallerTest.TEST_MANAGER_USER_ALIAS));
    } catch (Exception e) {
        Assert.fail("Preparing the deletion of a user with blogs failed.", e);
    }
}
项目:communote-server    文件:BlogRightsTest.java   
/**
 * Prepare before running tests of allCanBlogMemberTestsGroup.
 *
 * @throws Exception
 *             if setup fails
 */
@BeforeGroups(groups = { "allCanBlogMemberTestsGroup" })
public void beforeAllCanBlogMemberTestsGroup() throws Exception {
    // no setup for blog memberships, because we depend on modGroup group which provides blog 2
    // with group 1 as viewer and NO_GROUP user 1 as manager
    // add an external group to blog 1
    AuthenticationHelper.setInternalSystemToSecurityContext();
    String externalSystemId = LdapActivator.EXTERNAL_SYSTEM_ID_DEFAULT_LDAP;
    Group group = createGroup(GROUP_2_ALIAS, GROUP_2_NAME, externalSystemId);
    Long groupId = group.getId();
    UserAndGroupTestUtils.addUsersToGroup(group, USER_GROUP_2_ALIAS_PATTERN_PREFIX, 4,
            externalSystemId);
    UserAndGroupTestUtils.addUsersToGroup(group, USER_GROUP_1A2_ALIAS_PATTERN_PREFIX, 4,
            externalSystemId);

    AuthenticationHelper.removeAuthentication();
    AuthenticationTestUtils.setSecurityContext(UserAndGroupTestUtils.findNthUser(
            BLOG_MANAGER_ALIAS_PATTERN_PREFIX, 2));
    // assign external object and than a group for that external object
    Long blogId = getBlogManagement().findBlogByIdentifier(BLOG_2_ALIAS).getId();
    ExternalObject externalObjectTO = ExternalObject.Factory.newInstance();
    externalObjectTO.setExternalId(UUID.randomUUID().toString());
    externalObjectTO.setExternalName(UUID.randomUUID().toString());
    externalObjectTO.setExternalSystemId(testExternalSystemId);
    ServiceLocator.instance().getService(ExternalObjectManagement.class)
            .assignExternalObject(blogId, externalObjectTO);
    getBlogRightsManagement().assignEntityForExternal(blogId, groupId, BlogRole.VIEWER,
            externalObjectTO.getExternalSystemId(), externalObjectTO.getExternalId());

    assertGroupBlogAccess(blogId, groupId, BlogRole.VIEWER, false, usersInBothGroups);
}
项目:cats    文件:AxisServerStreamTest.java   
/**
 * Starts the jetty web server.
 * Note that every tests that requires the jetty server to be running should be
 * in the group "jetty".
 */
@BeforeGroups(groups = JETTY_TEST)
public final void setupJettyServer() {
    Properties portProp = new Properties();
    try {
        portProp.load(ResourceUtil.loadResource(this.getClass(), PORT_PROPS));
    } catch (IOException e) {
        Assert.fail("Could not load port propeties file: " + PORT_PROPS, e);
    }
    String avaialblePort = portProp.getProperty("availablePort");
    if (avaialblePort != null) {
        try {
            int port = Integer.parseInt(avaialblePort);

            s_mpeg_url = "http://localhost:" + port + "/mjpg/video.cgi";        
            s_bad_url = "http://localhost:" + (port + 1) + "/mjpg/video.cgi";

            server = new JettyAxisCameraServer(port, getCameraConfig());        
            Assert.assertTrue(server.startServer(), "Could not start jetty server");
            Reporter.log("Jetty Server running on port " + port);
        } catch (NumberFormatException ex) {
            Assert.fail("Error converting port: " + avaialblePort + " to int.", ex);
        }
    } else {
        Assert.fail("Could not get availablePort from properties.");
    }
}
项目:teammates    文件:AdminActivityLogPageActionTest.java   
@BeforeGroups("typicalActivityLogs")
public void removeAndRestoreLogMessage() {
    gaeSimulation.loginAsAdmin("admin");
    gaeSimulation.clearLogs();

    Date twoDaysAgo = TimeHelper.getDateOffsetToCurrentTime(-2);
    insertLogMessagesAtTime(logMessages.get(LOG_MESSAGE_INDEX_TWO_DAYS_AGO), twoDaysAgo.getTime());
    Date yesterday = TimeHelper.getDateOffsetToCurrentTime(-1);
    insertLogMessagesAtTime(logMessages.get(LOG_MESSAGE_INDEX_YESTERDAY), yesterday.getTime());
    Date today = TimeHelper.getDateOffsetToCurrentTime(0);
    insertLogMessagesAtTime(logMessages.get(LOG_MESSAGE_INDEX_TODAY), today.getTime());
}
项目:teammates    文件:AdminActivityLogPageActionTest.java   
@BeforeGroups("manyActivityLogs")
public void removeAndRestoreManyLogs() {
    gaeSimulation.loginAsAdmin("admin");
    gaeSimulation.clearLogs();

    Date today = TimeHelper.getDateOffsetToCurrentTime(0);
    insertLogMessageAtTimeWithInterval(logMessages.get(LOG_MESSAGE_INDEX_MANY_LOGS),
            today.getTime(), LOG_MESSAGE_INTERVAL_MANY_LOGS);
}
项目:teammates    文件:AdminEmailLogPageActionTest.java   
@BeforeGroups("typicalEmailLogs")
public void removeAndRestoreLogMessage() {
    gaeSimulation.loginAsAdmin("admin");
    gaeSimulation.clearLogs();

    Date twoDaysAgo = TimeHelper.getDateOffsetToCurrentTime(-2);
    insertLogMessagesAtTime(logMessages.get(LOG_MESSAGE_INDEX_TWO_DAYS_AGO), twoDaysAgo.getTime());
    Date yesterday = TimeHelper.getDateOffsetToCurrentTime(-1);
    insertLogMessagesAtTime(logMessages.get(LOG_MESSAGE_INDEX_YESTERDAY), yesterday.getTime());
    Date today = TimeHelper.getDateOffsetToCurrentTime(0);
    insertLogMessagesAtTime(logMessages.get(LOG_MESSAGE_INDEX_TODAY), today.getTime());
}
项目:teammates    文件:AdminEmailLogPageActionTest.java   
@BeforeGroups("manyEmailLogs")
public void removeAndRestoreManyLogs() {
    gaeSimulation.loginAsAdmin("admin");
    gaeSimulation.clearLogs();

    Date today = TimeHelper.getDateOffsetToCurrentTime(0);
    insertLogMessageAtTimeWithInterval(logMessages.get(LOG_MESSAGE_INDEX_MANY_LOGS),
            today.getTime(), LOG_MESSAGE_INTERVAL_MANY_LOGS);
}
项目:omero-csv-tools    文件:DbUnitInitializerTest.java   
@Test(groups = { Groups.SETUP }, alwaysRun = true)
@BeforeGroups(groups = { Groups.INTEGRATION })
@DataSet(value = DataSets.Xml.COMMON, loadStrategy = RefreshLoadStrategy.class)
public void initDatabaseState() {
    // let DbUnit populate or refresh the base fixures (experimenter, group, event, session, etc).
    log.debug("Performing database state refresh");
}
项目:allure-java    文件:AllFeatures.java   
@BeforeGroups
public void beforeGroups1() throws IOException {
    addImgAttachment();
}
项目:allure-java    文件:AllFeatures.java   
@BeforeGroups
public void beforeGroups2() throws IOException {
    addImgAttachment();
    addStringAttachment();
}
项目:openjdk-jdk10    文件:PermissionTest.java   
@BeforeGroups (groups = {"NoManageProcessPermission"})
public void noPermissionsSetup(){
    Policy.setPolicy(new TestPolicy());
    SecurityManager sm = new SecurityManager();
    System.setSecurityManager(sm);
}
项目:openjdk9    文件:PermissionTest.java   
@BeforeGroups (groups = {"NoManageProcessPermission"})
public void noPermissionsSetup(){
    Policy.setPolicy(new TestPolicy());
    SecurityManager sm = new SecurityManager();
    System.setSecurityManager(sm);
}
项目:openjdk9    文件:JAXPFileReadOnlyBaseTest.java   
/**
 * Allowing access local file system for this group.
 */
@BeforeGroups (groups = {"readLocalFiles"})
public void setFilePermissions() {
    setPermissions(new FilePermission(SRC_DIR + "/-", "read"));
}
项目:microservice-mock    文件:ConfigurationManagerTest.java   
@BeforeGroups (groups = DEFAULT_CONFIG_MANAGER_REQUIRED)
public void initDefaultConfigManager() throws JAXBException, IOException, SAXException {
    LOGGER.info("About to initialize default config manager");
    this.configurationManager = new ConfigurationManager(null, null);
    Assert.assertNotNull(this.configurationManager);
}
项目:incubator-omid    文件:OmidTestBase.java   
@BeforeGroups(groups = "sharedHBase")
public void beforeGroups(ITestContext context) throws Exception {
    // TSO Setup
    TSOServerConfig tsoConfig = new TSOServerConfig();
    tsoConfig.setPort(1234);
    tsoConfig.setConflictMapSize(1000);
    Injector injector = Guice.createInjector(new TSOMockModule(tsoConfig));
    LOG.info("Starting TSO");
    TSOServer tso = injector.getInstance(TSOServer.class);
    hBaseCommitTableConfig = injector.getInstance(HBaseCommitTableConfig.class);
    HBaseTimestampStorageConfig hBaseTimestampStorageConfig = injector.getInstance(HBaseTimestampStorageConfig.class);
    tso.startAndWait();
    TestUtils.waitForSocketListening("localhost", 1234, 100);
    LOG.info("Finished loading TSO");
    context.setAttribute("tso", tso);

    OmidClientConfiguration clientConf = new OmidClientConfiguration();
    clientConf.setConnectionString("localhost:1234");
    context.setAttribute("clientConf", clientConf);

    InMemoryCommitTable commitTable = (InMemoryCommitTable) injector.getInstance(CommitTable.class);
    context.setAttribute("commitTable", commitTable);

    // Create the associated Handler
    TSOClient client = TSOClient.newInstance(clientConf);
    context.setAttribute("client", client);

    // ------------------------------------------------------------------------------------------------------------
    // HBase setup
    // ------------------------------------------------------------------------------------------------------------
    LOG.info("Creating HBase minicluster");
    hbaseConf = HBaseConfiguration.create();
    hbaseConf.setInt("hbase.hregion.memstore.flush.size", 10_000 * 1024);
    hbaseConf.setInt("hbase.regionserver.nbreservationblocks", 1);
    hbaseConf.setInt(HBASE_CLIENT_RETRIES_NUMBER, 3);

    File tempFile = File.createTempFile("OmidTest", "");
    tempFile.deleteOnExit();
    hbaseConf.set("hbase.rootdir", tempFile.getAbsolutePath());

    hBaseUtils = new HBaseTestingUtility(hbaseConf);
    hbaseCluster = hBaseUtils.startMiniCluster(1);
    hBaseUtils.createTable(Bytes.toBytes(hBaseTimestampStorageConfig.getTableName()),
                           new byte[][]{hBaseTimestampStorageConfig.getFamilyName().getBytes()},
                           Integer.MAX_VALUE);

    createTestTable();
    createCommitTable();

    LOG.info("HBase minicluster is up");
}
项目:riot-automated-tests    文件:RiotParentTest.java   
/**
 * @throws Exception
 */
@BeforeGroups(groups="2drivers_android")
public void setUp2AndroidDrivers() throws Exception{
    //Start the two appium's servers if necessary.
    start2AppiumServers();

    Map<String, String> androidDevice1=ReadConfigFile.getInstance().getDevicesMap().get("androiddevice1");
    Map<String, String> androidDevice2=ReadConfigFile.getInstance().getDevicesMap().get("androiddevice2");

    //Create android driver 1 if necessary
    if(appiumFactory.getAndroidDriver1()==null || appiumFactory.getAndroidDriver1().getSessionId()==null){
        DesiredCapabilities capabilities1 = new DesiredCapabilities();
        capabilities1.setCapability(MobileCapabilityType.UDID,androidDevice1.get(MobileCapabilityType.UDID));
        capabilities1.setCapability(MobileCapabilityType.DEVICE_NAME,androidDevice1.get(MobileCapabilityType.DEVICE_NAME));
        capabilities1.setCapability(MobileCapabilityType.PLATFORM_NAME,androidDevice1.get(MobileCapabilityType.PLATFORM_NAME));
        capabilities1.setCapability(MobileCapabilityType.PLATFORM_VERSION, androidDevice1.get(MobileCapabilityType.PLATFORM_VERSION));
        capabilities1.setCapability("appPackage", Constant.PACKAGE_APP_NAME);
        capabilities1.setCapability("appActivity", Constant.APPLICATION_LOGIN_ACTIVITY);
        capabilities1.setCapability(MobileCapabilityType.NO_RESET, true);
        capabilities1.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "1200");
        capabilities1.setCapability(MobileCapabilityType.FULL_RESET, false);

        appiumFactory.setAndroidDriver1(new URL(Constant.getServer1HttpAddress()), capabilities1);
        System.out.println("Application "+Constant.APPLICATION_NAME+" started on ANDROID device "+capabilities1.getCapability(MobileCapabilityType.DEVICE_NAME) +" with DRIVER 1.");    
    }

    if(appiumFactory.getAndroidDriver2()==null || appiumFactory.getAndroidDriver2().getSessionId()==null){
        DesiredCapabilities capabilities2 = new DesiredCapabilities();
        capabilities2.setCapability(MobileCapabilityType.UDID,androidDevice2.get(MobileCapabilityType.UDID));
        capabilities2.setCapability(MobileCapabilityType.DEVICE_NAME,androidDevice2.get(MobileCapabilityType.DEVICE_NAME));
        capabilities2.setCapability(MobileCapabilityType.PLATFORM_NAME,androidDevice2.get(MobileCapabilityType.PLATFORM_NAME));
        capabilities2.setCapability(MobileCapabilityType.PLATFORM_VERSION, androidDevice2.get(MobileCapabilityType.PLATFORM_VERSION));
        capabilities2.setCapability("appPackage", Constant.PACKAGE_APP_NAME);
        capabilities2.setCapability("appActivity", Constant.APPLICATION_LOGIN_ACTIVITY);
        capabilities2.setCapability(MobileCapabilityType.NO_RESET, true);
        capabilities2.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "1200");
        capabilities2.setCapability(MobileCapabilityType.FULL_RESET, false);
        appiumFactory.setAndroidDriver2(new URL(Constant.getServer2HttpAddress()), capabilities2);
        System.out.println("Application "+Constant.APPLICATION_NAME+" started on ANDROID device "+capabilities2.getCapability(MobileCapabilityType.DEVICE_NAME) +" with DRIVER 2.");
    }
}
项目:riot-automated-tests    文件:RiotParentTest.java   
@BeforeGroups(groups="2drivers_ios")
public void setUp2IosDriver() throws Exception{
    //Start the two appium's servers if necessary.
    Boolean iosDriver1NeedToStart=false;
    start2AppiumServers();

    //Create ios driver 1 if necessary
    if(appiumFactory.getiOsDriver1()==null || appiumFactory.getiOsDriver1().getSessionId()==null){
        iosDriver1NeedToStart=true;
        Map<String, String> iosDevice1=ReadConfigFile.getInstance().getDevicesMap().get("iosdevice1");
        DesiredCapabilities capabilities1 = new DesiredCapabilities();
        capabilities1.setCapability(MobileCapabilityType.UDID, iosDevice1.get(MobileCapabilityType.UDID));
        capabilities1.setCapability(MobileCapabilityType.DEVICE_NAME,iosDevice1.get(MobileCapabilityType.DEVICE_NAME));
        capabilities1.setCapability(MobileCapabilityType.PLATFORM_NAME,iosDevice1.get(MobileCapabilityType.PLATFORM_NAME));
        capabilities1.setCapability(MobileCapabilityType.PLATFORM_VERSION, iosDevice1.get(MobileCapabilityType.PLATFORM_VERSION));
        capabilities1.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "im.vector.app");
        //capabilities.setCapability(MobileCapabilityType.APP,"/Users/matrix/Documents/apps/ipa/Vector-d5ce6ff019a3e6b06a20bcc849ab57074e31e773-build1399.ipa");
        //XCUITest is used because Appium Ios driver doesn't support xcode version 8.0
        capabilities1.setCapability(MobileCapabilityType.AUTOMATION_NAME,iosDevice1.get(MobileCapabilityType.AUTOMATION_NAME));
        capabilities1.setCapability(MobileCapabilityType.NO_RESET, true);
        capabilities1.setCapability(MobileCapabilityType.FULL_RESET, false);
        capabilities1.setCapability("xcodeOrgId", ReadConfigFile.getInstance().getConfMap().get("development_team"));
        capabilities1.setCapability("xcodeSigningId", ReadConfigFile.getInstance().getConfMap().get("code_sign_identity"));
        capabilities1.setCapability(IOSMobileCapabilityType.AUTO_DISMISS_ALERTS, false);
        capabilities1.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 1200);

        appiumFactory.setiOSDriver1(new URL(Constant.getServer1HttpAddress()), capabilities1);
        System.out.println("Application "+Constant.APPLICATION_NAME+" started on IOS device "+capabilities1.getCapability(MobileCapabilityType.DEVICE_NAME) +" with DRIVER 1.");
    }

    //Create ios driver 2 if necessary
    if(appiumFactory.getiOsDriver2()==null || appiumFactory.getiOsDriver2().getSessionId()==null){
        DesiredCapabilities capabilities2 = new DesiredCapabilities();
        Map<String, String> iosDevice2=ReadConfigFile.getInstance().getDevicesMap().get("iosdevice2");
        capabilities2.setCapability(MobileCapabilityType.UDID, iosDevice2.get(MobileCapabilityType.UDID));
        capabilities2.setCapability(MobileCapabilityType.DEVICE_NAME,iosDevice2.get(MobileCapabilityType.DEVICE_NAME));
        capabilities2.setCapability(MobileCapabilityType.PLATFORM_NAME,iosDevice2.get(MobileCapabilityType.PLATFORM_NAME));
        capabilities2.setCapability(MobileCapabilityType.PLATFORM_VERSION, iosDevice2.get(MobileCapabilityType.PLATFORM_VERSION));
        capabilities2.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "im.vector.app");//app
        //capabilities.setCapability(MobileCapabilityType.APP,"/Users/matrix/Documents/apps/ipa/Vector-d5ce6ff019a3e6b06a20bcc849ab57074e31e773-build1399.ipa");
        //XCUITest is used because Appium Ios driver doesn't support xcode version 8.0
        capabilities2.setCapability(MobileCapabilityType.AUTOMATION_NAME,iosDevice2.get(MobileCapabilityType.AUTOMATION_NAME));
        capabilities2.setCapability("realDeviceLogger", "/usr/local/lib/node_modules/deviceconsole/deviceconsole");
        capabilities2.setCapability(MobileCapabilityType.NO_RESET, true);
        //capabilities2.setCapability(MobileCapabilityType.FULL_RESET, false);
        capabilities2.setCapability("xcodeOrgId", ReadConfigFile.getInstance().getConfMap().get("development_team"));
        capabilities2.setCapability("xcodeSigningId", ReadConfigFile.getInstance().getConfMap().get("code_sign_identity"));
        capabilities2.setCapability("autoDismissAlerts", false);
        capabilities2.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 1200);

        if(!iosDriver1NeedToStart){
            Thread.sleep(5000);
            int timeWaited=0;
            int maxToWait=6;
            while (!AppiumServerStartAndStopService.service2.isRunning()&&timeWaited<maxToWait) {
                timeWaited++;
                Thread.sleep(1000);
            }
            System.out.println(timeWaited);
        }
        appiumFactory.setiOSDriver2(new URL(Constant.getServer2HttpAddress()), capabilities2);
        System.out.println("Application "+Constant.APPLICATION_NAME+" started on IOS device "+capabilities2.getCapability(MobileCapabilityType.DEVICE_NAME) +" with DRIVER 2.");
    }       
}
项目:riot-automated-tests    文件:RiotVoipTests.java   
@BeforeGroups("2checkuser")
private void checkIfUser2Logged() throws InterruptedException, FileNotFoundException, YamlException{
    checkIfUserLoggedAndHomeServerSetUpIos(appiumFactory.getiOsDriver1(), riotuser1DisplayName, Constant.DEFAULT_USERPWD);
    checkIfUserLoggedAndHomeServerSetUpIos(appiumFactory.getiOsDriver2(), riotuser2DisplayName, Constant.DEFAULT_USERPWD);
}
项目:riot-automated-tests    文件:RiotMessagesReceptionTests.java   
@BeforeGroups("1checkuser")
private void checkIfUser1Logged() throws InterruptedException, FileNotFoundException, YamlException{
    super.checkIfUserLoggedAndHomeServerSetUpIos(appiumFactory.getiOsDriver1(), riotUserDisplayNameA, Constant.DEFAULT_USERPWD);
}
项目:riot-automated-tests    文件:RiotMessagesReceptionTests.java   
/**
 * Log riotuserup to get his access token. </br> Mandatory to send http request with it.
 * @throws IOException
 * @throws InterruptedException
 */
@BeforeGroups("1checkuser")
private void renewRiotInviterAccessToken() throws IOException, InterruptedException{
    System.out.println("Log "+riotSenderUserDisplayName+" to get a new AccessToken.");
    riotSenderAccessToken=HttpsRequestsToMatrix.login(riotSenderUserDisplayName, Constant.DEFAULT_USERPWD);
}
项目:riot-automated-tests    文件:RiotVoipTests.java   
@BeforeGroups("2checkuser")
private void checkIfUser2Logged() throws InterruptedException, FileNotFoundException, YamlException{
    super.checkIfUserLoggedAndHomeServerSetUpAndroid(appiumFactory.getAndroidDriver1(), riotuser1DisplayName, Constant.DEFAULT_USERPWD);
    super.checkIfUserLoggedAndHomeServerSetUpAndroid(appiumFactory.getAndroidDriver2(), riotuser2DisplayName, Constant.DEFAULT_USERPWD);
}