parent
124a499257
commit
fd20997b24
|
@ -11,7 +11,6 @@ public class GenerateDevices {
|
||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
Configuration conf = HBaseConfiguration.create();
|
Configuration conf = HBaseConfiguration.create();
|
||||||
try {
|
try {
|
||||||
System.out.println(conf.get("hbase.zookeeper.quorum"));
|
System.out.println(conf.get("hbase.zookeeper.quorum"));
|
||||||
|
|
|
@ -71,18 +71,6 @@ public class ScriptController extends BaseController {
|
||||||
this.portPoolService = portPoolService;
|
this.portPoolService = portPoolService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/test/{port}", method = RequestMethod.GET)
|
|
||||||
@ResponseBody
|
|
||||||
public OperateScriptServerResponseModel testProxyConnection(int port) {
|
|
||||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
|
||||||
return buildReponseModel(false,
|
|
||||||
"has no power for recording script!!!", "", -1, null, null,
|
|
||||||
null);
|
|
||||||
}
|
|
||||||
// TODO:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/startScriptRecordServer", method = {
|
@RequestMapping(value = "/startScriptRecordServer", method = {
|
||||||
RequestMethod.GET, RequestMethod.POST })
|
RequestMethod.GET, RequestMethod.POST })
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
|
|
@ -8,7 +8,6 @@ public class MonitorRepository extends AbstractRepositoty {
|
||||||
protected void guardOtherUniqueConditionForEntity(
|
protected void guardOtherUniqueConditionForEntity(
|
||||||
String uniquePropertyName, String value)
|
String uniquePropertyName, String value)
|
||||||
throws EntityUniqueAlReadyExistException {
|
throws EntityUniqueAlReadyExistException {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,6 @@ public class ExecutionOverTask extends TimerTask {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// RunningScriptInterface runningScript = this.getRunningScript()
|
|
||||||
// .doForComplete();
|
|
||||||
this.getRunningScript().doForComplete();
|
this.getRunningScript().doForComplete();
|
||||||
TestPlanScript testPlanScript = (TestPlanScript) this
|
TestPlanScript testPlanScript = (TestPlanScript) this
|
||||||
.getRunningScript();
|
.getRunningScript();
|
||||||
|
|
|
@ -8,11 +8,9 @@ import org.bench4q.master.infrastructure.highavailable.AgentRunBlotter;
|
||||||
public class StopAgentFault implements FaultTolerance {
|
public class StopAgentFault implements FaultTolerance {
|
||||||
|
|
||||||
public StopAgentFault(Agent agent, UUID runId) {
|
public StopAgentFault(Agent agent, UUID runId) {
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public StopAgentFault(AgentRunBlotter buildAgentRunBlotter) {
|
public StopAgentFault(AgentRunBlotter buildAgentRunBlotter) {
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doTolerance() {
|
public void doTolerance() {
|
||||||
|
|
|
@ -53,7 +53,6 @@ public class Test_PluginService extends Test_PluginHelper {
|
||||||
assertFalse(this.getPluginService().addPlugin(pluginContent));
|
assertFalse(this.getPluginService().addPlugin(pluginContent));
|
||||||
assertTure(this.getPluginService().deletePlugin(pluginName));
|
assertTure(this.getPluginService().deletePlugin(pluginName));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,10 +70,12 @@ public class Test_PluginService extends Test_PluginHelper {
|
||||||
@Test
|
@Test
|
||||||
public void test_loadBehaviors() {
|
public void test_loadBehaviors() {
|
||||||
addPluginByString();
|
addPluginByString();
|
||||||
assertEquals(2,this.getPluginService().loadBehaviorInfoModels(pluginName).size());
|
assertEquals(2,
|
||||||
|
this.getPluginService().loadBehaviorInfoModels(pluginName)
|
||||||
|
.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertTure(boolean deletePlugin) {
|
private void assertTure(boolean deletePlugin) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,28 @@
|
||||||
package org.bench4q.monitor.model;
|
package org.bench4q.monitor.model;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
@XmlRootElement(name = "PhisicalDisk")
|
@XmlRootElement(name = "PhisicalDisk")
|
||||||
public class PhysicalDiskModel {
|
public class PhysicalDiskModel {
|
||||||
private List<PhysicalDiskModelChild> physicalDiskModelList;
|
private List<PhysicalDiskModelChild> physicalDiskModelList;
|
||||||
|
|
||||||
@XmlElementWrapper
|
@XmlElementWrapper
|
||||||
@XmlElement(name = "Instances", type = PhysicalDiskModelChild.class)
|
@XmlElement(name = "Instances", type = PhysicalDiskModelChild.class)
|
||||||
public List<PhysicalDiskModelChild> getPhysicalDiskModelList() {
|
public List<PhysicalDiskModelChild> getPhysicalDiskModelList() {
|
||||||
return physicalDiskModelList;
|
return physicalDiskModelList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPhysicalDiskModelList(
|
public void setPhysicalDiskModelList(
|
||||||
List<PhysicalDiskModelChild> physicalDiskModelList) {
|
List<PhysicalDiskModelChild> physicalDiskModelList) {
|
||||||
this.physicalDiskModelList = physicalDiskModelList;
|
this.physicalDiskModelList = physicalDiskModelList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicalDiskModel() {
|
public PhysicalDiskModel() {
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
this.physicalDiskModelList = new ArrayList<PhysicalDiskModelChild>();
|
this.physicalDiskModelList = new ArrayList<PhysicalDiskModelChild>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ public class SystemModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTotalProceesorTimePercent(double totalProceesorTimePercent2) {
|
public void setTotalProceesorTimePercent(double totalProceesorTimePercent2) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
this.totalProceesorTimePercent = totalProceesorTimePercent2;
|
this.totalProceesorTimePercent = totalProceesorTimePercent2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.bench4q.monitor.model.MemoryModel;
|
||||||
public class MemoryMonitor extends LinuxFileRead {
|
public class MemoryMonitor extends LinuxFileRead {
|
||||||
// /proc/meminfo
|
// /proc/meminfo
|
||||||
private double cacheBytes = 0;
|
private double cacheBytes = 0;
|
||||||
|
|
||||||
public double getCacheBytes() {
|
public double getCacheBytes() {
|
||||||
return cacheBytes;
|
return cacheBytes;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,6 @@ public class MemoryMonitor extends LinuxFileRead {
|
||||||
private double pagesOutputPerSecond = 0;
|
private double pagesOutputPerSecond = 0;
|
||||||
|
|
||||||
public MemoryMonitor() throws FileNotFoundException {
|
public MemoryMonitor() throws FileNotFoundException {
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
super("/proc/meminfo");
|
super("/proc/meminfo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,8 @@ public class MemoryMonitor extends LinuxFileRead {
|
||||||
Runtime rt = Runtime.getRuntime();
|
Runtime rt = Runtime.getRuntime();
|
||||||
String time = new Integer(idleTime / 1000).toString();
|
String time = new Integer(idleTime / 1000).toString();
|
||||||
Process p = rt.exec("vmstat " + time + " 2");
|
Process p = rt.exec("vmstat " + time + " 2");
|
||||||
BufferedReader in=new BufferedReader(new InputStreamReader(p.getInputStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(
|
||||||
|
p.getInputStream()));
|
||||||
StringTokenizer token;
|
StringTokenizer token;
|
||||||
String str = in.readLine();
|
String str = in.readLine();
|
||||||
str = in.readLine();
|
str = in.readLine();
|
||||||
|
@ -85,10 +86,14 @@ public class MemoryMonitor extends LinuxFileRead {
|
||||||
token = new StringTokenizer(str);
|
token = new StringTokenizer(str);
|
||||||
for (int i = 0;; i++) {
|
for (int i = 0;; i++) {
|
||||||
str = token.nextToken().toLowerCase();
|
str = token.nextToken().toLowerCase();
|
||||||
if(str.contains("si")) {si=i;}
|
if (str.contains("si")) {
|
||||||
if(str.contains("so")) {so=i;}
|
si = i;
|
||||||
if(!(token.hasMoreTokens())) break;
|
}
|
||||||
|
if (str.contains("so")) {
|
||||||
|
so = i;
|
||||||
|
}
|
||||||
|
if (!(token.hasMoreTokens()))
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
str = in.readLine();
|
str = in.readLine();
|
||||||
|
@ -96,16 +101,18 @@ public class MemoryMonitor extends LinuxFileRead {
|
||||||
token = new StringTokenizer(str);
|
token = new StringTokenizer(str);
|
||||||
for (int i = 0;; i++) {
|
for (int i = 0;; i++) {
|
||||||
str = token.nextToken().toLowerCase();
|
str = token.nextToken().toLowerCase();
|
||||||
if(i==si) pagesInputPerSecond=Integer.parseInt(str);
|
if (i == si)
|
||||||
if(i==so) pagesOutputPerSecond=Integer.parseInt(str);
|
pagesInputPerSecond = Integer.parseInt(str);
|
||||||
if(!(token.hasMoreTokens())) break;
|
if (i == so)
|
||||||
|
pagesOutputPerSecond = Integer.parseInt(str);
|
||||||
|
if (!(token.hasMoreTokens()))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pagesPerSecond = pagesInputPerSecond + pagesOutputPerSecond;
|
pagesPerSecond = pagesInputPerSecond + pagesOutputPerSecond;
|
||||||
|
|
||||||
BufferedReader br = this.getBufferedReader();
|
BufferedReader br = this.getBufferedReader();
|
||||||
|
|
||||||
|
|
||||||
while ((str = br.readLine()) != null) {
|
while ((str = br.readLine()) != null) {
|
||||||
token = new StringTokenizer(str);
|
token = new StringTokenizer(str);
|
||||||
if (!token.hasMoreTokens())
|
if (!token.hasMoreTokens())
|
||||||
|
@ -132,8 +139,3 @@ public class MemoryMonitor extends LinuxFileRead {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ public class NetworkInterfaceMonitor extends LinuxFileRead {
|
||||||
// /proc/net/dev
|
// /proc/net/dev
|
||||||
public NetworkInterfaceMonitor() throws FileNotFoundException {
|
public NetworkInterfaceMonitor() throws FileNotFoundException {
|
||||||
super("/proc/net/dev");
|
super("/proc/net/dev");
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
bytesTotalPerSecond = new HashMap<String, Double>();
|
bytesTotalPerSecond = new HashMap<String, Double>();
|
||||||
bytesReceivedPerSecond = new HashMap<String, Double>();
|
bytesReceivedPerSecond = new HashMap<String, Double>();
|
||||||
bytesSentPerSecond = new HashMap<String, Double>();
|
bytesSentPerSecond = new HashMap<String, Double>();
|
||||||
|
|
|
@ -19,7 +19,6 @@ public class SystemMonitor extends LinuxFileRead {
|
||||||
|
|
||||||
public SystemMonitor() throws FileNotFoundException {
|
public SystemMonitor() throws FileNotFoundException {
|
||||||
super("/proc/stat");
|
super("/proc/stat");
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.bench4q.monitor.performance.linux.ProcessorMonitor;
|
||||||
public class ProcessorServiceLinux {
|
public class ProcessorServiceLinux {
|
||||||
|
|
||||||
public ProcessorServiceLinux() throws FileNotFoundException {
|
public ProcessorServiceLinux() throws FileNotFoundException {
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
this.processorMonitor = new ProcessorMonitor();
|
this.processorMonitor = new ProcessorMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
public class ProcessorServiceWindows {
|
public class ProcessorServiceWindows {
|
||||||
public ProcessorServiceWindows() {
|
public ProcessorServiceWindows() {
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
this.processorMonitor = new ProcessorMonitor();
|
this.processorMonitor = new ProcessorMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class LogicalDiskTest {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,7 @@ public class MemoryTest {
|
||||||
* .extractLogicalDiskModel(httpResponse.getContent());
|
* .extractLogicalDiskModel(httpResponse.getContent());
|
||||||
*
|
*
|
||||||
* memoryTest.result(memoryModel); } catch (IOException e) {
|
* memoryTest.result(memoryModel); } catch (IOException e) {
|
||||||
* e.printStackTrace(); } catch (JAXBException e) { // TODO Auto-generated
|
* e.printStackTrace(); } catch (JAXBException e) { e.printStackTrace(); }
|
||||||
* catch block e.printStackTrace(); }
|
|
||||||
*
|
*
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class ProcessorTest {
|
||||||
public HttpRequester getHttpRequester() {
|
public HttpRequester getHttpRequester() {
|
||||||
return httpRequester;
|
return httpRequester;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setHttpRequester(HttpRequester httpRequester) {
|
public void setHttpRequester(HttpRequester httpRequester) {
|
||||||
this.httpRequester = httpRequester;
|
this.httpRequester = httpRequester;
|
||||||
|
@ -33,9 +34,11 @@ public class ProcessorTest {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
String urlString = "http://localhost:5556/Monitor/Processor";
|
String urlString = "http://localhost:5556/Monitor/Processor";
|
||||||
atx = new ClassPathXmlApplicationContext("org/Bench4Q/Monitor/Config/application-context.xml");
|
atx = new ClassPathXmlApplicationContext(
|
||||||
|
"org/Bench4Q/Monitor/Config/application-context.xml");
|
||||||
|
|
||||||
ProcessorTest ProcessorTest =(ProcessorTest)atx.getBean("processorTest");
|
ProcessorTest ProcessorTest = (ProcessorTest) atx
|
||||||
|
.getBean("processorTest");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -49,7 +52,6 @@ public class ProcessorTest {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,19 +59,20 @@ public class ProcessorTest {
|
||||||
|
|
||||||
public void result(ProcessorModel ProcessorModel) {
|
public void result(ProcessorModel ProcessorModel) {
|
||||||
|
|
||||||
Iterator<ProcessorModelChild> iterator=ProcessorModel.getProcessorModelList().iterator();
|
Iterator<ProcessorModelChild> iterator = ProcessorModel
|
||||||
|
.getProcessorModelList().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ProcessorModelChild processorModelChild = iterator.next();
|
ProcessorModelChild processorModelChild = iterator.next();
|
||||||
System.out.println("instance" + processorModelChild.getInstance());
|
System.out.println("instance" + processorModelChild.getInstance());
|
||||||
|
|
||||||
System.out.println("privilegedTimePercent"+processorModelChild.getPrivilegedTimePercent());
|
System.out.println("privilegedTimePercent"
|
||||||
System.out.println("processorTimePercent"+processorModelChild.getProcessorTimePercent());
|
+ processorModelChild.getPrivilegedTimePercent());
|
||||||
System.out.println("userTimePercent"+processorModelChild.getUserTimePercent());
|
System.out.println("processorTimePercent"
|
||||||
|
+ processorModelChild.getProcessorTimePercent());
|
||||||
|
System.out.println("userTimePercent"
|
||||||
|
+ processorModelChild.getUserTimePercent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProcessorModel extractLogicalDiskModel(String content)
|
public ProcessorModel extractLogicalDiskModel(String content)
|
||||||
|
@ -83,5 +86,4 @@ public class ProcessorTest {
|
||||||
return resultModel;
|
return resultModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,7 @@ import org.springframework.stereotype.Component;
|
||||||
public class HttpRequester {
|
public class HttpRequester {
|
||||||
private String defaultContentEncoding;
|
private String defaultContentEncoding;
|
||||||
|
|
||||||
public HttpRequester()
|
public HttpRequester() {
|
||||||
{
|
|
||||||
this.setDefaultContentEncoding(Charset.defaultCharset().name());
|
this.setDefaultContentEncoding(Charset.defaultCharset().name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +34,8 @@ public class HttpRequester {
|
||||||
return this.send(urlString, "POST", params, "", null);
|
return this.send(urlString, "POST", params, "", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpResponse sendPostXml(String urlString, String contentString) throws IOException
|
public HttpResponse sendPostXml(String urlString, String contentString)
|
||||||
{
|
throws IOException {
|
||||||
HashMap<String, String> hashMap = new HashMap<String, String>();
|
HashMap<String, String> hashMap = new HashMap<String, String>();
|
||||||
hashMap.put("Content-Type", "application/xml");
|
hashMap.put("Content-Type", "application/xml");
|
||||||
return this.send(urlString, "POST", null, contentString, hashMap);
|
return this.send(urlString, "POST", null, contentString, hashMap);
|
||||||
|
@ -48,8 +47,8 @@ public class HttpRequester {
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpResponse send(String urlString, String method,
|
private HttpResponse send(String urlString, String method,
|
||||||
Map<String, String> parameters, String Content, Map<String, String> propertys)
|
Map<String, String> parameters, String Content,
|
||||||
throws IOException {
|
Map<String, String> propertys) throws IOException {
|
||||||
HttpURLConnection urlConnection = null;
|
HttpURLConnection urlConnection = null;
|
||||||
|
|
||||||
if (method.equalsIgnoreCase("GET") && parameters != null) {
|
if (method.equalsIgnoreCase("GET") && parameters != null) {
|
||||||
|
@ -92,8 +91,7 @@ public class HttpRequester {
|
||||||
urlConnection.getOutputStream().write(param.toString().getBytes());
|
urlConnection.getOutputStream().write(param.toString().getBytes());
|
||||||
urlConnection.getOutputStream().flush();
|
urlConnection.getOutputStream().flush();
|
||||||
urlConnection.getOutputStream().close();
|
urlConnection.getOutputStream().close();
|
||||||
}
|
} else if (method.equalsIgnoreCase("POST") && !Content.isEmpty()) {
|
||||||
else if (method.equalsIgnoreCase("POST") && !Content.isEmpty()) {
|
|
||||||
urlConnection.getOutputStream().write(Content.getBytes());
|
urlConnection.getOutputStream().write(Content.getBytes());
|
||||||
urlConnection.getOutputStream().flush();
|
urlConnection.getOutputStream().flush();
|
||||||
urlConnection.getOutputStream().close();
|
urlConnection.getOutputStream().close();
|
||||||
|
@ -104,7 +102,6 @@ public class HttpRequester {
|
||||||
|
|
||||||
private HttpResponse makeContent(String urlString,
|
private HttpResponse makeContent(String urlString,
|
||||||
HttpURLConnection urlConnection) {
|
HttpURLConnection urlConnection) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
HttpResponse httpResponser = new HttpResponse();
|
HttpResponse httpResponser = new HttpResponse();
|
||||||
try {
|
try {
|
||||||
InputStream in = urlConnection.getInputStream();
|
InputStream in = urlConnection.getInputStream();
|
||||||
|
|
|
@ -28,7 +28,6 @@ public class ProcessResponseModel implements MonitorResultBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(SampleModel model) {
|
public void add(SampleModel model) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
if (model instanceof ProcessModel) {
|
if (model instanceof ProcessModel) {
|
||||||
this.getProcessModels().add((ProcessModel) model);
|
this.getProcessModels().add((ProcessModel) model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@ public class AuthorizeActionController extends BaseControllerService {
|
||||||
"invalidate httpresponse:io exception", this.baseUrl
|
"invalidate httpresponse:io exception", this.baseUrl
|
||||||
+ "/register");
|
+ "/register");
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
logger.info(e, e.fillInStackTrace());
|
logger.info(e, e.fillInStackTrace());
|
||||||
throw new CustomGenericException("1",
|
throw new CustomGenericException("1",
|
||||||
"invalidate httpresponse:JAXBException", this.baseUrl
|
"invalidate httpresponse:JAXBException", this.baseUrl
|
||||||
|
@ -97,8 +96,7 @@ public class AuthorizeActionController extends BaseControllerService {
|
||||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(url,
|
HttpResponse httpResponse = this.getHttpRequester().sendGet(url,
|
||||||
params, null);
|
params, null);
|
||||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||||
throw new CustomGenericException("1",
|
throw new CustomGenericException("1", "network error:",
|
||||||
"network error:",
|
|
||||||
"AuthorizeActionController_authorize");
|
"AuthorizeActionController_authorize");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,18 @@ import org.springframework.web.bind.annotation.SessionAttributes;
|
||||||
@Controller
|
@Controller
|
||||||
@SessionAttributes({ "accessToken", "testPlanTaskList" })
|
@SessionAttributes({ "accessToken", "testPlanTaskList" })
|
||||||
public class TestPlanHistoryResult extends BaseControllerService {
|
public class TestPlanHistoryResult extends BaseControllerService {
|
||||||
private String baseUrl = CommunicateWithMaster.getMasterAddress()+"testPlan";
|
private String baseUrl = CommunicateWithMaster.getMasterAddress()
|
||||||
|
+ "testPlan";
|
||||||
private TestPlanService testPlanService;
|
private TestPlanService testPlanService;
|
||||||
private CommunicateWithMaster communicateWithMaster;
|
private CommunicateWithMaster communicateWithMaster;
|
||||||
|
|
||||||
private CommunicateWithMaster getCommunicateWithMaster() {
|
private CommunicateWithMaster getCommunicateWithMaster() {
|
||||||
return communicateWithMaster;
|
return communicateWithMaster;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private void setCommunicateWithMaster(CommunicateWithMaster communicateWithMaster) {
|
private void setCommunicateWithMaster(
|
||||||
|
CommunicateWithMaster communicateWithMaster) {
|
||||||
this.communicateWithMaster = communicateWithMaster;
|
this.communicateWithMaster = communicateWithMaster;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +66,7 @@ public class TestPlanHistoryResult extends BaseControllerService {
|
||||||
@RequestMapping(value = "loadTestPlans", method = { RequestMethod.GET,
|
@RequestMapping(value = "loadTestPlans", method = { RequestMethod.GET,
|
||||||
RequestMethod.POST })
|
RequestMethod.POST })
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public BaseResponseModel
|
public BaseResponseModel loadTestPlans(
|
||||||
loadTestPlans(
|
|
||||||
@ModelAttribute("accessToken") String accessToken)
|
@ModelAttribute("accessToken") String accessToken)
|
||||||
throws CustomGenericException {
|
throws CustomGenericException {
|
||||||
String caller = "TestPlanHistoryResult:loadTestPlans";
|
String caller = "TestPlanHistoryResult:loadTestPlans";
|
||||||
|
@ -74,10 +77,12 @@ public class TestPlanHistoryResult extends BaseControllerService {
|
||||||
.getResponseModel(accessToken, url,
|
.getResponseModel(accessToken, url,
|
||||||
TestPlanResponseModel.class, null, caller);
|
TestPlanResponseModel.class, null, caller);
|
||||||
if (testPlanResponseModel.isSuccess()) {
|
if (testPlanResponseModel.isSuccess()) {
|
||||||
return new BaseResponseModel(true,buildTestPlanListModel(testPlanResponseModel
|
return new BaseResponseModel(true,
|
||||||
|
buildTestPlanListModel(testPlanResponseModel
|
||||||
.getTestPlanDBModels()));
|
.getTestPlanDBModels()));
|
||||||
} else {
|
} else {
|
||||||
return new BaseResponseModel(false,testPlanResponseModel.getFailCause());
|
return new BaseResponseModel(false,
|
||||||
|
testPlanResponseModel.getFailCause());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,17 +105,21 @@ public class TestPlanHistoryResult extends BaseControllerService {
|
||||||
this.makeAccessTockenMap(accessToken));
|
this.makeAccessTockenMap(accessToken));
|
||||||
if (httpResponse == null) {
|
if (httpResponse == null) {
|
||||||
|
|
||||||
throw new CustomGenericException("1", "invalidate http response", caller);
|
throw new CustomGenericException("1",
|
||||||
|
"invalidate http response", caller);
|
||||||
}
|
}
|
||||||
if (httpResponse.getContent().isEmpty())
|
if (httpResponse.getContent().isEmpty())
|
||||||
throw new CustomGenericException("5", "report data empty", "");
|
throw new CustomGenericException("5", "report data empty", "");
|
||||||
/*if(httpResponse.getContent().isEmpty())
|
/*
|
||||||
throw new CustomGenericException(errCode, errMsg, source)*/
|
* if(httpResponse.getContent().isEmpty()) throw new
|
||||||
|
* CustomGenericException(errCode, errMsg, source)
|
||||||
|
*/
|
||||||
if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) {
|
if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) {
|
||||||
ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange
|
ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange
|
||||||
.fromXml(ErrorResponseModel.class,
|
.fromXml(ErrorResponseModel.class,
|
||||||
httpResponse.getContent());
|
httpResponse.getContent());
|
||||||
this.getCommunicateWithMaster().logException(errorResponseModel);
|
this.getCommunicateWithMaster()
|
||||||
|
.logException(errorResponseModel);
|
||||||
throw new CustomGenericException("2", FAIL_WITH_EXCEPTION + "_"
|
throw new CustomGenericException("2", FAIL_WITH_EXCEPTION + "_"
|
||||||
+ errorResponseModel.getMessage(), caller + "_"
|
+ errorResponseModel.getMessage(), caller + "_"
|
||||||
+ errorResponseModel.getResource());
|
+ errorResponseModel.getResource());
|
||||||
|
@ -127,10 +136,11 @@ public class TestPlanHistoryResult extends BaseControllerService {
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
return new BaseResponseModel(true);
|
return new BaseResponseModel(true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new CustomGenericException("1", "exception:io exception", caller);
|
throw new CustomGenericException("1", "exception:io exception",
|
||||||
|
caller);
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
// TODO Auto-generated catch block
|
throw new CustomGenericException("1", "exception:io exception",
|
||||||
throw new CustomGenericException("1", "exception:io exception", caller);
|
caller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +165,8 @@ public class TestPlanHistoryResult extends BaseControllerService {
|
||||||
return new BaseResponseModel(true);
|
return new BaseResponseModel(true);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return new BaseResponseModel(false,testPlanResponseModel.getFailCause());
|
return new BaseResponseModel(false,
|
||||||
|
testPlanResponseModel.getFailCause());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ public class TestPlanService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestPlanService() {
|
public TestPlanService() {
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultInfoModel getScriptBriefStatusResultInfo() {
|
public ResultInfoModel getScriptBriefStatusResultInfo() {
|
||||||
|
@ -196,10 +195,10 @@ public class TestPlanService extends BaseService {
|
||||||
return behaviorStatusCodeResultModels;
|
return behaviorStatusCodeResultModels;
|
||||||
if (scriptBehaviorsBriefModel.getTestBehaviorsBriefModel() == null)
|
if (scriptBehaviorsBriefModel.getTestBehaviorsBriefModel() == null)
|
||||||
return behaviorStatusCodeResultModels;
|
return behaviorStatusCodeResultModels;
|
||||||
if(scriptBehaviorsBriefModel
|
if (scriptBehaviorsBriefModel.getTestBehaviorsBriefModel()
|
||||||
.getTestBehaviorsBriefModel().getBehaviorBriefModels()==null)
|
.getBehaviorBriefModels() == null)
|
||||||
scriptBehaviorsBriefModel
|
scriptBehaviorsBriefModel.getTestBehaviorsBriefModel()
|
||||||
.getTestBehaviorsBriefModel().getBehaviorBriefModels();
|
.getBehaviorBriefModels();
|
||||||
for (BehaviorBriefModel behaviorBriefModel : scriptBehaviorsBriefModel
|
for (BehaviorBriefModel behaviorBriefModel : scriptBehaviorsBriefModel
|
||||||
.getTestBehaviorsBriefModel().getBehaviorBriefModels()) {
|
.getTestBehaviorsBriefModel().getBehaviorBriefModels()) {
|
||||||
|
|
||||||
|
|
|
@ -33,14 +33,12 @@ public class AuthorizeActionControllerTest {
|
||||||
this.user.setUserName("www");
|
this.user.setUserName("www");
|
||||||
this.user.setPassword("www");
|
this.user.setPassword("www");
|
||||||
|
|
||||||
Assert.assertTrue(this.authorizeActionController.login(user,
|
Assert.assertTrue(this.authorizeActionController.login(user, modelMap)
|
||||||
modelMap)
|
|
||||||
.isSuccess());
|
.isSuccess());
|
||||||
|
|
||||||
this.user.setUserName("www");
|
this.user.setUserName("www");
|
||||||
this.user.setPassword("123");
|
this.user.setPassword("123");
|
||||||
Assert.assertFalse(this.authorizeActionController.login(user,
|
Assert.assertFalse(this.authorizeActionController.login(user, modelMap)
|
||||||
modelMap)
|
|
||||||
.isSuccess());
|
.isSuccess());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -59,7 +57,6 @@ public class AuthorizeActionControllerTest {
|
||||||
Assert.assertFalse(this.authorizeActionController.adminLogin(null,
|
Assert.assertFalse(this.authorizeActionController.adminLogin(null,
|
||||||
modelMap).isSuccess());
|
modelMap).isSuccess());
|
||||||
} catch (CustomGenericException e) {
|
} catch (CustomGenericException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,12 +178,10 @@ public class TestScriptResultTest extends LoginHelper {
|
||||||
.queryTestPlanResultModel(testPlanRunId, accessToken)
|
.queryTestPlanResultModel(testPlanRunId, accessToken)
|
||||||
.getScriptIds().get(0).toString();
|
.getScriptIds().get(0).toString();
|
||||||
} catch (CustomGenericException e) {
|
} catch (CustomGenericException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
logger.info(ExceptionLog.getStackTrace(e));
|
logger.info(ExceptionLog.getStackTrace(e));
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
logger.info(ExceptionLog.getStackTrace(e));
|
logger.info(ExceptionLog.getStackTrace(e));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue