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> <artifactId>exec-maven-plugin</artifactId>
<version>3.1.1</version> <version>3.1.1</version>
<configuration> <configuration>
<mainClass>org.nmpl.v0.App</mainClass> <mainClass>org.nmpl.App</mainClass>
</configuration> </configuration>
</plugin> </plugin>

View file

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

View file

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

View file

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

View file

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

View file

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