Examples of ServiceReport


Examples of com.dianping.cat.home.service.entity.ServiceReport

public class ServiceReportMergerTest {
  @Test
  public void testServiceReportMerge() throws Exception {
    String oldXml = Files.forIO().readFrom(getClass().getResourceAsStream("ServiceReportOld.xml"), "utf-8");
    String newXml = Files.forIO().readFrom(getClass().getResourceAsStream("ServiceReportNew.xml"), "utf-8");
    ServiceReport reportOld = DefaultSaxParser.parse(oldXml);
    ServiceReport reportNew = DefaultSaxParser.parse(newXml);
    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("ServiceReportResult.xml"),
          "utf-8");
    ServiceReportMerger merger = new ServiceReportMerger(new ServiceReport(reportOld.getDomain()));

    reportOld.accept(merger);
    reportNew.accept(merger);

    Assert.assertEquals("Check the merge result!", expected.replace("\r", ""), merger.getServiceReport()
          .toString().replace("\r", ""));
    Assert.assertEquals("Source report is changed!", newXml.replace("\r", ""), reportNew.toString().replace("\r", ""));
  }
View Full Code Here

Examples of com.dianping.cat.home.service.entity.ServiceReport

  Map<String, Domain> stat = new HashMap<String, Domain>();

  @Override
  public boolean buildDailyTask(String name, String domain, Date period) {
    ServiceReport serviceReport = queryHourlyReportsByDuration(name, domain, period, TaskHelper.tomorrowZero(period));
    DailyReport report = new DailyReport();

    report.setContent("");
    report.setCreationDate(new Date());
    report.setDomain(domain);
View Full Code Here

Examples of com.dianping.cat.home.service.entity.ServiceReport

    return m_reportService.insertDailyReport(report, binaryContent);
  }

  @Override
  public boolean buildHourlyTask(String name, String domain, Date start) {
    ServiceReport serviceReport = new ServiceReport(Constants.CAT);
    Date end = new Date(start.getTime() + TimeHelper.ONE_HOUR);
    Set<String> domains = m_reportService.queryAllDomainNames(start, end, CrossAnalyzer.ID);

    for (String domainName : domains) {
      CrossReport crossReport = m_reportService.queryCrossReport(domainName, start, end);
      ProjectInfo projectInfo = new ProjectInfo(TimeHelper.ONE_HOUR);

      projectInfo.setHostinfoService(m_hostinfoService);
      projectInfo.setClientIp(Constants.ALL);
      projectInfo.visitCrossReport(crossReport);
      Collection<TypeDetailInfo> callInfos = projectInfo.getCallProjectsInfo();

      for (TypeDetailInfo typeInfo : callInfos) {
        if (!validataService(typeInfo)) {
          merge(serviceReport.findOrCreateDomain(typeInfo.getProjectName()), typeInfo);
        }
      }
    }
    HourlyReport report = new HourlyReport();
View Full Code Here

Examples of com.dianping.cat.home.service.entity.ServiceReport

    return m_reportService.insertHourlyReport(report, binaryContent);
  }

  @Override
  public boolean buildMonthlyTask(String name, String domain, Date period) {
    ServiceReport serviceReport = queryDailyReportsByDuration(domain, period, TaskHelper.nextMonthStart(period));
    MonthlyReport report = new MonthlyReport();

    report.setContent("");
    report.setCreationDate(new Date());
    report.setDomain(domain);
View Full Code Here

Examples of com.dianping.cat.home.service.entity.ServiceReport

    return m_reportService.insertMonthlyReport(report, binaryContent);
  }

  @Override
  public boolean buildWeeklyTask(String name, String domain, Date period) {
    ServiceReport serviceReport = queryDailyReportsByDuration(domain, period, new Date(period.getTime()
          + TimeHelper.ONE_WEEK));
    WeeklyReport report = new WeeklyReport();

    report.setContent("");
    report.setCreationDate(new Date());
View Full Code Here

Examples of com.dianping.cat.home.service.entity.ServiceReport

  }

  private ServiceReport queryDailyReportsByDuration(String domain, Date start, Date end) {
    long startTime = start.getTime();
    long endTime = end.getTime();
    ServiceReportMerger merger = new ServiceReportMerger(new ServiceReport(domain));

    for (; startTime < endTime; startTime += TimeHelper.ONE_DAY) {
      try {
        ServiceReport reportModel = m_reportService.queryServiceReport(domain, new Date(startTime), new Date(
              startTime + TimeHelper.ONE_DAY));
        reportModel.accept(merger);
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    ServiceReport serviceReport = merger.getServiceReport();

    serviceReport.setStartTime(start);
    serviceReport.setEndTime(end);
    return serviceReport;
  }
View Full Code Here

Examples of com.dianping.cat.home.service.entity.ServiceReport

  }

  private ServiceReport queryHourlyReportsByDuration(String name, String domain, Date start, Date end) {
    long startTime = start.getTime();
    long endTime = end.getTime();
    ServiceReportMerger merger = new ServiceReportMerger(new ServiceReport(domain));

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {
      Date date = new Date(startTime);
      ServiceReport reportModel = m_reportService.queryServiceReport(domain, date, new Date(date.getTime()
            + TimeHelper.ONE_HOUR));

      reportModel.accept(merger);
    }

    ServiceReport serviceReport = merger.getServiceReport();

    serviceReport.setStartTime(start);
    serviceReport.setEndTime(end);
    return serviceReport;
  }
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

        CreateViewResult view = null;
       
        try {
            view = viewService.createView(digitalObjects, null);
           
            ServiceReport report = view.getReport();
           
            if (report.getStatus() != ServiceReport.Status.SUCCESS ) {
                sessionIdentifier = "";
                return false;
            }
           
            sessionIdentifier = view.getViewURL().toExternalForm();
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

     */
    public CharacteriseResult characterise(DigitalObject digitalObject, List<Parameter> parameters) {
        log.info("Start...");
        // Set up property list:
        List<Property> measured = new ArrayList<Property>();
        ServiceReport sr = new ServiceReport(Type.INFO, Status.SUCCESS, "Nothing checked");
       
        // Attempt to measure size:
        measured.add( new Property( makePropertyURI(MIME_PROP_URI), MIME_PROP_URI, ""+DigitalObjectUtils.getContentSize( digitalObject ) ));

        return new CharacteriseResult(measured, sr);
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

        try {
            type = ftr.getMIMEType(dob.getPermanentUri().toURL());
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        ServiceReport rep = new ServiceReport(Type.INFO, Status.SUCCESS, "Nothing checked");

        List<URI> types = new ArrayList<URI>();
        types.add(FormatRegistryFactory.getFormatRegistry().createMimeUri(type));

        return new IdentifyResult(types, IdentifyResult.Method.EXTENSION, rep);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.