From 009e14436161566cbc321c7a546bf30810f2a232 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Fri, 3 Jan 2025 20:42:15 -0600 Subject: [PATCH] test coverage for rdbms --- .../module/rdbms/jdbc/SimpleEntity.java | 228 ------------------ .../jdbc/ConnectionProviderInterfaceTest.java | 63 +++++ 2 files changed, 63 insertions(+), 228 deletions(-) delete mode 100755 qqq-backend-module-rdbms/src/main/java/com/kingsrook/qqq/backend/module/rdbms/jdbc/SimpleEntity.java create mode 100644 qqq-backend-module-rdbms/src/test/java/com/kingsrook/qqq/backend/module/rdbms/jdbc/ConnectionProviderInterfaceTest.java diff --git a/qqq-backend-module-rdbms/src/main/java/com/kingsrook/qqq/backend/module/rdbms/jdbc/SimpleEntity.java b/qqq-backend-module-rdbms/src/main/java/com/kingsrook/qqq/backend/module/rdbms/jdbc/SimpleEntity.java deleted file mode 100755 index 8541d794..00000000 --- a/qqq-backend-module-rdbms/src/main/java/com/kingsrook/qqq/backend/module/rdbms/jdbc/SimpleEntity.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * QQQ - Low-code Application Framework for Engineers. - * Copyright (C) 2021-2022. Kingsrook, LLC - * 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States - * contact@kingsrook.com - * https://github.com/Kingsrook/ - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package com.kingsrook.qqq.backend.module.rdbms.jdbc; - - -import java.util.HashMap; - - -/******************************************************************************* - ** - *******************************************************************************/ -public class SimpleEntity extends HashMap -{ - // private String tableName; - - - - // /******************************************************************************* - // ** - // *******************************************************************************/ - // public SimpleEntity() - // { - // super(); - // } - - - - // /******************************************************************************* - // ** - // *******************************************************************************/ - // public SimpleEntity with(String key, Object value) - // { - // put(key, value); - // return (this); - // } - - - - // /******************************************************************************* - // ** Return the current value of tableName - // ** - // ** @return tableName - // *******************************************************************************/ - // public String getTableName() - // { - // return (tableName); - // } - - - - // /******************************************************************************* - // ** Set the current value of tableName - // ** - // ** @param tableName - // *******************************************************************************/ - // public void setTableName(String tableName) - // { - // this.tableName = tableName; - // } - - - - // /******************************************************************************* - // ** - // *******************************************************************************/ - // public SimpleEntity withTableName(String tableName) - // { - // setTableName(tableName); - // return (this); - // } - - - - // /******************************************************************************* - // ** - // *******************************************************************************/ - // public Boolean getBoolean(String columnName) - // { - // Object o = get(columnName); - // if(o == null) - // { - // return (null); - // } - - // if(o instanceof Boolean) - // { - // return ((Boolean) o); - // } - // else if(o instanceof Number) - // { - // int i = ((Number) o).intValue(); - // return (i != 0); - // } - // else if(o instanceof String) - // { - // String s = (String) o; - // return (s.equalsIgnoreCase("1") || s.equalsIgnoreCase("true") || s.equalsIgnoreCase("t")); - // } - // else - // { - // throw new IllegalArgumentException("Could not get value of object of type [" + o.getClass() + "] as Boolean."); - // } - - // } - - - - // /******************************************************************************* - // ** - // *******************************************************************************/ - // public String getString(String columnName) - // { - // Object o = get(columnName); - // if(o == null) - // { - // return (null); - // } - // if(o instanceof String) - // { - // return ((String) o); - // } - // else if(o instanceof byte[]) - // { - // return (new String((byte[]) o)); - // } - - // return String.valueOf(o); - // } - - - - // /******************************************************************************* - // ** - // *******************************************************************************/ - // public Integer getInteger(String columnName) - // { - // Object o = get(columnName); - // if(o instanceof Long) - // { - // return ((Long) o).intValue(); - // } - // else if(o instanceof Short) - // { - // return ((Short) o).intValue(); - // } - // else if(o instanceof String) - // { - // return (Integer.parseInt((String) o)); - // } - - // return ((Integer) o); - // } - - - - // /******************************************************************************* - // ** - // *******************************************************************************/ - // public BigDecimal getBigDecimal(String columnName) - // { - // Object o = get(columnName); - // if(o == null) - // { - // return (null); - // } - - // if(o instanceof BigDecimal) - // { - // return ((BigDecimal) o); - // } - // else - // { - // return new BigDecimal(String.valueOf(o)); - // } - // } - - - - // /******************************************************************************* - // ** - // *******************************************************************************/ - // public Long getLong(String columnName) - // { - // Object o = get(columnName); - // if(o instanceof Integer) - // { - // return ((Integer) o).longValue(); - // } - - // return ((Long) o); - // } - - - - // /******************************************************************************* - // ** - // *******************************************************************************/ - // public void trimStrings() - // { - // for(String key : keySet()) - // { - // Object value = get(key); - // if(value != null && value instanceof String) - // { - // put(key, ((String) value).trim()); - // } - // } - // } -} diff --git a/qqq-backend-module-rdbms/src/test/java/com/kingsrook/qqq/backend/module/rdbms/jdbc/ConnectionProviderInterfaceTest.java b/qqq-backend-module-rdbms/src/test/java/com/kingsrook/qqq/backend/module/rdbms/jdbc/ConnectionProviderInterfaceTest.java new file mode 100644 index 00000000..f71fbcad --- /dev/null +++ b/qqq-backend-module-rdbms/src/test/java/com/kingsrook/qqq/backend/module/rdbms/jdbc/ConnectionProviderInterfaceTest.java @@ -0,0 +1,63 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2025. Kingsrook, LLC + * 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States + * contact@kingsrook.com + * https://github.com/Kingsrook/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.kingsrook.qqq.backend.module.rdbms.jdbc; + + +import java.sql.Connection; +import java.sql.SQLException; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.module.rdbms.BaseTest; +import com.kingsrook.qqq.backend.module.rdbms.model.metadata.RDBMSBackendMetaData; +import org.junit.jupiter.api.Test; + + +/******************************************************************************* + ** Unit test for ConnectionProviderInterface + *******************************************************************************/ +class ConnectionProviderInterfaceTest extends BaseTest +{ + + + /*************************************************************************** + * jacoco doesn't like that our interface isn't covered, so... cover it + ***************************************************************************/ + @Test + void dumpDebug() throws SQLException + { + new ConnectionProviderInterface() + { + @Override + public void init(RDBMSBackendMetaData backend) throws QException + { + + } + + + + @Override + public Connection getConnection() throws SQLException + { + return null; + } + }.dumpDebug(); + } +} \ No newline at end of file