@Test public void testInsert() throws Exception { cluster.cache(DEFAULT_CACHE_NAME).clear(); final String key = "key"; final Map<String, String> input = new HashMap<>(); input.put("field0", "value1"); input.put("field1", "value2"); final Status status = client.insert(DEFAULT_CACHE_NAME, key, StringByteIterator.getByteIteratorMap(input)); assertThat(status, is(Status.OK)); assertThat(cluster.cache(DEFAULT_CACHE_NAME).size(), is(1)); }
@Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { BinaryObjectBuilder bob = cluster.binary().builder("CustomType"); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { bob.setField(entry.getKey(), entry.getValue().toString()); if (debug) { log.info(entry.getKey() + ":" + entry.getValue()); } } BinaryObject bo = bob.build(); if (table.equals(DEFAULT_CACHE_NAME)) { cache.put(key, bo); } else { throw new UnsupportedOperationException("Unexpected table name: " + table); } return Status.OK; } catch (Exception e) { log.error(String.format("Error inserting key: %s", key), e); return Status.ERROR; } }
IgniteClient extends IgniteAbstractClient { @Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { BinaryObjectBuilder bob = cluster.binary().builder("CustomType"); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { bob.setField(entry.getKey(), entry.getValue().toString()); if (debug) { log.info(entry.getKey() + ":" + entry.getValue()); } } BinaryObject bo = bob.build(); if (table.equals(DEFAULT_CACHE_NAME)) { cache.put(key, bo); } else { throw new UnsupportedOperationException("Unexpected table name: " + table); } return Status.OK; } catch (Exception e) { log.error(String.format("Error inserting key: %s", key), e); return Status.ERROR; } } }
IgniteClient extends IgniteAbstractClient { @Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { BinaryObjectBuilder bob = cluster.binary().builder("CustomType"); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { bob.setField(entry.getKey(), entry.getValue().toString()); if (debug) { log.info(entry.getKey() + ":" + entry.getValue()); } } BinaryObject bo = bob.build(); if (table.equals(DEFAULT_CACHE_NAME)) { cache.put(key, bo); } else { throw new UnsupportedOperationException("Unexpected table name: " + table); } return Status.OK; } catch (Exception e) { log.error(String.format("Error inserting key: %s", key), e); return Status.ERROR; } }  }
IgniteClient extends IgniteAbstractClient { @Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { BinaryObjectBuilder bob = cluster.binary().builder("CustomType"); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { bob.setField(entry.getKey(), entry.getValue().toString()); if (debug) { log.info(entry.getKey() + ":" + entry.getValue()); } } BinaryObject bo = bob.build(); if (table.equals(DEFAULT_CACHE_NAME)) { cache.put(key, bo); } else { throw new UnsupportedOperationException("Unexpected table name: " + table); } return Status.OK; } catch (Exception e) { log.error(String.format("Error inserting key: %s", key), e); return Status.ERROR; } }  @Override Status read(String table, String key, Set<String> fields,
                     Map<String, ByteIterator> result); @Override Status update(String table, String key,
                       Map<String, ByteIterator> values); @Override Status insert(String table, String key,
                       Map<String, ByteIterator> values); @Override Status delete(String table, String key); }
IgniteClient extends IgniteAbstractClient { @Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { BinaryObjectBuilder bob = cluster.binary().builder("CustomType"); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { bob.setField(entry.getKey(), entry.getValue().toString()); if (debug) { log.info(entry.getKey() + ":" + entry.getValue()); } } BinaryObject bo = bob.build(); if (table.equals(DEFAULT_CACHE_NAME)) { cache.put(key, bo); } else { throw new UnsupportedOperationException("Unexpected table name: " + table); } return Status.OK; } catch (Exception e) { log.error(String.format("Error inserting key: %s", key), e); return Status.ERROR; } }  @Override Status read(String table, String key, Set<String> fields,
                     Map<String, ByteIterator> result); @Override Status update(String table, String key,
                       Map<String, ByteIterator> values); @Override Status insert(String table, String key,
                       Map<String, ByteIterator> values); @Override Status delete(String table, String key);  }