org.testng.ITestContext Java Examples

The following examples show how to use org.testng.ITestContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Util.java    From cloudbreak with Apache License 2.0 7 votes vote down vote up
public static Measure collectMeasurements(ITestContext iTestContext) {
    if (iTestContext == null) {
        throw new IllegalArgumentException("No testng testcontext is given.");
    }
    IResultMap failed = iTestContext.getFailedTests();
    IResultMap success = iTestContext.getPassedTests();
    MeasureAll allMeasurement = new MeasureAll();
    failed.getAllResults().stream().forEach(
            getiTestResultConsumer(allMeasurement)
    );
    success.getAllResults().stream().forEach(
            getiTestResultConsumer(allMeasurement)
    );

    return allMeasurement;
}
 
Example #2
Source File: QAFTestNGListener.java    From qaf with MIT License 7 votes vote down vote up
protected void setSkip(ITestResult tr, ITestContext context) {

		if (getBundle().getInt("testng.version", 6) > 5) {

			// Fix for testNG 6
			if ((null != context.getFailedTests())) {
				if (((null != context.getFailedTests().getResults(tr.getMethod())))
						&& (context.getFailedTests().getResults(tr.getMethod())
								.size() > 1)) {
					context.getFailedTests().getResults(tr.getMethod()).remove(tr);
				} else {
					context.getFailedTests().removeResult(tr.getMethod());
				}
			}
			tr.setStatus(ITestResult.SKIP);
			if (null != context.getSkippedTests()) {
				context.getSkippedTests().addResult(tr, tr.getMethod());
			}
		} else {
			tr.setStatus(ITestResult.SKIP);
		}
	}
 
Example #3
Source File: AtsTestngListener.java    From ats-framework with Apache License 2.0 6 votes vote down vote up
private boolean configurationError( ITestContext context ) {

        // check if this is a configuration issue
        List<ITestResult> failedConfigurations = Arrays.asList(context.getFailedConfigurations()
                                                                      .getAllResults()
                                                                      .toArray(
                                                                              new ITestResult[context.getFailedConfigurations()
                                                                                                     .getAllResults()
                                                                                                     .size()]));
        for (ITestResult failedResult : failedConfigurations) {
            if (failedResult.getThrowable() != null) {
                logger.fatal("Configuration failed!", failedResult.getThrowable());
                return true;
            }
        }

        return false;
    }
 
Example #4
Source File: BaseTest.java    From SCIM-Client with Apache License 2.0 6 votes vote down vote up
@BeforeSuite
public void initTestSuite(ITestContext context) throws Exception {

    SecurityProviderUtility.installBCProvider();
    logger.info("Invoked initTestSuite of '{}'", context.getCurrentXmlTest().getName());

    //Properties with the file: preffix will point to real .json files stored under src/test/resources folder
    String properties = context.getCurrentXmlTest().getParameter("file");
    Properties prop = new Properties();
    prop.load(Files.newBufferedReader(Paths.get(properties), DEFAULT_CHARSET));     //do not bother much about IO issues here

    Map<String, String> parameters = new Hashtable<>();
    //do not bother about empty keys... but
    //If a value is found null, this will throw a NPE since we are using a Hashtable
    prop.forEach((Object key, Object value) -> parameters.put(key.toString(), decodeFileValue(value.toString())));
    // Override test parameters
    context.getSuite().getXmlSuite().setParameters(parameters);

    if (client==null) {
        setupClient(context.getSuite().getXmlSuite().getParameters());
        mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    }

}
 
Example #5
Source File: CustomisedListener.java    From tutorials with MIT License 6 votes vote down vote up
@Override
public void onFinish(ITestContext context) {
    LOGGER.info("PASSED TEST CASES");
    context.getPassedTests()
        .getAllResults()
        .forEach(result -> {
            LOGGER.info(result.getName());
        });
    LOGGER.info("FAILED TEST CASES");
    context.getFailedTests()
        .getAllResults()
        .forEach(result -> {
            LOGGER.info(result.getName());
        });
    LOGGER.info("Test completed on: " + context.getEndDate()
        .toString());
}
 
Example #6
Source File: EverrestJetty.java    From everrest with Eclipse Public License 2.0 6 votes vote down vote up
public void onStart(ITestContext context) {

        ITestNGMethod[] allTestMethods = context.getAllTestMethods();
        if (allTestMethods == null) {
            return;
        }
        if (httpServer == null && hasEverrestJettyListenerTestHierarchy(allTestMethods)) {
            httpServer = new JettyHttpServer();

            context.setAttribute(JETTY_PORT, httpServer.getPort());
            context.setAttribute(JETTY_SERVER, httpServer);

            try {
                httpServer.start();
                httpServer.resetFactories();
                httpServer.resetFilter();
                RestAssured.port = httpServer.getPort();
                RestAssured.basePath = JettyHttpServer.UNSECURE_REST;
            } catch (Exception e) {
                LOG.error(e.getLocalizedMessage(), e);
                throw new RuntimeException(e.getLocalizedMessage(), e);
            }
        }
    }
 
Example #7
Source File: TestReadPath.java    From phoenix-omid with Apache License 2.0 6 votes vote down vote up
@Test(timeOut = 10_000)
public void testReadInterleaved(ITestContext context) throws Exception {
    TransactionManager tm = newTransactionManager(context);
    TTable table = new TTable(connection, TEST_TABLE);

    // Put some data on the DB
    Transaction t1 = tm.begin();
    Transaction t2 = tm.begin();

    Put put = new Put(row);
    put.addColumn(family, col, data);
    table.put(t1, put);
    tm.commit(t1);

    Get get = new Get(row);
    Result result = table.get(t2, get);
    assertFalse(result.containsColumn(family, col), "Should be unable to read column");
}
 
Example #8
Source File: JUnitXMLReporter.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
 * Invoked after the test class is instantiated and before any configuration method is called.
 */
public void onStart(ITestContext context) {
    System.out.println("Changing System.out...");
    while (System.out instanceof SysOutPrintStream) {
        System.setOut(((SysOutPrintStream) System.out).getOriginalSysOut());
    }
    while (System.err instanceof SysOutPrintStream) {
        System.setErr(((SysOutPrintStream) System.err).getOriginalSysOut());
    }
    old_stdout = System.out;
    old_stderr = System.err;
    unsolicitedOut = new ByteArrayOutputStream();
    unsolicitedErr = new ByteArrayOutputStream();
    suffix = System.getProperty(SUFFIX);
    if (suffix != null)
        suffix = suffix.trim();
    output_dir = context.getOutputDirectory(); // + File.separator + context.getName() + suffix + ".xml";

    System.setOut(new SysOutPrintStream(new JUnitXMLReporterOutputStream(this, 1), old_stdout));

    System.setErr(new SysOutPrintStream(new JUnitXMLReporterOutputStream(this, 2), old_stderr));
}
 
Example #9
Source File: AllureTestListener.java    From allure1 with Apache License 2.0 6 votes vote down vote up
private void addPendingMethods(ITestContext iTestContext) {
    for (ITestNGMethod method : iTestContext.getExcludedMethods()) {
        if (method.isTest() && !method.getEnabled() && isInActiveGroup(method, iTestContext)) {
            Description description = new Description().withValue(method.getDescription());
            String suiteUid = getSuiteUid(iTestContext);
            TestCaseStartedEvent event = new TestCaseStartedEvent(suiteUid, method.getMethodName());
            if (description.getValue() != null) {
                event.setDescription(description);
            }
            Annotation[] annotations = method.getConstructorOrMethod().getMethod().getAnnotations();
            AnnotationManager am = new AnnotationManager(annotations);
            am.setDefaults(method.getInstance().getClass().getAnnotations());
            am.update(event);
            getLifecycle().fire(event);
            getLifecycle().fire(new TestCasePendingEvent());
            fireFinishTest();
        }
    }
}
 
Example #10
Source File: ControllerMaskingListener.java    From stevia with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void beforeInvocation(IInvokedMethod method, ITestResult testResult, ITestContext context) {
	int failed = findFailed(context);
	if (failed > 0) {
		LOG.error("Masking will not proceed. {} Configurations have failed",failed);
		return;
	}
	
	Method rmethod = method.getTestMethod().getConstructorOrMethod().getMethod();
	if (rmethod.getAnnotation(Test.class) != null || 
		rmethod.getAnnotation(BeforeClass.class) != null || 
		rmethod.getAnnotation(BeforeTest.class) != null) {
		if (rmethod.getAnnotation(RunsWithController.class) != null || 
			rmethod.getDeclaringClass().getAnnotation(RunsWithController.class) != null) {
			LOG.warn("Method or Class of {} asks Controller to be masked", rmethod.getName());
			AnnotationsHelper p = SteviaContext.getSpringContext().getBean(AnnotationsHelper.class);
			try {
				p.maskExistingController(rmethod);
				masked = true;
			} catch (Throwable e) {
				throw new IllegalStateException("failed to replace controller",e);
			}
		}
	}
}
 
Example #11
Source File: TestTransactionConflict.java    From phoenix-omid with Apache License 2.0 6 votes vote down vote up
@Test(timeOut = 10_000)
public void testMultipleCellChangesOnSameRow(ITestContext context) throws Exception {
    TransactionManager tm = newTransactionManager(context);
    TTable tt = new TTable(connection, TEST_TABLE);

    Transaction t1 = tm.begin();
    Transaction t2 = tm.begin();
    LOG.info("Transactions created " + t1 + " " + t2);

    byte[] row = Bytes.toBytes("row");
    byte[] fam = Bytes.toBytes(TEST_FAMILY);
    byte[] col1 = Bytes.toBytes("testdata1");
    byte[] col2 = Bytes.toBytes("testdata2");
    byte[] data = Bytes.toBytes("testWrite-1");

    Put p2 = new Put(row);
    p2.addColumn(fam, col1, data);
    tt.put(t2, p2);
    tm.commit(t2);

    Put p1 = new Put(row);
    p1.addColumn(fam, col2, data);
    tt.put(t1, p1);
    tm.commit(t1);
}
 
Example #12
Source File: TestMarkPutAsCommitted.java    From phoenix-omid with Apache License 2.0 6 votes vote down vote up
@Test(timeOut = 60_000)
public void testShadowCellsExistanceInAutocommit(ITestContext context) throws Exception {

    TransactionManager tm = newTransactionManager(context);

    TTable table = new TTable(connection, TEST_TABLE);

    HBaseTransaction t1 = (HBaseTransaction) tm.begin();

    // Test shadow cells are created properly
    Put put = new Put(row);
    put.addColumn(family, qualifier, data1);
    
    put = TTable.markPutAsCommitted(put, t1.getWriteTimestamp(), t1.getWriteTimestamp());
  
    table.getHTable().put(put);

    // After markPutAsCommitted test that both cell and shadow cell are there
    assertTrue(hasCell(row, family, qualifier, t1.getStartTimestamp(), new TTableCellGetterAdapter(table)),
            "Cell should be there");
    assertTrue(hasShadowCell(row, family, qualifier, t1.getStartTimestamp(), new TTableCellGetterAdapter(table)),
            "Shadow cell should be there");
}
 
Example #13
Source File: PowerEmailableReporter.java    From WebAndAppUITesting with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get All tests id by class + method + parameters hash code.
 * 
 * @param context
 * @param suite
 */
private void getAllTestIds(ITestContext context, ISuite suite) {
	IResultMap passTests = context.getPassedTests();
	IResultMap failTests = context.getFailedTests();
	List<IInvokedMethod> invokedMethods = suite.getAllInvokedMethods();
	for (IInvokedMethod im : invokedMethods) {
		if (passTests.getAllMethods().contains(im.getTestMethod())
				|| failTests.getAllMethods().contains(im.getTestMethod())) {
			int testId = getId(im.getTestResult());
			// m_out.println("ALLtestid=" + testId);
			allRunTestIds.add(testId);
		}
	}
}
 
Example #14
Source File: JUnitXMLReporter.java    From jgroups-raft with Apache License 2.0 5 votes vote down vote up
/** Invoked after all test classes in this test have been run */
public void onFinish(ITestContext context) {
    try {
        tests.values().forEach(Util::close);
        tests.clear();
        generateReports();
    }
    catch(IOException e) {
        error(e.toString());
    }
    finally {
        System.setOut(old_stdout);
        System.setErr(old_stderr);
    }
}
 
Example #15
Source File: CdiContainerLifecycle.java    From incubator-batchee with Apache License 2.0 5 votes vote down vote up
@Override
public void onFinish(final ITestContext iTestContext) {
    try {
        container.shutdown();
    } catch (final Exception e) {
        // no-op
    }
}
 
Example #16
Source File: ReporterUtil.java    From qaf with MIT License 5 votes vote down vote up
private static int getPassCnt(ITestContext context) {
	if ((context != null) && (context.getPassedTests() != null)) {
		if (context.getPassedTests().getAllResults() != null) {
			return context.getPassedTests().getAllResults().size();
		}
		return context.getPassedTests().size();
	}
	return 0;
}
 
Example #17
Source File: AllureTestListener.java    From allure1 with Apache License 2.0 5 votes vote down vote up
/**
 * Package private. Used in unit test.
 *
 * @return UID for the current suite
 */
String getSuiteUid(ITestContext iTestContext) {
    String uid;
    if (iTestContext.getAttribute(SUITE_UID) != null) {
        uid = (String) iTestContext.getAttribute(SUITE_UID);
    } else {
        uid = UUID.randomUUID().toString();
        iTestContext.setAttribute(SUITE_UID, uid);
    }
    return uid;
}
 
Example #18
Source File: CustomDataProvider.java    From qaf with MIT License 5 votes vote down vote up
@DataProvider(name="dp-with-testngmethod-contex")
public Object[][] dataProviderForBDD(ITestNGMethod method, ITestContext contex){
	Map<Object, Object> m = Maps.newHashMap();
	m.put("method", method.getMethodName());
	m.put("contex", contex.getName());
	return new Object[][]{{m}};
}
 
Example #19
Source File: BrowsersDataProvider.java    From bdt with Apache License 2.0 5 votes vote down vote up
/**
 * Get the browsers available in a selenium grid.
 *
 * @param context context
 * @param testConstructor testConstructor
 * @return an iterator
 * @throws Exception exception
 */
@DataProvider(parallel = true)
public static Iterator<String[]> availableBrowsers(ITestContext context, Constructor<?> testConstructor)
        throws Exception {

    Map<String, String> map = new HashMap<String, String>();
    List<String> browsers = gridBrowsers(map);

    return buildIterator(browsers);
}
 
Example #20
Source File: AbstractTest.java    From carina with Apache License 2.0 5 votes vote down vote up
@DataProvider(name = "SingleDataProvider")
public Object[][] createDataSingleThread(final ITestNGMethod testMethod,
        ITestContext context) {
    Annotation[] annotations = testMethod.getConstructorOrMethod().getMethod().getDeclaredAnnotations();
    Object[][] objects = DataProviderFactory.getDataProvider(annotations, context, testMethod);
    return objects;
}
 
Example #21
Source File: ReporterUtil.java    From qaf with MIT License 5 votes vote down vote up
private static int getFailCnt(ITestContext context) {
	if ((context != null) && (context.getFailedTests() != null)) {
		if (context.getFailedTests().getAllResults() != null) {
			return context.getFailedTests().getAllResults().size();
		}
		return context.getFailedTests().size();
	}
	return 0;
}
 
Example #22
Source File: ReporterUtil.java    From qaf with MIT License 5 votes vote down vote up
private static int getFailWithPassPerCnt(ITestContext context) {
	if ((context != null)
			&& (context.getFailedButWithinSuccessPercentageTests() != null)) {
		if (context.getFailedButWithinSuccessPercentageTests()
				.getAllResults() != null) {
			return context.getFailedButWithinSuccessPercentageTests().getAllResults()
					.size();
		}
		return context.getFailedButWithinSuccessPercentageTests().size();
	}
	return 0;
}
 
Example #23
Source File: CustomJUnitReportListener.java    From heat with Apache License 2.0 5 votes vote down vote up
private Properties setTestSuiteAttribute(Properties testSuiteAttr, String suiteName, ITestContext suiteContext) {
    Properties testSuiteAttributes = testSuiteAttr;
    int numFailures = getList(FAILED_TC, suiteContext).size();
    int numSuccess = getList(PASSED_TC, suiteContext).size();
    int numSkipped = getList(SKIPPED_TC, suiteContext).size();
    testSuiteAttributes.setProperty(XMLConstants.ATTR_NAME, suiteName);
    int tests = numFailures + numSuccess + numSkipped;
    if (tests == 0) {
        testSuiteAttributes.setProperty(PROP_STATUS, SKIPPED_STATUS);
    } else {
        testSuiteAttributes.setProperty(SUCCESS_STATUS, String.valueOf(numSuccess));
        testSuiteAttributes.setProperty(SKIPPED_STATUS, String.valueOf(numSkipped));
        int numberOfTests = numFailures + numSuccess + numSkipped;
        testSuiteAttributes.setProperty(XMLConstants.ATTR_TESTS, String.valueOf(numberOfTests));
        Date timeStamp = Calendar.getInstance().getTime();
        testSuiteAttributes.setProperty(XMLConstants.ATTR_FAILURES, String.valueOf(numFailures));
        testSuiteAttributes.setProperty(XMLConstants.ATTR_TIMESTAMP, timeStamp.toGMTString());
        if (numFailures > 0) {
            testSuiteAttributes.setProperty(PROP_STATUS, FAILED_STATUS);
        } else {
            testSuiteAttributes.setProperty(PROP_STATUS, SUCCESS_STATUS);
            numberOfPassedSuites += 1;
        }
    }

    return testSuiteAttributes;
}
 
Example #24
Source File: LinkHeaderGenerationTest.java    From che with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void linksHeaderShouldBeCorrectlyGenerated(ITestContext ctx) throws Exception {
  final Response response =
      given()
          .auth()
          .basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD)
          .contentType("application/json")
          .when()
          .get(SECURE_PATH + "/test/paging/test-path-param?query-param=test-query-param");

  assertEquals(response.getStatusCode(), 200);

  final String headerValue = response.getHeader("Link");
  assertNotNull(headerValue, "Link header is missing in the response");

  final Map<String, String> relToLinkMap = PagingUtil.parseLinkHeader(headerValue);
  final Set<String> expectedRels = new HashSet<>(asList("first", "last", "prev", "next"));
  assertEquals(
      relToLinkMap.keySet(),
      expectedRels,
      "Rels are different " + symmetricDifference(expectedRels, relToLinkMap.keySet()));

  final String expectedUri =
      "http://localhost:"
          + ctx.getAttribute(EverrestJetty.JETTY_PORT)
          + "/rest/private/test/paging/test-path-param";
  for (String link : relToLinkMap.values()) {
    final URI uri = URI.create(link);
    final Map<String, List<String>> params = getQueryParameters(uri.toURL());
    assertEquals(params.size(), 3);
    assertNotNull(params.get("skipCount"));
    assertNotNull(params.get("maxItems"));
    assertEquals(params.get("query-param").get(0), "test-query-param");
    assertEquals(link, expectedUri + '?' + uri.getQuery());
  }
}
 
Example #25
Source File: SteviaTestBase.java    From stevia with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Before method.
 *
 * @param testContext the test context
 * @throws Exception the exception
 */
@BeforeMethod(alwaysRun = true)
protected final void contextInitBeforeMethod(ITestContext testContext) throws Exception {
	Map<String,String> parameters = testContext.getSuite().getXmlSuite().getAllParameters();
	
	if (testContext.getSuite().getParallel().equalsIgnoreCase("methods")) {

		STEVIA_TEST_BASE_LOG.warn("***************************************************************************************");
		STEVIA_TEST_BASE_LOG.warn("*** Driver initialisation phase, current parallel level is @BeforeMethod[PANICMODE] ***");
		STEVIA_TEST_BASE_LOG.warn("***************************************************************************************");
		
		initializeStevia(parameters);
	}
}
 
Example #26
Source File: TestHBaseTransactionClient.java    From phoenix-omid with Apache License 2.0 5 votes vote down vote up
@Test(timeOut = 30_000)
public void testCrashAfterCommit(ITestContext context) throws Exception {
    PostCommitActions syncPostCommitter =
            spy(new HBaseSyncPostCommitter(new NullMetricsProvider(), getCommitTable(context).getClient(), connection));
    AbstractTransactionManager tm = (AbstractTransactionManager) newTransactionManager(context, syncPostCommitter);
    // The following line emulates a crash after commit that is observed in (*) below
    doThrow(new RuntimeException()).when(syncPostCommitter).updateShadowCells(any(HBaseTransaction.class));

    Table htable = connection.getTable(TableName.valueOf(TEST_TABLE));
    SnapshotFilterImpl snapshotFilter = new SnapshotFilterImpl(new HTableAccessWrapper(htable, htable),
            tm.getCommitTableClient());
    TTable table = spy(new TTable(htable, snapshotFilter, false));

    HBaseTransaction t1 = (HBaseTransaction) tm.begin();

    // Test shadow cell are created properly
    Put put = new Put(row1);
    put.addColumn(family, qualifier, data1);
    table.put(t1, put);
    try {
        tm.commit(t1);
    } catch (Exception e) { // (*) crash
        // Do nothing
    }

    assertTrue(CellUtils.hasCell(row1, family, qualifier, t1.getStartTimestamp(), new TTableCellGetterAdapter(table)),
               "Cell should be there");
    assertFalse(CellUtils.hasShadowCell(row1, family, qualifier, t1.getStartTimestamp(), new TTableCellGetterAdapter(table)),
                "Shadow cell should not be there");

    HBaseCellId hBaseCellId = new HBaseCellId(table, row1, family, qualifier, t1.getStartTimestamp());

    HBaseTransactionClient hbaseTm = (HBaseTransactionClient) newTransactionManager(context);
    assertTrue(snapshotFilter.isCommitted(hBaseCellId, 0, false), "row1 should be committed");
}
 
Example #27
Source File: DefaultHttpJsonRequestTest.java    From che with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void shouldSendQueryParameters(ITestContext ctx) throws Exception {
  final DefaultHttpJsonRequest request =
      new DefaultHttpJsonRequest(getUrl(ctx) + "/query-parameters");

  final Map<String, String> map =
      request
          .usePutMethod()
          .addQueryParam("param1", "value1")
          .addQueryParam("param2", "value2")
          .request()
          .asProperties();

  assertEquals(map, ImmutableMap.of("param1", "value1", "param2", "value2"));
}
 
Example #28
Source File: TestNGTestResultProcessorAdapter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void onFinish(ITestContext iTestContext) {
    Object id;
    synchronized (lock) {
        id = suites.remove(iTestContext.getName());
        for (ITestNGMethod method : iTestContext.getAllTestMethods()) {
            testMethodToSuiteMapping.remove(method);
        }
    }
    resultProcessor.completed(id, new TestCompleteEvent(iTestContext.getEndDate().getTime()));
}
 
Example #29
Source File: TckListener.java    From che with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void configure() {
  bind(ITestContext.class).toInstance(testContext);
  while (moduleIterator.hasNext()) {
    final TckModule module = moduleIterator.next();
    module.setTestContext(testContext);
    install(module);
  }
}
 
Example #30
Source File: TestHBaseTransactionClient.java    From phoenix-omid with Apache License 2.0 5 votes vote down vote up
@Test(timeOut = 30_000)
public void testCellCommitTimestampIsLocatedInShadowCellsAfterNotBeingInvalidated(ITestContext context) throws Exception {

    CommitTable.Client commitTableClient = spy(getCommitTable(context).getClient());
    AbstractTransactionManager tm = spy((AbstractTransactionManager) newTransactionManager(context, commitTableClient));
    // The next two lines avoid steps 2), 3) and 5) and go directly to step 6)
    // in AbstractTransactionManager.locateCellCommitTimestamp()
    SettableFuture<Optional<CommitTimestamp>> f = SettableFuture.create();
    f.set(Optional.<CommitTimestamp>absent());
    doReturn(f).when(commitTableClient).getCommitTimestamp(any(Long.class));

    Table htable = connection.getTable(TableName.valueOf(TEST_TABLE));
    SnapshotFilterImpl snapshotFilter = new SnapshotFilterImpl(new HTableAccessWrapper(htable, htable),
            tm.getCommitTableClient());

    try (TTable table = spy(new TTable(htable, snapshotFilter, false))) {

        // Commit a transaction to addColumn ST/CT in commit table
        HBaseTransaction tx1 = (HBaseTransaction) tm.begin();
        Put put = new Put(row1);
        put.addColumn(family, qualifier, data1);
        table.put(tx1, put);
        tm.commit(tx1);
        // Upon commit, the commit data should be in the shadow cells

        // Test the locator finds the appropriate data in the shadow cells
        HBaseCellId hBaseCellId = new HBaseCellId(table, row1, family, qualifier,
                tx1.getStartTimestamp());
        CommitTimestampLocator ctLocator = new CommitTimestampLocatorImpl(hBaseCellId,
                Maps.<Long, Long>newHashMap());
        CommitTimestamp ct = snapshotFilter.locateCellCommitTimestamp(tx1.getStartTimestamp(), tm.tsoClient.getEpoch(),
                ctLocator,false);
        assertTrue(ct.isValid());
        assertEquals(ct.getValue(), tx1.getCommitTimestamp());
        assertTrue(ct.getLocation().compareTo(SHADOW_CELL) == 0);
    }

}