Skip to content

Commit

Permalink
set -> cue
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Jul 17, 2023
1 parent b690199 commit 7e00b41
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public void testUpdateVersion(final World world, final Transaction transaction)

// If version is wrong, but version.wasSet is false
c.version.set(0);
c.version.reset();
c.version.cue(false);
assertEquals(1,
UPDATE(c)
.execute(transaction)
Expand Down
28 changes: 14 additions & 14 deletions jaxdb-maven-plugin/src/test/java/org/jaxdb/jsql/KeyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static class MockTable extends data.Table {
}

@Override
protected void toString(final boolean wasSetOnly, final StringBuilder s) {
protected void toString(final boolean wasCuedOnly, final StringBuilder s) {
throw new UnsupportedAddressTypeException();
}

Expand Down Expand Up @@ -85,7 +85,7 @@ public data.Table clone() {
}

@Override
void _merge$(final data.Table table) {
void _merge$(final data.Table table, final boolean checkMutable) {
throw new UnsupportedAddressTypeException();
}

Expand Down Expand Up @@ -117,36 +117,36 @@ private static <V>void test(final data.Table t, final data.Column<V> c, final V

assertTrue(c.isNull());
assertTrue(c.isNullOld());
assertFalse(c.set());
assertFalse(c.cued());
assertNotNull(t._primaryKeyImmutable$);
assertNotNull(t._primaryKeyOldImmutable$);

assertFalse(c.setIfNotNull(null));
assertTrue(c.isNull());
assertTrue(c.isNullOld());
assertFalse(c.set());
assertFalse(c.cued());
assertNotNull(t._primaryKeyImmutable$);
assertNotNull(t._primaryKeyOldImmutable$);

assertFalse(c.setIfNotEqual(null));
assertTrue(c.isNull());
assertTrue(c.isNullOld());
assertFalse(c.set());
assertFalse(c.cued());
assertNotNull(t._primaryKeyImmutable$);
assertNotNull(t._primaryKeyOldImmutable$);

assertFalse(c.setIfNotNullOrEqual(null));
assertTrue(c.isNull());
assertTrue(c.isNullOld());
assertFalse(c.set());
assertFalse(c.cued());
assertNotNull(t._primaryKeyImmutable$);
assertNotNull(t._primaryKeyOldImmutable$);

setNull1.run();
assertFalse(c.changed);
assertTrue(c.isNull());
assertTrue(c.isNullOld());
assertTrue(c.set());
assertTrue(c.cued());
assertEquals(data.Column.SetBy.USER, c.setByCur);
assertNotNull(t._primaryKeyImmutable$);
assertNotNull(t._primaryKeyOldImmutable$);
Expand All @@ -155,7 +155,7 @@ private static <V>void test(final data.Table t, final data.Column<V> c, final V
assertFalse(c.changed);
assertTrue(c.isNull());
assertTrue(c.isNullOld());
assertTrue(c.set());
assertTrue(c.cued());
assertEquals(data.Column.SetBy.USER, c.setByCur);
assertNotNull(t._primaryKeyImmutable$);
assertNotNull(t._primaryKeyOldImmutable$);
Expand All @@ -164,7 +164,7 @@ private static <V>void test(final data.Table t, final data.Column<V> c, final V
assertFalse(c.changed);
assertTrue(c.isNull());
assertTrue(c.isNullOld());
assertTrue(c.set());
assertTrue(c.cued());
assertEquals(data.Column.SetBy.USER, c.setByCur);
assertNotNull(t._primaryKeyImmutable$);
assertNotNull(t._primaryKeyOldImmutable$);
Expand Down Expand Up @@ -203,15 +203,15 @@ private static <V>void test(final data.Table t, final data.Column<V> c, final V
assertEquals(c.getOld(), t.getKeyOld().value(0));
}

c.reset();
c.cue(false);
assertTrue(c.isNull());

if (isFirst)
assertTrue(c.isNullOld());
else
assertTrue(ObjectUtil.equals(v, c.getOld()));

assertFalse(c.set());
assertFalse(c.cued());
assertNull(c.setByCur);
assertNotNull(t._primaryKeyImmutable$);
assertNotNull(t._primaryKeyOldImmutable$);
Expand All @@ -225,7 +225,7 @@ private static <V>void test(final data.Table t, final data.Column<V> c, final V
else
assertTrue(ObjectUtil.equals(v, c.getOld()));

assertTrue(c.set());
assertTrue(c.cued());
assertEquals(data.Column.SetBy.USER, c.setByCur);
assertEquals(i == 0, t._primaryKeyImmutable$ == null);
assertEquals(i == 0 && isFirst, t._primaryKeyOldImmutable$ == null); // Because SetByOld is null
Expand All @@ -241,14 +241,14 @@ private static <V>void test(final data.Table t, final data.Column<V> c, final V
assertTrue(ObjectUtil.equals(v, c.get()));

assertNull(c.setByCur);
assertFalse(c.set());
assertFalse(c.cued());
assertNotNull(t._primaryKeyImmutable$);
assertNotNull(t._primaryKeyOldImmutable$);

assertFalse(c.setIfNotNullOrEqual(v));
assertTrue(ObjectUtil.equals(v, c.get()));
assertNull(c.setByCur);
assertFalse(c.set());
assertFalse(c.cued());
assertNotNull(t._primaryKeyImmutable$);
assertNotNull(t._primaryKeyOldImmutable$);
c.setByCur = data.Column.SetBy.USER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,37 @@ public static <V>void test(final data.Column<V> t, final V v1, final V v2, final
final String name = t.getClass().getSimpleName();
assertTrue(name, t.isNull());
assertNull(name, t.get());
assertFalse(name, t.set());
assertFalse(name, t.cued());

assertTrue(name, t.set(v1));
assertFalse(name, t.set(v1));

assertTrue(name, t.changed);
assertFalse(name, t.set(v1));
assertFalse(name, t.isNull());
assertTrue(name, t.set());
assertTrue(name, t.cued());
assertEquals(name, v1, t.get());

t.revert();
assertFalse(name, t.changed);
assertTrue(name, t.isNull());
assertNull(name, t.get());
assertFalse(name, t.set());
assertFalse(name, t.cued());

assertTrue(name, t.set(v1));
assertTrue(name, t.changed);
assertFalse(name, t.set(v1));
assertFalse(name, t.isNull());
assertTrue(name, t.set());
assertTrue(name, t.set());
assertTrue(name, t.cued());
assertTrue(name, t.cued());
assertEquals(name, v1, t.get());

t._commitEntity$();

t.revert();
assertFalse(name, t.changed);
assertFalse(name, t.isNull());
assertTrue(name, t.set());
assertTrue(name, t.cued());
assertEquals(name, v1, t.get());

assertTrue(name, t.set(v2));
Expand All @@ -75,13 +75,13 @@ public static <V>void test(final data.Column<V> t, final V v1, final V v2, final
assertTrue(name, t.changed);
assertFalse(name, t.set(v2));
assertFalse(name, t.isNull());
assertTrue(name, t.set());
assertTrue(name, t.cued());
assertEquals(name, v2, t.get());

t.revert();
assertFalse(name, t.changed);
assertFalse(name, t.isNull());
assertTrue(name, t.set());
assertTrue(name, t.cued());
assertEquals(name, v1, t.get());
}

Expand Down
6 changes: 3 additions & 3 deletions jsql/src/main/java/org/jaxdb/jsql/DefaultCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static data.Table insert(final data.Table entity) {

private static data.Table update(final data.Table entity, final data.Table update) {
if (logger.isTraceEnabled()) logger.trace("update(" + log(entity) + "," + log(update) + ")");
entity.merge(update);
entity.merge$(update);
entity._commitUpdate$();
entity._commitEntity$();
return entity;
Expand Down Expand Up @@ -232,7 +232,7 @@ protected void delete(final data.Table row) {
* @throws SQLException If a SQL error has occurred.
*/
protected <T extends data.Table>data.Table refreshRow(final CacheMap<T> cache, final T row) throws IOException, SQLException {
row.reset(data.Except.PRIMARY_KEY);
row.cue(false, data.Except.PRIMARY_KEY);
selectRow(row);

final data.Key key = row.getKey();
Expand All @@ -242,7 +242,7 @@ protected <T extends data.Table>data.Table refreshRow(final CacheMap<T> cache, f
entity._commitInsert$();
}
else {
entity.merge(row);
entity.merge$(row);
entity._commitUpdate$();
}

Expand Down
2 changes: 1 addition & 1 deletion jsql/src/main/java/org/jaxdb/jsql/Notifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ else if (action == Action.DELETE) {
queue.add(new Notification<>(sessionId, timestamp, entry.getKey(), action, null, old));
}
else {
old.merge(cur);
old.merge$(cur);
queue.add(new Notification<>(sessionId, timestamp, entry.getKey(), action, (Map<String,String>)json.get("keyForUpdate"), old));
}

Expand Down
Loading

0 comments on commit 7e00b41

Please sign in to comment.