-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SalesDaoImpl 생성 SalesDaoImplTest 생성 이후에 작업 할 예쩡
- Loading branch information
1 parent
672eab4
commit 737092d
Showing
3 changed files
with
132 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package hairrang.dao.impl; | ||
|
||
import java.sql.Connection; | ||
import java.sql.PreparedStatement; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import hairrang.conn.JdbcUtil; | ||
import hairrang.dao.SalesDao; | ||
import hairrang.dto.Sales; | ||
|
||
public class SalesDaoImpl implements SalesDao{ | ||
private static final SalesDaoImpl instance = new SalesDaoImpl(); | ||
|
||
private SalesDaoImpl() {}; | ||
|
||
public static SalesDaoImpl getInstace() { | ||
return instance; | ||
} | ||
|
||
@Override | ||
public List<Sales> selectSalesByAll() { | ||
String sql = "SELECT * FROM SALES"; | ||
try(Connection con = JdbcUtil.getConnection(); | ||
PreparedStatement pstmt = con.prepareStatement(sql); | ||
ResultSet rs = pstmt.executeQuery()){ | ||
if(rs.next()) { | ||
List<Sales> list = new ArrayList<Sales>(); | ||
do { | ||
list.add(getSales(rs)); | ||
}while(rs.next()); | ||
return list; | ||
} | ||
} catch (SQLException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
|
||
|
||
@Override | ||
public Sales selectSalesByNo(Sales sales) { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public int insertSales(Sales sales) { | ||
// TODO Auto-generated method stub | ||
return 0; | ||
} | ||
|
||
@Override | ||
public int updateSales(Sales sales) { | ||
// TODO Auto-generated method stub | ||
return 0; | ||
} | ||
|
||
@Override | ||
public int deleteSales(Sales sales) { | ||
// TODO Auto-generated method stub | ||
return 0; | ||
} | ||
|
||
private Sales getSales(ResultSet rs) { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package hairrang.dao.test; | ||
|
||
import static org.junit.Assert.fail; | ||
|
||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import hairrang.dao.SalesDao; | ||
import hairrang.dao.impl.SalesDaoImpl; | ||
|
||
public class SalesDaoTest { | ||
private SalesDao dao; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
dao=SalesDaoImpl.getInstace(); | ||
} | ||
|
||
@After | ||
public void tearDown() throws Exception { | ||
dao=null; | ||
} | ||
|
||
@Test | ||
public void testSelectSalesByAll() { | ||
System.out.printf("%s()%n","testSelectSalesByAll()"); | ||
|
||
} | ||
|
||
@Test | ||
public void testSelectSalesByNo() { | ||
fail("Not yet implemented"); | ||
} | ||
|
||
@Test | ||
public void testInsertSales() { | ||
fail("Not yet implemented"); | ||
} | ||
|
||
@Test | ||
public void testUpdateSales() { | ||
fail("Not yet implemented"); | ||
} | ||
|
||
@Test | ||
public void testDeleteSales() { | ||
fail("Not yet implemented"); | ||
} | ||
|
||
} |