本文整理匯總了Java中org.junit.Assume.assumeThat方法的典型用法代碼示例。如果您正苦於以下問題:Java Assume.assumeThat方法的具體用法?Java Assume.assumeThat怎麽用?Java Assume.assumeThat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.junit.Assume
的用法示例。
在下文中一共展示了Assume.assumeThat方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: test_shouldListModules
import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void test_shouldListModules() {
connect();
createApplication();
try {
CommandResult result = addModule("mysql-5-5");
Assume.assumeThat(result, isSuccessfulCommand());
result = displayModules();
assertThat(result, isSuccessfulCommand());
assertThat(result.getResult().toString(), containsString("1"));
assertThat(result.getResult().toString(), containsString("found"));
} finally {
removeApplication();
disconnect();
}
}
示例2: createShortCircuitConf
import org.junit.Assume; //導入方法依賴的package包/類
private static Configuration createShortCircuitConf(String testName,
TemporarySocketDirectory sockDir) {
Configuration conf = new Configuration();
conf.set(DFS_CLIENT_CONTEXT, testName);
conf.setLong(DFS_BLOCK_SIZE_KEY, 4096);
conf.set(DFS_DOMAIN_SOCKET_PATH_KEY, new File(sockDir.getDir(),
testName).getAbsolutePath());
conf.setBoolean(DFS_CLIENT_READ_SHORTCIRCUIT_KEY, true);
conf.setBoolean(DFS_CLIENT_READ_SHORTCIRCUIT_SKIP_CHECKSUM_KEY,
false);
conf.setBoolean(DFS_CLIENT_DOMAIN_SOCKET_DATA_TRAFFIC, false);
DFSInputStream.tcpReadsDisabledForTesting = true;
DomainSocket.disableBindPathValidation();
Assume.assumeThat(DomainSocket.getLoadingFailureReason(), equalTo(null));
return conf;
}
示例3: testUpdate
import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testUpdate() {
Assume.assumeThat(before, customMatcher);
Assume.assumeThat(after, customMatcher);
Collection<Diff> diffs = diffCalculator.apply(before, after, null);
Assert.assertNotNull("Response should be non-null", diffs);
Assert.assertFalse("Response should not be empty", diffs.isEmpty());
Assert.assertEquals("It should be updated", ChangeType.UPDATED, diffs.iterator().next().getChangeType());
}
示例4: checkServerRunning
import org.junit.Assume; //導入方法依賴的package包/類
private void checkServerRunning() {
try (CloseableHttpClient client = HttpClientBuilder.create().build()) {
CloseableHttpResponse response = client.execute(new HttpGet(baseUrl + PING_PATH));
if (response != null && response.getStatusLine() != null) {
Assume.assumeThat(response.getStatusLine().getStatusCode(), Is.is(200));
}
} catch (IOException e) {
throw new AssumptionViolatedException("SolrServer does not seem to be running", e);
}
}
示例5: testShortCircuitReadAfterEviction
import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testShortCircuitReadAfterEviction()
throws IOException, InterruptedException {
Assume.assumeThat(DomainSocket.getLoadingFailureReason(), equalTo(null));
startUpCluster(true, 1 + EVICTION_LOW_WATERMARK, true, false);
doShortCircuitReadAfterEvictionTest();
}
示例6: testShortCircuitReadBlockFileCorruption
import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testShortCircuitReadBlockFileCorruption() throws IOException,
InterruptedException {
Assume.assumeThat(DomainSocket.getLoadingFailureReason(), equalTo(null));
startUpCluster(true, 1 + EVICTION_LOW_WATERMARK, true, false);
doShortCircuitReadBlockFileCorruptionTest();
}
示例7: testShortCircuitReadMetaFileCorruption
import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testShortCircuitReadMetaFileCorruption() throws IOException,
InterruptedException {
Assume.assumeThat(DomainSocket.getLoadingFailureReason(), equalTo(null));
startUpCluster(true, 1 + EVICTION_LOW_WATERMARK, true, false);
doShortCircuitReadMetaFileCorruptionTest();
}
示例8: before
import org.junit.Assume; //導入方法依賴的package包/類
@Before
public void before() {
Assume.assumeThat(DomainSocket.getLoadingFailureReason(), equalTo(null));
}
示例9: before
import org.junit.Assume; //導入方法依賴的package包/類
@Before
public void before() {
Assume.assumeThat(NativeCodeLoader.isNativeCodeLoaded() && !Path.WINDOWS,
equalTo(true));
Assume.assumeThat(DomainSocket.getLoadingFailureReason(), equalTo(null));
}
示例10: init
import org.junit.Assume; //導入方法依賴的package包/類
@Before
public void init() {
DomainSocket.disableBindPathValidation();
Assume.assumeThat(DomainSocket.getLoadingFailureReason(), equalTo(null));
}
示例11: testAuthenticatedClientsAllowed
import org.junit.Assume; //導入方法依賴的package包/類
@Test public void testAuthenticatedClientsAllowed() throws Exception {
Assume.assumeThat("Test disabled on Windows", File.separatorChar, is('/'));
// Create the subject for the client
final Subject clientSubject = AvaticaJaasKrbUtil.loginUsingKeytab(
SpnegoTestUtil.CLIENT_PRINCIPAL, clientKeytab);
final Set<Principal> clientPrincipals = clientSubject.getPrincipals();
// Make sure the subject has a principal
assertFalse(clientPrincipals.isEmpty());
// Get a TGT for the subject (might have many, different encryption types). The first should
// be the default encryption type.
Set<KerberosTicket> privateCredentials =
clientSubject.getPrivateCredentials(KerberosTicket.class);
assertFalse(privateCredentials.isEmpty());
KerberosTicket tgt = privateCredentials.iterator().next();
assertNotNull(tgt);
LOG.info("Using TGT with etype: {}", tgt.getSessionKey().getAlgorithm());
// The name of the principal
final String principalName = clientPrincipals.iterator().next().getName();
// Run this code, logged in as the subject (the client)
byte[] response = Subject.doAs(clientSubject, new PrivilegedExceptionAction<byte[]>() {
@Override public byte[] run() throws Exception {
// Logs in with Kerberos via GSS
GSSManager gssManager = GSSManager.getInstance();
Oid oid = new Oid(SpnegoTestUtil.JGSS_KERBEROS_TICKET_OID);
GSSName gssClient = gssManager.createName(principalName, GSSName.NT_USER_NAME);
GSSCredential credential = gssManager.createCredential(gssClient,
GSSCredential.DEFAULT_LIFETIME, oid, GSSCredential.INITIATE_ONLY);
// Passes the GSSCredential into the HTTP client implementation
final AvaticaCommonsHttpClientSpnegoImpl httpClient =
new AvaticaCommonsHttpClientSpnegoImpl(httpServerUrl, credential);
return httpClient.send(new byte[0]);
}
});
// We should get a response which is "OK" with our client's name
assertNotNull(response);
assertEquals("OK " + SpnegoTestUtil.CLIENT_PRINCIPAL,
new String(response, StandardCharsets.UTF_8));
}