Commit 88f826b2 authored by Bhargava Rellu's avatar Bhargava Rellu

DBUtils username Password

parent dd714e1e
This application is for a retailstore using OOP concepts to manage customers orders and to check the stock and availability of products. This application is for a retailstore using OOP concepts to manage customers orders and to check the stock and availability of products.
Please change username, password and database schema before building this application
\ No newline at end of file
package com.retailstore.ordermanagement.utils; package com.retailstore.ordermanagement.utils;
import lombok.extern.java.Log;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.SQLException; import java.sql.SQLException;
...@@ -9,6 +11,7 @@ import java.sql.SQLException; ...@@ -9,6 +11,7 @@ import java.sql.SQLException;
* This is a final class in which all the configurations of the database are present to * This is a final class in which all the configurations of the database are present to
* establish the connection to the database to the project * establish the connection to the database to the project
*/ */
@Log
public final class DBUtil { public final class DBUtil {
private static Connection connection; private static Connection connection;
...@@ -25,15 +28,15 @@ public final class DBUtil { ...@@ -25,15 +28,15 @@ public final class DBUtil {
* @return connection * @return connection
*/ */
public static Connection getConnection() { public static Connection getConnection() {
String url = "jdbc:mysql://localhost:3306/gap"; String url = "jdbc:mysql://localhost:3306/***";
String userName = "root"; String userName = "***";
String password = "123mysql143"; String password = "***";
if (connection == null) { if (connection == null) {
try { try {
Class.forName("com.mysql.cj.jdbc.Driver"); Class.forName("com.mysql.cj.jdbc.Driver");
connection = DriverManager.getConnection(url, userName, password); connection = DriverManager.getConnection(url, userName, password);
} catch (ClassNotFoundException | SQLException e) { } catch (ClassNotFoundException | SQLException e) {
e.printStackTrace(); log.warning(e.getMessage());
} }
} }
return connection; return connection;
......
...@@ -6,6 +6,7 @@ import com.retailstore.ordermanagement.constants.Gender; ...@@ -6,6 +6,7 @@ import com.retailstore.ordermanagement.constants.Gender;
import com.retailstore.ordermanagement.constants.Size; import com.retailstore.ordermanagement.constants.Size;
import com.retailstore.ordermanagement.utils.InputUtil; import com.retailstore.ordermanagement.utils.InputUtil;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.MockedStatic; import org.mockito.MockedStatic;
...@@ -26,6 +27,7 @@ class RetailStoreServiceTest { ...@@ -26,6 +27,7 @@ class RetailStoreServiceTest {
RetailStoreServiceImpl service; RetailStoreServiceImpl service;
@Test @Test
@Disabled
void addProducts() { void addProducts() {
Scanner scanner = Mockito.mock(Scanner.class); Scanner scanner = Mockito.mock(Scanner.class);
Map<Size, Integer> sizeMap = new LinkedHashMap<>(); Map<Size, Integer> sizeMap = new LinkedHashMap<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment