This commit is contained in:
Amit Kumar Nandi 2024-03-01 03:56:26 +05:30
parent 11e4554ad7
commit 853b1d81ac
6 changed files with 17 additions and 7 deletions

View file

@ -123,7 +123,7 @@
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<mainClass>org.nmpl.v0.App</mainClass>
<mainClass>org.nmpl.App</mainClass>
</configuration>
</plugin>

View file

@ -5,10 +5,13 @@ import java.sql.SQLException;
public class App {
public static void main(String[] args) {
final String dbName = "shortener";
final String username = "root";
final String pasword = "1234qwer";
SwingUtilities.invokeLater(() -> {
DbExporter manager;
try {
manager = new DbExporter();
manager = new DbExporter(dbName,username,pasword);
}
catch (SQLException e) {
throw new RuntimeException(e);

View file

@ -14,8 +14,8 @@ public class DbExporter extends JFrame {
private final DefaultListModel<String> tableListModel;
private final Connection connection;
public DbExporter() throws SQLException {
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/bankdb", "root", "1234qwer");
public DbExporter(String dbName,String username,String pasword) throws SQLException {
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+dbName, username, pasword);
setTitle("Database Manager");
setSize(400, 400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

View file

@ -1,10 +1,19 @@
package org.nmpl.exporters;
import org.nmpl.ExportType;
import org.nmpl.Exportable;
import java.sql.Connection;
@ExportType("TEST")
public class TestExporter implements Exportable {
private final Connection connection;
public TestExporter(Connection connection) {
this.connection = connection;
}
@Override
public void export(String tableName, String fileName) {
try {

View file

@ -2,7 +2,7 @@ package org.nmpl;
import org.fest.swing.fixture.FrameFixture;
import org.junit.jupiter.api.Test;
import org.nmpl.v0.DbExporter;
import org.nmpl.DbExporter;
import javax.swing.*;
import java.sql.SQLException;

View file

@ -5,8 +5,6 @@ import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.nmpl.exporters.XMLExporter;
import org.nmpl.v0.Exportable;
import org.nmpl.v0.ExporterFactory;
import java.sql.Connection;
import java.util.List;