Sorry for the mess. I m posting again:

I have wrote one test case in my new work place. now i have seen in other
codes they  have POM.xml. 
ques # 1==Could anybody tell me what exactly I have to put there to run my
test. I am adding a pom.xml which i tried but did not work. let me know what
i have to add. We are using Spring jdbc template. I am adding the test code
and the pom.xml.

first the test code is :


import java.util.List;

import junit.framework.TestCase;

import org.springframework.context.ApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;

import com.tracfone.core.bean.User;
import com.tracfone.core.component.ApplicationContextLoader;
import com.tracfone.domain.api.user.UserDAO;

public class UserDaoTestCase extends TestCase {

        private static final String CONFIG_FILE =
"C:/projects//Sadd/src/test/java/userTestCase.xml";
        
        private JdbcTemplate jdbcTemplate = null;
        private UserDAO userDAO = null;
        
        public UserDaoTestCase() {              
                super();
                                        
        }       
                                        
                protected void setUp() throws Exception {
                        ApplicationContext applicationContext =
ApplicationContextLoader.load(CONFIG_FILE);
                        
                        jdbcTemplate = (JdbcTemplate) 
applicationContext.getBean("jdbcTemplate");               
                        
                        userDAO = (UserDAO) 
applicationContext.getBean("userDAO");
                        
                        jdbcTemplate.execute("delete from table_user where 
objid=323");
                        System.out.println("Junit Test case for user setUp3");
                        jdbcTemplate.execute("INSERT INTO TABLE_USER ( " +
                                                "OBJID, LOGIN_NAME , PASSWORD ) 
VALUES (323,'testtracfone','test')");   
                        
                        super.setUp();
                }


                protected void tearDown() throws Exception {
                        
                        jdbcTemplate.execute("delete from table_user where 
objid=323");                 
                        super.tearDown();
                }

                public void testFindUser(){             
                        
                        User user = userDAO.findUser("testtracfone");
                        String password="";
                        if(user.getPassword()!=null){
                                password=user.getPassword();                    
                        }
                        String id="";
                        if(user.getId()!=null){
                                id=user.getId();                        
                        }
                        assertEquals("323",id);
                        assertEquals("test",password);
                        
                }
                
                public void testFindUsersByGroup(){             
                        
                        List userList = 
userDAO.findUsersByGroup("ADMINCONSOLE");
                        //String password="";
                        assertNotNull(userList);
                        assertEquals(userList.size(),4);
                }
}



the rough pom i have wrote is
 

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
<modelVersion>4.0.0</modelVersion>
<groupId>Sadd</groupId>        

//Ques#2:what should be groupID?? if my folder name is Sadd

<artifactId>simple</artifactId> 

// Ques#3what should I put here in artifactId, what does it mean

<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>simple</name>
<url>http://maven.apache.org</url>
<dependencies>

                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>3.8.1</version>
                        <scope>test</scope>
                </dependency>

                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring</artifactId>
                        <version>2.0</version>
                </dependency>
                
                <dependency>
                        <groupId>Sadd</groupId> 
 // Ques#4 Again if my folder name is Sadd, am i doing right?

                        <artifactId>com.core</artifactId> 
// Ques#5my Sadd folder is dependant on com.core, am i doing right??
                        <version>1.0</version>
                        <scope>test</scope>
                </dependency>
                
</dependencies>

<build>
<plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <configuration>
                                        <source>1.4</source>
                                        <target>1.4</target>
                                        <debug>true</debug>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-surefire-plugin</artifactId>
                                <configuration>
                                        <includes>
                                                
<include>**/*TestCase.java</include>
                                        </includes>
                                        <skip>true</skip>
                                </configuration>
                        </plugin>
                </plugins>
</build>

</project>


Ques#6: I have seen environmental.xml also. what it does??


Sorry if my questions are too imple or stupid. I wanted to learn maven by
actually doing a project. thats wht i m trying to do. if anybody could help
me thank you in advance.



-- 
View this message in context: 
http://www.nabble.com/very-new-to-maven---Eclipse-and-java-tp16790642s177p16790643.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to