/** * Test timeout behavior when resolution is modified. */ public void testModifyResolution() { try { // increase and test long resolution = 20 * TimerThread.DEFAULT_RESOLUTION; //400 counterThread.setResolution(resolution); assertEquals(resolution, counterThread.getResolution()); doTestTimeout(false,true); // decrease much and test resolution = 5; counterThread.setResolution(resolution); assertEquals(resolution, counterThread.getResolution()); doTestTimeout(false,true); // return to default and test resolution = TimerThread.DEFAULT_RESOLUTION; counterThread.setResolution(resolution); assertEquals(resolution, counterThread.getResolution()); doTestTimeout(false,true); } finally { counterThread.setResolution(TimerThread.DEFAULT_RESOLUTION); } }
@Override public boolean reject(Thread t) { /* * IMPORTANT! IMPORTANT! * * Any threads added here should have ABSOLUTELY NO SIDE EFFECTS * (should be stateless). This includes no references to cores or other * test-dependent information. */ String threadName = t.getName(); if (threadName.equals(TimerThread.THREAD_NAME)) { return true; } if (threadName.startsWith("facetExecutor-") || threadName.startsWith("cmdDistribExecutor-") || threadName.startsWith("httpShardExecutor-")) { return true; } // This is a bug in ZooKeeper where they call System.exit(11) when // this thread receives an interrupt signal. if (threadName.startsWith("SyncThread")) { return true; } // THESE ARE LIKELY BUGS - these threads should be closed! if (threadName.startsWith("Overseer-") || threadName.startsWith("aliveCheckExecutor-") || threadName.startsWith("concurrentUpdateScheduler-")) { return true; } return false; }
/** * initializes searcher with a document set */ @Override public void setUp() throws Exception { super.setUp(); counter = Counter.newCounter(true); counterThread = new TimerThread(counter); counterThread.start(); final String docText[] = { "docThatNeverMatchesSoWeCanRequireLastDocCollectedToBeGreaterThanZero", "one blah three", "one foo three multiOne", "one foobar three multiThree", "blueberry pancakes", "blueberry pie", "blueberry strudel", "blueberry pizza", }; directory = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), directory, newIndexWriterConfig(new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy())); for (int i=0; i<N_DOCS; i++) { add(docText[i%docText.length], iw); } reader = iw.getReader(); iw.close(); searcher = newSearcher(reader); BooleanQuery booleanQuery = new BooleanQuery(); booleanQuery.add(new TermQuery(new Term(FIELD_NAME, "one")), BooleanClause.Occur.SHOULD); // start from 1, so that the 0th doc never matches for (int i = 1; i < docText.length; i++) { String[] docTextParts = docText[i].split("\\s+"); for (String docTextPart : docTextParts) { // large query so that search will be longer booleanQuery.add(new TermQuery(new Term(FIELD_NAME, docTextPart)), BooleanClause.Occur.SHOULD); } } query = booleanQuery; // warm the searcher searcher.search(query, null, 1000); }
/** * initializes searcher with a document set */ @Override public void setUp() throws Exception { super.setUp(); counter = Counter.newCounter(true); counterThread = new TimerThread(counter); counterThread.start(); final String docText[] = { "docThatNeverMatchesSoWeCanRequireLastDocCollectedToBeGreaterThanZero", "one blah three", "one foo three multiOne", "one foobar three multiThree", "blueberry pancakes", "blueberry pie", "blueberry strudel", "blueberry pizza", }; directory = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy())); for (int i=0; i<N_DOCS; i++) { add(docText[i%docText.length], iw); } reader = iw.getReader(); iw.close(); searcher = newSearcher(reader); BooleanQuery booleanQuery = new BooleanQuery(); booleanQuery.add(new TermQuery(new Term(FIELD_NAME, "one")), BooleanClause.Occur.SHOULD); // start from 1, so that the 0th doc never matches for (int i = 1; i < docText.length; i++) { String[] docTextParts = docText[i].split("\\s+"); for (String docTextPart : docTextParts) { // large query so that search will be longer booleanQuery.add(new TermQuery(new Term(FIELD_NAME, docTextPart)), BooleanClause.Occur.SHOULD); } } query = booleanQuery; // warm the searcher searcher.search(query, null, 1000); }