Github user codymarcel commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/105#discussion_r36532442
  
    --- Diff: 
phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java ---
    @@ -144,4 +148,52 @@ public void testRWWorkload() throws Exception {
                 fail("Failed to load data. An exception was thrown: " + 
e.getMessage());
             }
         }
    +
    +
    +    @Test
    +    /**
    +     * Validates that Pherf can write data to a Multi-Tenant View in 
addition to 
    +     * standard Phoenix tables.
    +     */
    +    public void testMultiTenantViewWriteWorkload() throws Exception {
    +        // Arrange
    +        Scenario scenario = 
parser.getScenarioByName("testMTWriteScenario");
    +        WorkloadExecutor executor = new WorkloadExecutor();
    +        executor.add(new WriteWorkload(util, parser, scenario));
    +        
    +        // Act
    +        try {
    +            // Wait for data to load up.
    +            executor.get();
    +            executor.shutdown();
    +        } catch (Exception e) {
    +            fail("Failed to load data. An exception was thrown: " + 
e.getMessage());
    +        }
    +
    +        // Assert
    +        assertExpectedNumberOfRecordsWritten(scenario);
    +
    +    }
    +
    +    private void assertExpectedNumberOfRecordsWritten(Scenario scenario) 
throws Exception,
    +            SQLException {
    +        Connection connection = util.getConnection(scenario.getTenantId());
    +        String sql = "select count(*) from " + scenario.getTableName();
    +        Integer count = new JdbcSession(connection).sql(sql).select(new 
Outcome<Integer>() {
    +            @Override public Integer handle(ResultSet resultSet, Statement 
statement)
    +                    throws SQLException {
    +                while (resultSet.next()) {
    +                    return resultSet.getInt(1);
    +                }
    +                return null;
    +            }
    +        });
    +        assertNotNull("Could not retrieve count. " + count);
    +        assertTrue("Could not query any rows for in " + 
scenario.getTableName(), count > 0);
    --- End diff --
    
    This assertion is redundant with the one below. The next one is better. I 
can remove this one on commit.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to