Java 类org.junit.experimental.categories.Category 实例源码

项目:elastic-db-tools-for-java    文件:MultiShardResultSetTests.java   
/**
 * Check that we throw as expected when trying to add a LabeledResultSet with a null ResultSet underneath.
 */
@Test
@Category(value = ExcludeFromGatedCheckin.class)
public final void testAddLabeledResultSetWithNullResultSet() throws SQLException {
    // What we're doing:
    // Set up a new sharded reader
    // Add two readers to it.
    // Try to add a third reader to it that has a null ResultSet underneath.
    // Verify that we threw as expected.
    String selectSql = "SELECT dbNameField, Test_int_Field, Test_bigint_Field" + " FROM ConsistentShardedTable WHERE Test_int_Field = 876";
    LabeledResultSet[] readers = new LabeledResultSet[3];
    readers[0] = getReader(conn1, selectSql, "Test0");
    readers[1] = getReader(conn2, selectSql, "Test1");

    SqlConnectionStringBuilder str = new SqlConnectionStringBuilder(conn3.getMetaData().getURL());
    ResultSet res = null;
    try {
        readers[2] = new LabeledResultSet(res, new ShardLocation(str.getDataSource(), "Test2"), conn3.createStatement());
    }
    catch (IllegalArgumentException ex) {
        assert ex.getMessage().equals("resultSet");
    }
}
项目:elastic-db-tools-for-java    文件:ShardMapTests.java   
/**
 * Remove existing shard from shard map.
 */
@Test
@Category(value = ExcludeFromGatedCheckin.class)
public void deleteShardDefault() {
    ShardMapManager smm = ShardMapManagerFactory.getSqlShardMapManager(Globals.SHARD_MAP_MANAGER_CONN_STRING, ShardMapManagerLoadPolicy.Lazy);
    ShardMap sm = smm.getShardMap(ShardMapTests.defaultShardMapName);
    assertNotNull(sm);

    ShardLocation s1 = new ShardLocation(Globals.TEST_CONN_SERVER_NAME, ShardMapTests.shardDbs[0]);

    Shard shardNew = sm.createShard(s1);

    assertNotNull(shardNew);

    sm.deleteShard(shardNew);

    ReferenceObjectHelper<Shard> refShard = new ReferenceObjectHelper<>(shardNew);
    sm.tryGetShard(s1, refShard);
    assertNull(refShard.argValue);
}
项目:SunmiAuto    文件:SunmiAppStore_v3_3_15.java   
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test009SearchByTitle() throws UiObjectNotFoundException {
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 hotOne = device.findObject(By.res("woyou.market:id/linear_hot_view")).findObject(By.res("woyou.market:id/tv_name"));
    String targetAppName = hotOne.getText();
    UiObject2 searchObj = device.findObject(By.res("woyou.market:id/tv_search").text("搜索"));
    searchObj.click();
    TestUtils.screenshotCap("afterClickSearchBar");
    TestUtils.sleep(SHORT_SLEEP);
    UiObject2 searchObj1 = device.findObject(By.res("woyou.market:id/et_search").text("搜索").focused(true));
    searchObj1.click();
    searchObj1.setText(targetAppName);
    TestUtils.screenshotCap("inputSearchContent");
    UiScrollable appList = new UiScrollable(new UiSelector().resourceId("woyou.market:id/list_view"));
    UiObject appInfo = appList.getChildByInstance(new UiSelector().className("android.widget.FrameLayout"),0);
    UiObject appNameObj = appInfo.getChild(new UiSelector().resourceId("woyou.market:id/tv_name"));
    Assert.assertEquals(targetAppName,appNameObj.getText());
}
项目:monarch    文件:RegionCreateDestroyDUnitTest.java   
@Category(FlakyTest.class) // GEODE-1922
@Test
public void testCreateDestroyValidRegion() throws InterruptedException {
  Cache serverCache = getCache();
  serverCache.createRegionFactory(RegionShortcut.REPLICATE).create(GOOD_REGION_NAME);

  try {
    startServer(serverCache);
  } catch (IOException e) {
    fail(e.getMessage());
  }
  client1.invoke(() -> {
    ClientCache cache = new ClientCacheFactory(createClientProperties())
        .setPoolSubscriptionEnabled(true).addPoolServer("localhost", serverPort).create();
    Region region =
        cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(GOOD_REGION_NAME);
    region.destroyRegion();
    assertThat(region.isDestroyed()).isTrue();
  });
}
项目:trellis-rosid-file-streaming    文件:BeamProcessorTest.java   
@Test
@Category(NeedsRunner.class)
public void testUnwritableRemoveContainerPipeline() throws Exception {

    final Map<String, String> dataConfiguration = singletonMap("repository",
            getClass().getResource("/dataDirectory2").toURI().toString());

    final File root = new File(getClass().getResource("/dataDirectory2").toURI());

    assumeTrue(root.setReadOnly());

    final PCollection<KV<String, String>> pCollection = pipeline
        .apply("Create", Create.of(CONTAINER_KV))
        .apply(ParDo.of(new BeamProcessor(dataConfiguration, LDP.PreferContainment.getIRIString(), false)));

    PAssert.that(pCollection).empty();

    pipeline.run();
    root.setWritable(true);
}
项目:SunmiAuto    文件:SunmiAppStore_v3_3_15.java   
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test025CommentAfterInstall() throws UiObjectNotFoundException {
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 hotObj = device.findObject(By.res("woyou.market:id/tv_hot_all").text("全部"));
    hotObj.clickAndWait(Until.newWindow(), LONG_WAIT);
    TestUtils.screenshotCap("hotAllInterface");
    UiScrollable hotAllScroll = new UiScrollable(new UiSelector().resourceId("woyou.market:id/list_view"));
    hotAllScroll.scrollIntoView(new UiSelector().resourceId("woyou.market:id/id_tv_install_view").text("打开"));
    UiObject2 installObj = device.findObject(By.res("woyou.market:id/id_tv_install_view").text("打开"));
    UiObject2 fullAppObj = installObj.getParent().getParent();
    fullAppObj.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("enterAppDetail");
    UiObject2 commentObj = device.findObject(By.res("woyou.market:id/tv_install_comment_app"));
    commentObj.clickAndWait(Until.newWindow(),LONG_WAIT);
    device.wait(Until.hasObject(By.res("woyou.market:id/rating_bar")),LONG_WAIT);
    TestUtils.screenshotCap("afterClickComment");
    UiObject2 rateObj = device.findObject(By.res("woyou.market:id/rating_bar"));
    Assert.assertNotNull(rateObj);
    device.pressBack();
}
项目:elastic-db-tools-for-java    文件:ShardMapManagerTests.java   
/**
 * Add a range shard map with duplicate name to shard map manager.
 */
@Test
@Category(value = ExcludeFromGatedCheckin.class)
public void createRangeShardMapDuplicate() throws Exception {
    ShardMapManager smm = ShardMapManagerFactory.getSqlShardMapManager(Globals.SHARD_MAP_MANAGER_CONN_STRING, ShardMapManagerLoadPolicy.Lazy);
    ShardMap sm = smm.createRangeShardMap(ShardMapManagerTests.shardMapName, ShardKeyType.Int32);
    assertNotNull(sm);

    assertEquals(ShardMapManagerTests.shardMapName, sm.getName());

    boolean creationFailed = false;

    try {
        RangeShardMap<Integer> rsm = smm.createRangeShardMap(ShardMapManagerTests.shardMapName, ShardKeyType.Int32);

    }
    catch (ShardManagementException sme) {
        assertEquals(ShardManagementErrorCategory.ShardMapManager, sme.getErrorCategory());
        assertEquals(ShardManagementErrorCode.ShardMapAlreadyExists, sme.getErrorCode());
        creationFailed = true;
    }
    assertTrue(creationFailed);
}
项目:monarch    文件:ReliableMessagingDUnitTest.java   
/**
 * If the primary fails before receiving an ack from the messages it delivered then it should send
 * an ack to the new primary so that new primary can sends QRM to other redundant servers.
 */
@Category(FlakyTest.class) // GEODE-694: async queuing
@Test
public void testPeriodicAckSendByClientPrimaryFailover() throws Exception {
  IgnoredException.addIgnoredException("java.net.ConnectException");
  createEntries();
  setClientServerObserverForBeforeSendingClientAck();
  server1.invoke(() -> ReliableMessagingDUnitTest.putOnServer());
  LogWriterUtils.getLogWriter().info("Entering waitForServerUpdate");
  waitForServerUpdate();
  LogWriterUtils.getLogWriter().info("Entering waitForCallback");
  waitForCallback();
  LogWriterUtils.getLogWriter().info("Entering waitForClientAck");
  waitForClientAck();
  server2.invoke(() -> ReliableMessagingDUnitTest.checkTidAndSeq());
}
项目:elastic-db-tools-for-java    文件:MultiShardResultSetTests.java   
/**
 * Validate basic ReadAsync behavior.
 */
@Test
@Category(value = ExcludeFromGatedCheckin.class)
public final void testReadAsync() throws SQLException {
    LabeledResultSet[] readers = new LabeledResultSet[1];
    readers[0] = getReader(conn1, "select 1", "Test0");
    int numRowsRead = 0;

    try (MultiShardResultSet sdr = new MultiShardResultSet(Arrays.asList(readers))) {
        while (sdr.next()) {
            numRowsRead++;
        }
    }
    catch (Exception e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertEquals("ReadAsync didn't return the expeceted number of rows.", 1, numRowsRead);
}
项目:monarch    文件:CompiledInDUnitTest.java   
@Category(FlakyTest.class) // GEODE-1771
@Test
public void whenMultipleEnumBindParametersAreUsedWithInQueryAndMapIndexIsPresentReturnCorrectResults()
    throws CacheException {
  final int numberOfEntries = 10;
  final int numExpectedResults = numberOfEntries / 2;
  final String queryString =
      "select * from " + regName + " where getMapField['1'] in SET ($1,$2)";

  vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
    public void run2() throws CacheException {
      configAndStartBridgeServer();
      createReplicateRegion();
      createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
      createEntries(numberOfEntries, regionName);
    }
  });

  Object[] bindArguments = new Object[] {DayEnum.MONDAY, DayEnum.TUESDAY};
  vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString,
      bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
}
项目:elastic-db-tools-for-java    文件:ShardMapManagerTests.java   
/**
 * Create list shard map.
 */
@Test
@Category(value = ExcludeFromGatedCheckin.class)
public void createListShardMapDefault() throws Exception {
    CountingCacheStore cacheStore = new CountingCacheStore(new CacheStore());

    ShardMapManager smm = new ShardMapManager(new SqlShardMapManagerCredentials(Globals.SHARD_MAP_MANAGER_CONN_STRING),
            new SqlStoreConnectionFactory(), new StoreOperationFactory(), cacheStore, ShardMapManagerLoadPolicy.Lazy,
            RetryPolicy.getDefaultRetryPolicy(), RetryBehavior.getDefaultRetryBehavior());

    ListShardMap<Integer> lsm = smm.createListShardMap(ShardMapManagerTests.shardMapName, ShardKeyType.Int32);

    assertNotNull(lsm);

    ShardMap smLookup = smm.lookupShardMapByName("LookupShardMapByName", ShardMapManagerTests.shardMapName, true);
    assertNotNull(smLookup);
    assertEquals(ShardMapManagerTests.shardMapName, smLookup.getName());
    assertEquals(1, cacheStore.getLookupShardMapCount());
    assertEquals(1, cacheStore.getLookupShardMapHitCount());
}
项目:tddinjava_2017-08-14    文件:JavaRandomDieTest.java   
@Test
@Category(value=UnitTest.class)
public void testRollOfA3EasyMock() {
    Random mock = createMock(Random.class);

    // rehearse
    expect(mock.nextInt(6)).andReturn(2);

    // replay(EasyMock Only)
    replay(mock);

    // run test
    Die die = new JavaRandomDie(mock);
    Die copyDie = die.roll();
    assertThat(copyDie.getPips()).isEqualTo(3);

    // verify
    verify(mock);
}
项目:elastic-db-tools-for-java    文件:MultiShardQueryE2ETests.java   
/**
 * Close the connection to one of the shards behind MultiShardConnection's back. Verify that we reopen the connection with the built-in retry
 * policy.
 */
@Test
@Category(value = ExcludeFromGatedCheckin.class)
public final void testQueryShardsInvalidShardStateSync() throws Exception {
    // Get a shard and close it's connection
    List<Pair<ShardLocation, Connection>> shardConnections = shardConnection.getShardConnections();
    try {
        shardConnections.get(1).getRight().close();
        // Execute
        try (MultiShardStatement stmt = shardConnection.createCommand()) {
            stmt.setCommandText("SELECT dbNameField, Test_int_Field, Test_bigint_Field  FROM ConsistentShardedTable");

            try (MultiShardResultSet sdr = stmt.executeQuery()) {
                sdr.close();
            }
        }
    }
    catch (Exception ex) {
        log.info("Exception encountered: " + ex.getMessage());
        Assert.fail(ex.toString());
    }
}
项目:alfresco-repository    文件:ContentDataDAOTest.java   
@Category(PerformanceTests.class)
public void testCreateSpeedSingleTxn()
{
    RetryingTransactionCallback<List<Pair<Long, ContentData>>> writeCallback = new RetryingTransactionCallback<List<Pair<Long, ContentData>>>()
    {
        public List<Pair<Long, ContentData>> execute() throws Throwable
        {
            return speedTestWrite(getName(), 10000);
        }
    };
    final List<Pair<Long, ContentData>> pairs = txnHelper.doInTransaction(writeCallback, false, false);
    RetryingTransactionCallback<Void> readCallback = new RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Throwable
        {
            speedTestRead(getName(), pairs);
            return null;
        }
    };
    txnHelper.doInTransaction(readCallback, false, false);
}
项目:monarch    文件:Bug44418JUnitTest.java   
@Category(FlakyTest.class) // GEODE-1139: time sensitive, thread sleep, expiration
@Test
public void testPut() throws Exception {

  System.setProperty(LocalRegion.EXPIRY_MS_PROPERTY, "true");
  try {
    final Region r =
        this.cache.createRegionFactory(RegionShortcut.LOCAL).setStatisticsEnabled(true)
            .setCustomEntryTimeToLive(new CustomExpiryTestClass()).create("bug44418");

    r.put(TEST_KEY, "longExpire");
    // should take LONG_WAIT_MS to expire.

    // Now update it with a short time to live
    r.put(TEST_KEY, "quickExpire");

    if (!awaitExpiration(r, TEST_KEY)) {
      fail(SHORT_WAIT_MS + " ms expire did not happen after waiting " + TEST_WAIT_MS + " ms");
    }
  } finally {
    System.getProperties().remove(LocalRegion.EXPIRY_MS_PROPERTY);
  }
}
项目:elastic-db-tools-for-java    文件:ShardMapManagerUpgradeTests.java   
/**
 * Upgrade GSM.
 */
@Test
@Category(value = ExcludeFromGatedCheckin.class)
public void upgradeGsm() {
    // Get shard map manager
    ShardMapManager smm = ShardMapManagerFactory.getSqlShardMapManager(Globals.SHARD_MAP_MANAGER_CONN_STRING, ShardMapManagerLoadPolicy.Lazy);

    // Sanity check setup: version should be 1.0
    verifyGlobalStore(smm, new Version(1, 0));

    // Upgrade to version 1.0: no-op
    smm.upgradeGlobalStore(new Version(1, 0));
    verifyGlobalStore(smm, new Version(1, 0));

    // Upgrade to version 1.1
    smm.upgradeGlobalStore(new Version(1, 1));
    verifyGlobalStore(smm, new Version(1, 1));

    // Upgrade to version 1.2
    smm.upgradeGlobalStore(new Version(1, 2));
    verifyGlobalStore(smm, new Version(1, 2));

    // Upgrade to latest version
    smm.upgradeGlobalStore();
    verifyGlobalStore(smm, GlobalConstants.GsmVersionClient);
}
项目:SunmiAuto    文件:SunmiSettings.java   
@Category(CategorySettingsTests.class)
@Test
public void test001WiFi() {
    if("V1".equals(Build.MODEL) || "P1".equals(Build.MODEL)) {
        screenshotCap("setting_interface");
        UiObject2 wifiops = device.findObject(By.text("WLAN"));
        wifiops.clickAndWait(Until.newWindow(), LONG_WAIT);
        screenshotCap("wifi_interface");
        UiObject2 wifiButton = device.findObject(By.res("com.android.settings:id/switch_widget"));
        Assert.assertEquals("Wifi开关默认应该为打开状态", true, wifiButton.isChecked());
    }
}
项目:SunmiAuto    文件:SunmiSettings.java   
@Category(CategorySettingsTests.class)
@Test
public void test006CheckWLANStatus() {
    if("V1".equals(Build.MODEL) || "P1".equals(Build.MODEL)) {
        screenshotCap("setting_interface");
        UiObject2 wifiops = device.findObject(By.text("WLAN"));
        wifiops.clickAndWait(Until.newWindow(), LONG_WAIT);
        screenshotCap("wifi_interface");
        UiObject2 wifiButton = device.findObject(By.res("com.android.settings:id/switch_widget"));
        Assert.assertEquals("Wifi开关默认应该为打开状态", true, wifiButton.isChecked());
    }
}
项目:iothub-manager-java    文件:DevicesTest.java   
@Test(timeout = 10000)
@Category({IntegrationTest.class})
public void getAsyncFailureTest() throws Exception {
    try {
        deviceService.getAsync("IncorrectDeviceId").toCompletableFuture().get();
    } catch (Exception ex) {
        Assert.assertTrue(ex.getCause() instanceof ResourceNotFoundException);
    }
}
项目:SunmiAuto    文件:SunmiSettings.java   
@Category(CategorySettingsTests.class)
@Test
public void test009CheckBTRenamePASS() {
    if("V1".equals(Build.MODEL) || "P1".equals(Build.MODEL)) {
        screenshotCap("after_enter");
        UiObject2 WlanObj = device.findObject(By.text("蓝牙"));
        WlanObj.clickAndWait(Until.newWindow(), LONG_WAIT);
        sleep(SHORT_SLEEP);
        screenshotCap("after_click");
        UiObject2 moreOptBtn = device.findObject(By.desc("更多选项"));
        moreOptBtn.click();
        sleep(SHORT_SLEEP);
        UiObject2 renameObj = device.findObject(By.text("重命名此设备"));
        renameObj.clickAndWait(Until.newWindow(), LONG_WAIT);
        sleep(SHORT_SLEEP);
        UiObject2 nameObj = device.findObject(By.focused(true));
        nameObj.clear();
        nameObj.setText("TESTV1");
        UiObject2 renameBtn = device.findObject(By.text("重命名"));
        renameBtn.clickAndWait(Until.newWindow(), LONG_WAIT);
        sleep(SHORT_SLEEP);
        UiObject2 moreOptBtn1 = device.findObject(By.desc("更多选项"));
        moreOptBtn1.click();
        sleep(SHORT_SLEEP);
        UiObject2 renameObj1 = device.findObject(By.text("重命名此设备"));
        renameObj1.clickAndWait(Until.newWindow(), LONG_WAIT);
        sleep(SHORT_SLEEP);
        UiObject2 nameObj1 = device.findObject(By.focused(true));
        String BTName = nameObj1.getText();
        Assert.assertEquals("蓝牙改名失败", "TESTV1", BTName);
        nameObj1.clear();
        if("V1".equals(Build.MODEL)){
            nameObj1.setText(V1_BT_NAME);
        }else if("P1".equals(Build.MODEL)){
            nameObj1.setText(P1_BT_NAME);
        }
        UiObject2 renameBtn1 = device.findObject(By.text("重命名"));
        renameBtn1.clickAndWait(Until.newWindow(), LONG_WAIT);
    }
}
项目:SunmiAuto    文件:SunmiSettings.java   
@Category(CategorySettingsTests.class)
@Test
public void test010CheckDataUsage() {
    if("V1".equals(Build.MODEL) || "P1".equals(Build.MODEL)) {
        screenshotCap("after_enter");
        UiObject2 dataUsageObj = device.findObject(By.text("流量使用情况"));
        dataUsageObj.clickAndWait(Until.newWindow(), LONG_WAIT);
        UiObject2 gernalObj = device.findObject(By.selected(true).text("概览"));
        Assert.assertNotNull("未找到概览tab", gernalObj);
        UiObject2 wlanObj = device.findObject(By.text("WLAN").res("android:id/title"));
        Assert.assertNotNull("未找到WLANtab", wlanObj);
    }
}
项目:tddinjava_2017-08-14    文件:JavaRandomDieTest.java   
@Test
@Category(value=UnitTest.class)
public void testDefaultIs1WithConstructorWithRandom() {
    Random stub = new Random() {
        @Override
        public int nextInt() {
            return 4;
        }
    };

    Die die = new JavaRandomDie(stub);
    assertThat(die.getPips()).isEqualTo(1);
}
项目:elastic-db-tools-for-java    文件:ShardMapTests.java   
@Test
@Category(value = ExcludeFromGatedCheckin.class)
public void updateShardAbortGsm() {
    StubStoreOperationFactory stubStoreOperationFactory = new StubStoreOperationFactory();
    stubStoreOperationFactory.setCallBase(true);
    stubStoreOperationFactory.createUpdateShardOperation4Param = (smm,
            sm,
            so,
            sn) -> new NTimeFailingUpdateShardOperation(10, smm, sm, so, sn);

    ShardMapManager smm = new ShardMapManager(new SqlShardMapManagerCredentials(Globals.SHARD_MAP_MANAGER_CONN_STRING),
            new SqlStoreConnectionFactory(), stubStoreOperationFactory, new CacheStore(), ShardMapManagerLoadPolicy.Lazy,
            new RetryPolicy(1, Duration.ZERO, Duration.ZERO, Duration.ZERO), RetryBehavior.getDefaultRetryBehavior());
    ShardMap sm = smm.getShardMap(ShardMapTests.defaultShardMapName);
    assert sm != null;

    ShardLocation sl = new ShardLocation(Globals.TEST_CONN_SERVER_NAME, ShardMapTests.shardDbs[0]);

    Shard shardNew = sm.createShard(new ShardCreationInfo(sl, ShardStatus.Online));

    ShardUpdate su = new ShardUpdate();
    su.setStatus(ShardStatus.Offline);

    boolean storeOperationFailed = false;
    try {
        Shard shardUpdated = sm.updateShard(shardNew, su);
        assert shardNew != null;
    }
    catch (ShardManagementException sme) {
        assert ShardManagementErrorCategory.ShardMap == sme.getErrorCategory();
        assert ShardManagementErrorCode.StorageOperationFailure == sme.getErrorCode();
        storeOperationFailed = true;
    }

    assert storeOperationFailed;

    // verify that shard status is not changed.
    Shard shardValidate = sm.getShard(sl);
    assert shardNew.getStatus() == shardValidate.getStatus();
}
项目:monarch    文件:P2PAuthenticationDUnitTest.java   
/**
 * Authenticator is incorrect
 */
@Category(FlakyTest.class) // GEODE-1089: random port
@Test
public void testP2PAuthenticationWithInvalidAuthenticator() throws Exception {
  int locatorPort = getRandomAvailablePort(SOCKET);

  CredentialGenerator gen = new DummyCredentialGenerator();
  assertNotNull(gen.getAuthInit());
  assertNull(gen.getJavaProperties());

  Properties props = new Properties();
  props.setProperty(MCAST_PORT, "0");
  props.setProperty(LOCATORS, getIPLiteral() + "[" + locatorPort + "]");
  props.setProperty(SECURITY_PEER_AUTH_INIT, gen.getAuthInit());
  props.setProperty(SECURITY_PEER_AUTHENTICATOR, "xyz");

  startTheLocator(props, null, locatorPort);

  try {
    new SecurityTestUtils("tmp").createSystem(props, null);
    fail(
        "AuthenticationFailedException was expected as the Authenticator object passed is incorrect");

  } catch (GemFireSecurityException expected) {
    // success

  } finally {
    locatorVM.invoke(() -> stopLocator(locatorPort, ignoredExceptions));
  }
}
项目:alfresco-remote-api    文件:AbstractEnterpriseOpenCMIS11TCKTest.java   
@Test
@Category({LuceneTests.class, RedundantTests.class})
public void testCMISTCKQuery() throws Exception
{
    OverrideQueryTestGroup queryTestGroup = new OverrideQueryTestGroup();
    JUnitHelper.run(queryTestGroup);
}
项目:gretl    文件:Db2DbStepTest.java   
@Category(DbTest.class)
@Test
public void canWriteGeomFromWktTest() throws Exception {
    String schemaName = "GeomFromWktTest";

    Connection con = null;

    try{
        con = connectToPreparedPgDb(schemaName);
        preparePgGeomSourceSinkTables(schemaName, con);


        Db2DbStep step = new Db2DbStep();
        File queryFile = TestUtil.createFile(folder, 
                String.format("select ST_AsText(geom) as geom from %s.source", schemaName),
                "select.sql");

        Connector src = new Connector(TestUtil.PG_CONNECTION_URI, TestUtil.PG_READERUSR_USR, TestUtil.PG_READERUSR_PWD);
        Connector sink = new Connector(TestUtil.PG_CONNECTION_URI, TestUtil.PG_DMLUSR_USR, TestUtil.PG_DMLUSR_PWD);
        TransferSet tSet = new TransferSet(
                queryFile.getAbsolutePath(),
                schemaName + ".SINK",
                true,
                new String[]{"geom:wkt:2056"}
        );

        step.processAllTransferSets(src, sink, Arrays.asList(tSet));

        assertEqualGeomInSourceAndSink(con, schemaName);
    }
    finally {
        dropSchema(schemaName, con);

        if(con != null)
            con.close();
    }
}
项目:SunmiAuto    文件:SunmiAppStore_v3_3_15.java   
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test014Login(){
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
    mineEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("mineHome");
    UiObject2 userCenterEntrence = device.findObject(By.res("woyou.market:id/item_user_info"));
    userCenterEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("loginInterface");
    UiObject2 loginText = device.findObject(By.res("com.sunmi.usercenter:id/edit_login_username"));
    loginText.clear();
    loginText.setText(USERCENTER_ACCOUNT);
    UiObject2 pwdText = device.findObject(By.res("com.sunmi.usercenter:id/txt_password"));
    pwdText.clear();
    pwdText.setText(USERCENTER_PWD);
    TestUtils.screenshotCap("afterInputInfo");
    UiObject2 loginButton = device.findObject(By.res("com.sunmi.usercenter:id/btn_login"));
    loginButton.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("afterClickLogin");
    TestUtils.sleep(SHORT_SLEEP);
    String shopName = device.findObject(By.res("woyou.market:id/tv_shop_name")).getText();
    Assert.assertNotEquals("未登录",shopName);
    UiObject2 userCenterEntrence1 = device.findObject(By.res("woyou.market:id/item_user_info"));
    userCenterEntrence1.clickAndWait(Until.newWindow(),LONG_WAIT);
    UiObject2 currAccountObj = device.findObject(By.res("com.sunmi.usercenter:id/rel_now_account"));
    currAccountObj.clickAndWait(Until.newWindow(),LONG_WAIT);
    UiObject2 outAccountObj = device.findObject(By.res("com.sunmi.usercenter:id/btn_login_out"));
    outAccountObj.clickAndWait(Until.newWindow(),LONG_WAIT);
    UiObject2 pwdTextObj = device.findObject(By.res("com.sunmi.usercenter:id/edit"));
    pwdTextObj.clear();
    pwdTextObj.setText(USERCENTER_PWD);
    UiObject2 loginOutButton = device.findObject(By.res("com.sunmi.usercenter:id/right"));
    loginOutButton.clickAndWait(Until.newWindow(),LONG_WAIT);
}
项目:SunmiAuto    文件:SunmiAppStore_v3_3_15.java   
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test015BuiedApps(){
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
    mineEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
    UiObject2 userCenterEntrence = device.findObject(By.res("woyou.market:id/item_user_info"));
    userCenterEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
    UiObject2 loginText = device.findObject(By.res("com.sunmi.usercenter:id/edit_login_username"));
    loginText.clear();
    loginText.setText(USERCENTER_ACCOUNT);
    UiObject2 pwdText = device.findObject(By.res("com.sunmi.usercenter:id/txt_password"));
    pwdText.clear();
    pwdText.setText(USERCENTER_PWD);
    UiObject2 loginButton = device.findObject(By.res("com.sunmi.usercenter:id/btn_login"));
    loginButton.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("afterLoginUsercenterInterface");
    TestUtils.sleep(SHORT_SLEEP);
    UiObject2 buyOption = device.findObject(By.res("woyou.market:id/item_buy_app"));
    buyOption.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("buiedHisInterface");
    UiObject2 buyHistory = device.findObject(By.text("购买记录"));
    Assert.assertNotNull(buyHistory);
    device.pressBack();
    UiObject2 userCenterEntrence1 = device.findObject(By.res("woyou.market:id/item_user_info"));
    userCenterEntrence1.clickAndWait(Until.newWindow(),LONG_WAIT);
    UiObject2 currAccountObj = device.findObject(By.res("com.sunmi.usercenter:id/rel_now_account"));
    currAccountObj.clickAndWait(Until.newWindow(),LONG_WAIT);
    UiObject2 outAccountObj = device.findObject(By.res("com.sunmi.usercenter:id/btn_login_out"));
    outAccountObj.clickAndWait(Until.newWindow(),LONG_WAIT);
    UiObject2 pwdTextObj = device.findObject(By.res("com.sunmi.usercenter:id/edit"));
    pwdTextObj.clear();
    pwdTextObj.setText(USERCENTER_PWD);
    UiObject2 loginOutButton = device.findObject(By.res("com.sunmi.usercenter:id/right"));
    loginOutButton.clickAndWait(Until.newWindow(),LONG_WAIT);
}
项目:SunmiAuto    文件:SunmiAppStore_v3_3_15.java   
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test017InstallingApps(){
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
    mineEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("mineHome");
    UiObject2 installOption = device.findObject(By.res("woyou.market:id/item_install_app"));
    installOption.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("appInstallInterface");
    UiObject2 installHistory = device.findObject(By.text("安装列表"));
    Assert.assertNotNull(installHistory);
}
项目:SunmiAuto    文件:SunmiAppStore_v3_3_15.java   
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test019OpenSaveDataButton(){
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
    mineEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("mineHome");
    UiObject2 saveSwitch = device.findObject(By.res("woyou.market:id/switch_save_flow"));
    Assert.assertTrue("省流量开关默认应该打开,当前时关闭",saveSwitch.isCheckable());
}
项目:alfresco-remote-api    文件:TestPublicApiAtomPub10TCK.java   
@Test
@Category({LuceneTests.class, RedundantTests.class})
public void testCMISTCKQuery() throws Exception
{
    OverrideQueryTestGroup queryTestGroup = new OverrideQueryTestGroup();
    JUnitHelper.run(queryTestGroup);
}
项目:SunmiAuto    文件:SunmiAppStore_v3_3_15.java   
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test021CheckServiceProvider() throws UiObjectNotFoundException {
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
    mineEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("mineHome");
    UiScrollable mineScroll = new UiScrollable(new UiSelector().className("android.widget.ScrollView"));
    mineScroll.scrollTextIntoView("服务商");
    TestUtils.screenshotCap("ScrollToServicePro");
    UiObject2 serviceProObj = device.findObject(By.text("服务商"));
    Assert.assertNotNull("未找到服务商信息",serviceProObj);
}
项目:SunmiAuto    文件:SunmiAppStore_v3_3_15.java   
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test023CheckAppDetail() throws UiObjectNotFoundException {
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 hotObj = device.findObject(By.res("woyou.market:id/tv_hot_all").text("全部"));
    hotObj.clickAndWait(Until.newWindow(), LONG_WAIT);
    TestUtils.screenshotCap("hotAllInterface");
    UiScrollable hotAllScroll = new UiScrollable(new UiSelector().resourceId("woyou.market:id/list_view"));
    UiObject fullAppObj = hotAllScroll.getChild(new UiSelector().className("android.widget.FrameLayout"));
    String appName = fullAppObj.getChild(new UiSelector().resourceId("woyou.market:id/tv_name")).getText();
    fullAppObj.clickAndWaitForNewWindow(LONG_WAIT);
    TestUtils.screenshotCap("enterHotAppsFirstOne");
    UiObject2 nameObj = device.findObject(By.res("woyou.market:id/tv_name"));
    Assert.assertEquals("期望的名字是"+appName+",而实际是"+nameObj.getText(),appName,nameObj.getText());
}
项目:elastic-db-tools-for-java    文件:ShardMapTests.java   
/**
 * Remove a shard with shard version mismatch.
 */
@Test
@Category(value = ExcludeFromGatedCheckin.class)
public void deleteShardVersionMismatch() {
    ShardMapManager smm = ShardMapManagerFactory.getSqlShardMapManager(Globals.SHARD_MAP_MANAGER_CONN_STRING, ShardMapManagerLoadPolicy.Lazy);

    ShardMap sm = smm.getShardMap(ShardMapTests.defaultShardMapName);
    assertNotNull(sm);

    ShardLocation s1 = new ShardLocation(Globals.TEST_CONN_SERVER_NAME, Globals.SHARD_MAP_MANAGER_DATABASE_NAME);

    Shard shardNew = sm.createShard(s1);

    // Update shard to increment version

    ShardUpdate su = new ShardUpdate();
    su.setStatus(ShardStatus.Offline);

    sm.updateShard(shardNew, su);

    boolean removeFailed = false;

    try {
        sm.deleteShard(shardNew);
    }
    catch (ShardManagementException sme) {
        assertEquals(ShardManagementErrorCategory.ShardMap, sme.getErrorCategory());
        assertEquals(ShardManagementErrorCode.ShardVersionMismatch, sme.getErrorCode());
        removeFailed = true;
    }

    assertTrue(removeFailed);
}
项目:device-telemetry-java    文件:RuleApiModelTest.java   
@Test(timeout = 5000)
@Category({UnitTest.class})
public void createRuleApiModel() {
    // required values
    assertThat(ruleApiModel.getETag().isEmpty(), is(false));
    assertThat(ruleApiModel.getId().isEmpty(), is(false));
    assertThat(ruleApiModel.getDateCreated().isEmpty(), is(false));
    assertThat(ruleApiModel.getDateModified().isEmpty(), is(false));
}
项目:monarch    文件:MemoryThresholdsDUnitTest.java   
@Category(FlakyTest.class) // GEODE-987: random ports, failed to throw expected ResourceException,
                           // overly complex expected exception handling, memory and GC sensitive,
                           // expiration, waitForCriterion
@Test
public void testPR_RemotePutRejectionWithTx() throws Exception {
  prRemotePutRejection(false, false, true);
}
项目:tddinjava_2017-08-14    文件:JavaRandomDieTest.java   
@Test
@Category(value=UnitTest.class)
public void testRollOfTwiceUsingMockito() {
    Random mock = Mockito.mock(Random.class);

    // rehearse
    when(mock.nextInt(6)).thenReturn(2, 3);

    // run test
    Die die = new JavaRandomDie(mock);
    Die copyDie = die.roll().roll();
    assertThat(copyDie.getPips()).isEqualTo(4);
}
项目:pcs-storage-adapter-java    文件:ConfigTest.java   
@Test(timeout = 1000)
@Category({UnitTest.class})
public void providesWebServicePort() {
    Config config = new Config();
    assertThat(config.getPort(), not(0));
    assertNotNull(config.getServicesConfig().getContainerName());
    assertNotNull(config.getServicesConfig().getDocumentDBConnectionString());
}
项目:elastic-db-tools-for-java    文件:ShardMapTests.java   
/**
 * Update shard with version mismatch.
 */
@Test
@Category(value = ExcludeFromGatedCheckin.class)
public void updateShardVersionMismatch() {
    ShardMapManager smm = ShardMapManagerFactory.getSqlShardMapManager(Globals.SHARD_MAP_MANAGER_CONN_STRING, ShardMapManagerLoadPolicy.Lazy);

    ShardMap sm = smm.getShardMap(ShardMapTests.defaultShardMapName);
    assertNotNull(sm);

    ShardLocation s1 = new ShardLocation(Globals.TEST_CONN_SERVER_NAME, ShardMapTests.shardDbs[0]);

    Shard shardNew = sm.createShard(new ShardCreationInfo(s1, ShardStatus.Online));

    ShardUpdate su = new ShardUpdate();
    su.setStatus(ShardStatus.Offline);

    Shard shardUpdated = sm.updateShard(shardNew, su);
    assertNotNull(shardNew);
    assertNotNull(shardUpdated);

    boolean updateFailed = false;

    try {
        sm.updateShard(shardNew, su);
    }
    catch (ShardManagementException sme) {
        assertEquals(ShardManagementErrorCategory.ShardMap, sme.getErrorCategory());
        assertEquals(ShardManagementErrorCode.ShardVersionMismatch, sme.getErrorCode());
        updateFailed = true;
    }
    assertTrue(updateFailed);
}
项目:monarch    文件:DLockManagementDUnitTest.java   
/**
 * Distributed Lock Service test
 * 
 * @throws Exception
 */
@Category(FlakyTest.class) // GEODE-553: waitForCriterion, eats exceptions, HeadlessGFSH
@Test
public void testDLockAggregate() throws Throwable {
  initManagement(false);
  VM[] managedNodes = new VM[getManagedNodeList().size()];
  VM managingNode = getManagingNode();

  getManagedNodeList().toArray(managedNodes);

  createGrantorLockService(managedNodes[0]);

  createLockService(managedNodes[1]);

  createLockService(managedNodes[2]);

  checkAggregate(managingNode, 3);
  DistributedMember member = getMember(managedNodes[2]);
  checkNavigation(managingNode, member);

  createLockService(managingNode);
  checkAggregate(managingNode, 4);


  for (VM vm : getManagedNodeList()) {
    closeLockService(vm);
  }
  ensureProxyCleanup(managingNode);
  checkAggregate(managingNode, 1);
  closeLockService(managingNode);
  checkAggregate(managingNode, 0);

}