Skip to content

Commit f56678e

Browse files
committed
Merge remote-tracking branch 'origin/main' into testcontainers
2 parents 74bbfd2 + f88d402 commit f56678e

File tree

3 files changed

+5
-64
lines changed

3 files changed

+5
-64
lines changed

transact/src/main/java/dev/dbos/transact/DBOS.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ public boolean deprecatePatch(@NonNull String patchName) {
785785
* Initializes the singleton instance of DBOS with config. Should be called once during app
786786
* startup, before launch. @DBOSConfig config dbos configuration
787787
*/
788-
public static void configure(DBOSConfig config) {
788+
public static Instance configure(DBOSConfig config) {
789789
if (globalInstance.get() != null) {
790790
throw new IllegalStateException("DBOS is already configured");
791791
}
@@ -795,6 +795,9 @@ public static void configure(DBOSConfig config) {
795795
if (!updated) {
796796
throw new IllegalStateException("DBOS is already configured");
797797
}
798+
799+
// TODO: https://github.com/dbos-inc/dbos-transact-java/issues/299
800+
return globalInstance.get();
798801
}
799802

800803
/**

transact/src/main/java/dev/dbos/transact/migrations/MigrationManager.java

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,6 @@ created_at BIGINT NOT NULL DEFAULT (EXTRACT(epoch FROM now()) * 1000.0)::bigint
479479
v_now BIGINT;
480480
v_recovery_attempts INTEGER := 0;
481481
v_priority INTEGER;
482-
v_existing_name TEXT;
483-
v_existing_class_name TEXT;
484-
v_existing_config_name TEXT;
485482
BEGIN
486483
487484
-- Validate required parameters
@@ -526,26 +523,7 @@ IF named_args IS NOT NULL AND jsonb_typeof(named_args::jsonb) != 'object' THEN
526523
)
527524
ON CONFLICT (workflow_uuid)
528525
DO UPDATE SET
529-
updated_at = EXCLUDED.updated_at
530-
RETURNING workflow_status.name, workflow_status.class_name, workflow_status.config_name
531-
INTO v_existing_name, v_existing_class_name, v_existing_config_name;
532-
533-
-- Validate workflow metadata matches
534-
IF v_existing_name IS DISTINCT FROM workflow_name THEN
535-
RAISE EXCEPTION 'Conflicting DBOS workflow name'
536-
USING DETAIL = format('Workflow %%s exists with name %%s, but the provided workflow name is: %%s', v_workflow_id, v_existing_name, workflow_name),
537-
ERRCODE = 'invalid_parameter_value';
538-
END IF;
539-
IF v_existing_class_name IS DISTINCT FROM class_name THEN
540-
RAISE EXCEPTION 'Conflicting DBOS workflow class_name'
541-
USING DETAIL = format('Workflow %%s exists with class_name %%s, but the provided class_name is: %%s', v_workflow_id, v_existing_class_name, class_name),
542-
ERRCODE = 'invalid_parameter_value';
543-
END IF;
544-
IF v_existing_config_name IS DISTINCT FROM config_name THEN
545-
RAISE EXCEPTION 'Conflicting DBOS workflow config_name'
546-
USING DETAIL = format('Workflow %%s exists with config_name %%s, but the provided config_name is: %%s', v_workflow_id, v_existing_config_name, config_name),
547-
ERRCODE = 'invalid_parameter_value';
548-
END IF;
526+
updated_at = EXCLUDED.updated_at;
549527
550528
RETURN v_workflow_id;
551529

transact/src/test/java/dev/dbos/transact/client/PgSqlClientTest.java

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -109,46 +109,6 @@ public interface ThrowingFunction<P, T, E extends Exception> {
109109
T execute(P param) throws E;
110110
}
111111

112-
@Test
113-
public void clientEnqueueInvalidWorkflowName() throws Exception {
114-
final var workflowId = UUID.randomUUID().toString();
115-
116-
ThrowingFunction<String, String, Exception> enqueueSupplier =
117-
(workflowName) -> {
118-
var sql = "SELECT dbos.enqueue_workflow(?, ?, ?, workflow_id => ?, class_name => ?)";
119-
try (var conn = dataSource.getConnection();
120-
var stmt = conn.prepareCall(sql)) {
121-
stmt.setString(1, workflowName);
122-
stmt.setString(2, "testQueue");
123-
var argsArray =
124-
conn.createArrayOf(
125-
"json",
126-
new String[] {
127-
MAPPER.writeValueAsString("42"), MAPPER.writeValueAsString("spam")
128-
});
129-
stmt.setObject(3, argsArray);
130-
stmt.setString(4, workflowId);
131-
stmt.setString(5, "ClientServiceImpl");
132-
try (ResultSet rs = stmt.executeQuery()) {
133-
return rs.next() ? rs.getString(1) : null;
134-
} finally {
135-
argsArray.free();
136-
}
137-
}
138-
};
139-
140-
String retValue = enqueueSupplier.execute("enqueueTest");
141-
assertEquals(workflowId, retValue);
142-
143-
var ex = assertThrows(PSQLException.class, () -> enqueueSupplier.execute("wrong name"));
144-
assertTrue(ex.getMessage().startsWith("ERROR: Conflicting DBOS workflow name"));
145-
assertTrue(
146-
ex.getMessage()
147-
.contains(
148-
"Workflow %s exists with name %s, but the provided workflow name is: %s"
149-
.formatted(workflowId, "enqueueTest", "wrong name")));
150-
}
151-
152112
@Test
153113
public void clientEnqueueDeDupe() throws Exception {
154114
var qs = DBOSTestAccess.getQueueService();

0 commit comments

Comments
 (0)