Search in sources :

Example 16 with ReadOnlyProps

use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.

the class RenewLeaseIT method doSetup.

@BeforeClass
public static void doSetup() throws Exception {
    Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(1);
    serverProps.put("hbase.coprocessor.region.classes", SleepingRegionObserver.class.getName());
    Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1);
    // Must update config before starting server
    serverProps.put(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, Long.toString(SCANNER_LEASE_TIMEOUT));
    setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator()));
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) BeforeClass(org.junit.BeforeClass)

Example 17 with ReadOnlyProps

use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.

the class ReadOnlyPropertiesTest method testDefaultProperties.

@Test
public void testDefaultProperties() {
    ReadOnlyProps defaultProps = new ReadOnlyProps(DEFAULT_PROPS_MAP);
    ReadOnlyProps readOnlyProps = new ReadOnlyProps(defaultProps, EMPTY_OVERRIDE_MAP.entrySet().iterator());
    assertEquals(DEFAULT_VALUE_1, readOnlyProps.get(PROPERTY_NAME_1));
    assertEquals(DEFAULT_VALUE_2, readOnlyProps.get(PROPERTY_NAME_2));
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) Test(org.junit.Test)

Example 18 with ReadOnlyProps

use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.

the class ReadOnlyPropertiesTest method testAddAllOverrideProperties.

@Test
public void testAddAllOverrideProperties() {
    ReadOnlyProps defaultProps = new ReadOnlyProps(DEFAULT_PROPS_MAP);
    Properties overrideProps = new Properties();
    overrideProps.setProperty(PROPERTY_NAME_1, OVERRIDEN_VALUE_1);
    ReadOnlyProps newProps = defaultProps.addAll(overrideProps);
    assertEquals(OVERRIDEN_VALUE_1, newProps.get(PROPERTY_NAME_1));
    assertEquals(DEFAULT_VALUE_2, newProps.get(PROPERTY_NAME_2));
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) Properties(java.util.Properties) Test(org.junit.Test)

Example 19 with ReadOnlyProps

use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.

the class ReadOnlyPropertiesTest method testOverridingNonDefaultProperties.

@Test
public void testOverridingNonDefaultProperties() {
    ReadOnlyProps defaultProps = new ReadOnlyProps(DEFAULT_PROPS_MAP);
    Properties props = new Properties();
    props.setProperty(PROPERTY_NAME_1, OVERRIDEN_VALUE_1);
    ReadOnlyProps nonDefaultProps = defaultProps.addAll(props);
    Properties overrideProps = new Properties();
    overrideProps.setProperty(PROPERTY_NAME_1, OVERRIDEN_VALUE_2);
    ReadOnlyProps newProps = nonDefaultProps.addAll(overrideProps);
    assertEquals(OVERRIDEN_VALUE_2, newProps.get(PROPERTY_NAME_1));
    assertEquals(DEFAULT_VALUE_2, newProps.get(PROPERTY_NAME_2));
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) Properties(java.util.Properties) Test(org.junit.Test)

Example 20 with ReadOnlyProps

use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.

the class RebuildIndexConnectionPropsIT method doSetup.

@BeforeClass
public static void doSetup() throws Exception {
    Configuration conf = HBaseConfiguration.create();
    hbaseTestUtil = new HBaseTestingUtility(conf);
    Map<String, String> serverProps = new HashMap<>();
    serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
    // need at least one retry otherwise test fails
    serverProps.put(QueryServices.INDEX_REBUILD_RPC_RETRIES_COUNTER, Long.toString(NUM_RPC_RETRIES));
    setUpConfigForMiniCluster(conf, new ReadOnlyProps(serverProps.entrySet().iterator()));
    hbaseTestUtil.startMiniCluster();
    // establish url and quorum. Need to use PhoenixDriver and not PhoenixTestDriver
    zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort();
    url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
    Properties driverProps = PropertiesUtil.deepCopy(TEST_PROPERTIES);
    DriverManager.registerDriver(PhoenixDriver.INSTANCE);
    try (PhoenixConnection phxConn = DriverManager.getConnection(url, driverProps).unwrap(PhoenixConnection.class)) {
    }
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) PhoenixConnection(org.apache.phoenix.jdbc.PhoenixConnection) Configuration(org.apache.hadoop.conf.Configuration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) HBaseTestingUtility(org.apache.hadoop.hbase.HBaseTestingUtility) HashMap(java.util.HashMap) Properties(java.util.Properties) BeforeClass(org.junit.BeforeClass)

Aggregations

ReadOnlyProps (org.apache.phoenix.util.ReadOnlyProps)72 BeforeClass (org.junit.BeforeClass)43 Test (org.junit.Test)14 IOException (java.io.IOException)6 Properties (java.util.Properties)6 PhoenixIOException (org.apache.phoenix.exception.PhoenixIOException)6 ResultSet (java.sql.ResultSet)5 Configuration (org.apache.hadoop.conf.Configuration)5 HBaseAdmin (org.apache.hadoop.hbase.client.HBaseAdmin)5 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)4 HBaseTestingUtility (org.apache.hadoop.hbase.HBaseTestingUtility)4 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)4 PhoenixConnection (org.apache.phoenix.jdbc.PhoenixConnection)4 Connection (java.sql.Connection)3 Mutation (org.apache.hadoop.hbase.client.Mutation)3 Batch (org.apache.hadoop.hbase.client.coprocessor.Batch)3 BlockingRpcCallback (org.apache.hadoop.hbase.ipc.BlockingRpcCallback)3 ServerRpcController (org.apache.hadoop.hbase.ipc.ServerRpcController)3 MutationProto (org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto)3 MetaDataMutationResult (org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult)3