显示标签为“JDK”的博文。显示所有博文
显示标签为“JDK”的博文。显示所有博文

2013/03/25

Under Linux installation, start the MySQL

Three or four years is not installed mysql + apache + php environment, I used to do the the bank performance test outsourcing services in the the Party Development Center encountered such environment project is relatively small, mostly WebLogic / WebSphere + Oracle/DB2 architecture of large-scale systems. Get involved in the electricity supplier industry project, had to go to ponder those almost forgotten IIS, apache, MSsql, mysql environment.

An virtual centos4.7 of the platform: VMware

Host: windows

Install mysql preparation:

1, check whether the environment has been installed mysql, check: netstat-ano command to view the mysql port 3306 by default exists; execute mysql command line

2, download mysql installation package

Http://www.mysql.com/downloads/mysql/ # downloads download mysql installation package:

MySQL-server-5.5.28-1.linux2.6.i386.rpm

MySQL-client-5.5.28-1.linux2.6.i386.rpm

Rpm-ivh command to install mysql not say it here.

First take a look at some of the main directory of the default mysql database:

Database directory / var / lib / mysql /

2, the configuration file / usr / share / mysql (of the mysql.server command and configuration files)

Related command / usr / bin (mysqladmin mysqldump command)

4, the startup script / etc / rc.d / init.d / (startup script file mysql directory)

Default port 3306 netstat-ano command to view installed mysql start mysql service if it does not exist, according to the following method.

Start mysql service:


[Root @ localhostmysql] # pwd
/ Usr / share / mysql
[Root @ localhostmysql] #. / Mysql.server start
StartingMySQL ... [OK]
[Root @ localhostmysql] # netstat-ano
ActiveInternet connections (servers and established)
ProtoRecv-Q Send-Q Local Address Foreign Address State Timer
tcp 0 0 0.0.0.0:3306 0.0.0.0: * LISTEN off (0.00/0/0)
[Root @ localhostmysql] # mysql
Welcometo the MySQL monitor. Commands end with; or \ g.
YourMySQL connection id is 1
Serverversion: 5.5.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2012, Oracle and / or its affiliates. All rights reserved.
Oracle isa registered trademark of Oracle Corporation and / or its
affiliates.Other names may be trademarks of their respective
owners.
Type'help; 'or' \ h 'for help. Type' \ c 'to clear the current input statement.
mysql>
mysql>

Start and stop

1 to start
Mysql MySQL installation is complete, start-up file in the / etc / init.d directory, run the following command in the need to start.

[Root @ localhost mysql] # / etc / init.d / mysql start
2, stop

[Root @ localhost mysql] # / usr / bin / mysqladmin-u root-p shutdown
3, automatic start

1) back to mysql automatically start list

[Root @ localhost mysql] # / sbin / chkconfig-list
2) MySQL add to your system startup services group inside to

[Root @ localhost mysql] # / sbin / chkconfig - add mysql
3) to remove the MySQL service group from the start inside.

[Root @ localhost mysql] # / sbin / chkconfig - del mysql


The UNIT TEST unit test in Visual Studio


TDD (Test-Driven Development) test-driven development is a core agile development practices and technologies, is also a kind of design methodology. The principle of TDD is the first writing unit test cases before development function code, code, test code to determine what you need to write the product code. Unit testing is the most basic test steps. Located in the very bottom of the V-model of the entire product development process.
Approximately as in various development processes RA & PSD is complete without the underlying foundation, UAT program to complete the following steps. UT as the bottom and CODING equally important step is the basis of each CODER must master.

RA( Requirement Analysis)  &
PSD ( Productive Specification Design)              UAT( User Acceptance Testing)
                          \                                                              /
                            \                                                          /
                              \                                                      /
FSD(Functional Specification Design)             SIT(System Integration Testing)
                                \                                                 /
                                  \                                             /
                                    \                                         /
                           Construction(Coding)         UT(Unit Tesing)
                                         \                              /
                                            \                         /
                                                \                   /
                                                  \              /
                                                     \         /
                                                        \    /
                                                          \/

Create a new console project (Console Application) in the small amount of code to write, often by New Web Site Project (Web Form), in which typing test code to test. Once the amount of code and logical relations are complicated, this test will be difficult to carry out, and do not have the maintainability. And many functional code can not be completely divorced from the entire project. Such as a class library in a web project, write some MODEL layer To test the method, in order to verify the correctness of the method may have reference to the project model, interface, and library functions. Wait until the can by the compiler, but found you must be logged in to call the method or your directory (Directory) does not have the access rights, so he had to modify the Authorization configuration or add a login method. So layers down your test project involving almost every corner of the test program without a high degree of reusability.
Here we VS2012 example, look at how unit tests in Visual Studio.


1, right-click the solution (Solution) to pop up the context menu (Context). Select Add (Add) - a new project (New Project), in a given template, select Visual C # - Test-Unit Test Project As.

2. Template As.
3.The test method (here the default TestMethod1, general amended as the need to test the method name + Test) add the need to test their own code. But before this, we must first reference to the need to test the project as well as the need to use the class library. In this example, I quote Microsoft MVC4.0 framework, as well as the need to test the project Controller. I test the the Controller ProductCategories () method. The method returns a The ActionResult. 3 lines of test code, the first line to a instantiate the controller, the second line calls the controller method. If only the 2 line test is passed, then the code without problems of syntax, and other parts work together. The third row with an assertion to detect method returns the result is empty. Here I assert that it is not empty, an error if it is empty, the test will fail.
4,The test code is written, you can click on the the above menu Test-Run-AllTests, to carry out the test.。
After the test is completed. Below will produce a list of results. Red for failed TestCase. If you want to be the DEBUG Right-click the red TestCase, select Debug selected Tests. Modifications, can also right-click you want to re-test TestCase, select Run the Selected Tests.