private int publish(int count) { int size = 0; for (int i = 0; i < count; i++) { String msg = LOG_MESSAGE + i; host.log("%s", msg); size += msg.length() + 1; } return size; }
private void logServiceStats(VerificationHost h) { try { this.host.logServiceStats(UriUtils.buildUri(h, LuceneDocumentIndexService.SELF_LINK), this.testResults); } catch (Throwable e) { this.host.log("Error logging stats: %s", e.toString()); } }
public void logMemoryInfo() { log("Memory free:%d, available:%s, total:%s", Runtime.getRuntime().freeMemory(), Runtime.getRuntime().totalMemory(), Runtime.getRuntime().maxMemory()); }
void prePopulateIndexWithServiceDocuments(URI factoryUri) throws Throwable { if (this.documentCountAtStart == 0) { return; } this.host.log("Pre populating index with %d documents on %s", this.documentCountAtStart, factoryUri); long serviceCountCached = this.serviceCount; this.serviceCount = this.documentCountAtStart; doThroughputPostWithNoQueryResults(false, factoryUri); this.serviceCount = serviceCountCached; }
@After public void after() throws Throwable { try { host.tearDown(); } catch (CancellationException e) { host.log(Level.FINE, e.getClass().getName()); } host = null; }
public void logNodeProcessLogs(Set<URI> keySet, String logSuffix) { List<URI> logServices = new ArrayList<>(); for (URI host : keySet) { logServices.add(UriUtils.extendUri(host, logSuffix)); } Map<URI, LogServiceState> states = this.getServiceState(null, LogServiceState.class, logServices); for (Entry<URI, LogServiceState> entry : states.entrySet()) { log("Process log for node %s\n\n%s", entry.getKey(), Utils.toJsonHtml(entry.getValue())); } }
public void logNodeManagementState(Set<URI> keySet) { List<URI> services = new ArrayList<>(); for (URI host : keySet) { services.add(UriUtils.extendUri(host, ServiceUriPaths.CORE_MANAGEMENT)); } Map<URI, ServiceHostState> states = this.getServiceState(null, ServiceHostState.class, services); for (Entry<URI, ServiceHostState> entry : states.entrySet()) { log("Management state for node %s\n\n%s", entry.getKey(), Utils.toJsonHtml(entry.getValue())); } }
@Test public void testNoAuthenticationService() throws Throwable { VerificationHost host = createAndStartHost(true, false, null); host.log("Testing no authenticationService"); // Check if the BasicAuthenticationService is set as authenticationService assertEquals(BasicAuthenticationService.SELF_LINK, host.getAuthenticationServiceUri().getPath()); host.log("Expected behavior for no authenticationService"); }
@AfterClass public static void tearDown() { HOST.log("final teardown"); HOST.tearDown(); }
@After public void tearDownMultiHost() { this.host.log("Starting multi-host teardown"); if (this.multiHostTest) { this.host.tearDownInProcessPeers(); this.defaultHost = this.host; this.multiHostTest = false; } }
@AfterClass public static void tearDown() { HOST.log("final teardown"); HOST.tearDown(); }
@After public void cleanUp() { this.host.log("cleanup"); if (ENABLE_AUTH) { this.host.resetAuthorizationContext(); } }
private void createLogStates(PodState podState) throws Throwable { for (int i = 0; i < podState.pod.spec.containers.size(); i++) { LogServiceState logState = new LogServiceState(); logState.logs = ("test-log-" + i).getBytes(); logState.documentSelfLink = UriUtils.getLastPathSegment(podState.documentSelfLink) + "-" + podState.pod.spec .containers.get(i).name; logState = doPost(logState, LogService.FACTORY_LINK); assertNotNull(logState); host.log("Created log state: %s", logState.documentSelfLink); } }
private void verifyDocumentExists(String documentLink) throws Throwable { ServiceDocument document = getDocumentNoWait(ServiceDocument.class, documentLink); try { assertNotNull(String.format("Expected document [%s] to exist.", documentLink), document); } catch (AssertionError e) { host.log(Level.SEVERE, Utils.toString(e)); throw e; } }
public void stopHostAndPreserveState(ServiceHost host) { log("Stopping host %s", host.getUri()); // Do not delete the temporary directory with the lucene index. Notice that // we do not call host.tearDown(), which will delete disk state, we simply // stop the host and remove it from the peer node tracking tables host.stop(); this.peerHostIdToNodeState.remove(host.getId()); this.peerNodeGroups.remove(host.getUri()); this.localPeerHosts.remove(host.getUri()); }
public void stopHostAndPreserveState(ServiceHost host) { log("Stopping host %s", host.getUri()); // Do not delete the temporary directory with the lucene index. Notice that // we do not call host.tearDown(), which will delete disk state, we simply // stop the host and remove it from the peer node tracking tables host.stop(); this.peerHostIdToNodeState.remove(host.getId()); this.peerNodeGroups.remove(host.getUri()); this.localPeerHosts.remove(host.getUri()); }
public void stopHost(VerificationHost host) { log("Stopping host %s (%s)", host.getUri(), host.getId()); host.tearDown(); this.peerHostIdToNodeState.remove(host.getId()); this.peerNodeGroups.remove(host.getUri()); this.localPeerHosts.remove(host.getUri()); }
@Before public void setup() { URI sandbox = this.host.getStorageSandbox(); this.host.log("Sandbox in %s", sandbox); DirectoryContentService dirService = new DirectoryContentService(new File(sandbox).toPath()); this.host.startService(Operation.createPost(UriUtils.buildUri(this.host, SELF_LINK)), dirService); this.host.waitForServiceAvailable(SELF_LINK); }
@Before public void setup() { URI sandbox = this.host.getStorageSandbox(); this.host.log("Sandbox in %s", sandbox); DirectoryContentService dirService = new DirectoryContentService(new File(sandbox).toPath()); this.host.startService(Operation.createPost(UriUtils.buildUri(this.host, SELF_LINK)), dirService); this.host.waitForServiceAvailable(SELF_LINK); }
@Test public void replicationWithQuorumAfterAbruptNodeStopMultiLocation() throws Throwable { for (int i = 0; i < this.iterationCount; i++) { this.tearDown(); this.setUp(); doReplicationWithQuorumAfterAbruptNodeStopMultiLocation(); this.host.log("Done with iteration %d", i); } }