如何配置Cactus

基于Simulink的永磁同步电机(PMSM)无位置传感器矢量控制与龙伯格观测器设计​ 本文介绍了基于Simulink的永磁同步电机(PMSM)无位置传感器矢量控制方法,重点讲解了龙伯格观测器的设计与实现。主要内容包括:1)系统架构与数学推导,通过静止坐标系状态方程和极点配置构建观测器;2)Simulink建模步骤,从电机模型搭建到观测器核心代码实现;3)仿真结果对比分析,显示龙伯格观测器相比滑模观测器具有更好的平滑性和抗噪能力;4)工程部署建议,包括参数在线辨识、低速补偿策略和代码生成优化。该方法实现了全速域无感运行,稳态转速误差小于1%,为低成本高可靠性电机控制提供了有效解决方案。 阅读详情

Cactus Configuration

1.Client side configuration

The following table lists the properties that can be defined on Cactus client side:

Property Namecactus.contextURL
RequiredYes
DescriptionWebapp Context under which the application to test runs.
Examplecactus.contextURL = http://localhost:8080/test

Property Namecactus.servletRedirectorName
RequiredNo. Defaults to "ServletRedirector".
DescriptionName of the Cactus Servlet Redirector as it is mapped on the server side in web.xml (see below). This property is needed only if your test classes are extending ServletTestCase (see the TestCase Howto tutorial).
Examplecactus.servletRedirectorName = ServletRedirector

Property Namecactus.jspRedirectorName
RequiredNo. Defaults to "JspRedirector".
DescriptionName of the Cactus JSP Redirector as it is mapped on the server side in web.xml (see below). This property is needed only if your test classes are extending JspTestCase (see the TestCase Howto tutorial).
Examplecactus.jspRedirectorName = JspRedirector

Property Namecactus.filterRedirectorName (For J2EE API 1.3 only)
RequiredNo. Defaults to "FilterRedirector".
DescriptionName of the Cactus Filter Redirector as it is mapped on the server side in web.xml (see below). This property is needed only if your test classes are extending FilterTestCase (see the TestCase Howto tutorial).
Examplecactus.filterRedirectorName = FilterRedirector

2.Server side configuration

On Cactus server side, you only need to properly configure your application web.xml file to include definitions

for Cactus Redirectors (see How it works if you don't know what a Cactus Redirector is).

You need to register the Cactus Redirectors that you use, and you need to map them to the

cactus.servletRedirectorName, cactus.jspRedirectorName and cactus.filterRedirectorName

that you have configured on the client side (or simply make sure that you use the default names, i.e.

ServletRedirector, JspRedirector and FilterRedirector respectively).

Here is a sample web.xml that defines the 3 Cactus Redirectors:

 

<? xml version="1.0" encoding="ISO-8859-1" ?>

<! DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd"
>

< web-app >

    
< filter >
        
< filter-name > FilterRedirector </ filter-name >
        
< filter-class > org.apache.cactus.server.FilterTestRedirector </ filter-class >
    
</ filter >

    
< filter-mapping >
        
< filter-name > FilterRedirector </ filter-name >
        
< url-pattern > /FilterRedirector </ url-pattern >
    
</ filter-mapping >

    
< servlet >
        
< servlet-name > ServletRedirector </ servlet-name >
        
< servlet-class > org.apache.cactus.server.ServletTestRedirector </ servlet-class >
    
</ servlet >

    
< servlet >
        
< servlet-name > JspRedirector </ servlet-name >
        
< jsp-file > /jspRedirector.jsp </ jsp-file >
    
</ servlet >

    
< servlet-mapping >
        
< servlet-name > ServletRedirector </ servlet-name >
        
< url-pattern > /ServletRedirector </ url-pattern >
    
</ servlet-mapping >

    
< servlet-mapping >
        
< servlet-name > JspRedirector </ servlet-name >
        
< url-pattern > /JspRedirector </ url-pattern >
    
</ servlet-mapping >

</ web-app >

If you are using the JSP Redirector (i.e. you have test classes that extend JspTestCase), you must copy the

jspRedirector.jsp file (found in the sample/web directory where you unpacked your Cactus distribution) in

a directory in your webapp and you need to put its relative path in the mapping defined above (here we have put

it in the webapp root

If you want to provide some initialisation parameters that will be available to the config implicit object available

in your test case, simply use the standard <init-param> tags.

For example, for the Servlet Redirector (same principle applies to all other redirectors):

 

[...]
    
< servlet >
        
< servlet-name > ServletRedirector </ servlet-name >
        
< servlet-class > org.apache.cactus.server.ServletTestRedirector </ servlet-class >
        
< init-param >
          
< param-name > param1 </ param-name >
          
< param-value > value1 used for testing </ param-value >
        
</ init-param >
    
</ servlet >
[...]
 
Within your testXXX() code, you can also call the config.setInitParameter() method ( config being the
 implicit object of type ServletConfig) to simulate initialisation parameters as if they had been defined in your
web.xml.

Last, if you need to unit test code that uses the Servlet Security API, please check the Security Howto.

3.Cactus logging configuration

 

Since Cactus 1.4, we have switched to using the Jakarta Commons Logging framework for Cactus internal

logs (and any log you may wish to output as part of your test).

This allow Cactus to use any underlying logging framework such as: Log4J, LogKit, JDK 1.4 Logging or even a

Simple Logger provided as part of Commons Logging (it outputs to the console).

Cactus is completely agnostic with regards to the logging framework configuration, so you will have to learn

how to configure your favorite logging yourself. However here are some tips to help set up a Cactus logging

configuration.

a.'cactus.logging.config' property

Cactus provides an optional cactus.logging.config configuration property. If set, Cactus will load the

properties file pointed by this property and will set each property as a system property. This allowsw putting all

logging-related properties into a single place, as demonstrated below.

If you're using the Ant <cactus> task, please refer to the documentation for that task to set up Cactus logging.
 
b.Sample logging configuration files
As Cactus is running in 2 JVMs (client side and server side), you'll need to provide 2 logging configuration if you
 wish to enable logging for both sides. Here are some sample configuration files.
Client side configuration sample
Notice that for JDK 1.4 logging and for Log4J logging you have to specify that path to this file as these 2 logging
 systems also use a configuration file to configure themselves. Alternatively you can put configuration data in other files. However, it's convenient to group everything in a single file.
-----------------------------------------------------------------------------
# Logging properties
-----------------------------------------------------------------------------

# Disable logging by 
default  when running the tests. If you wish to use a 
# logging subsystem, uncomment the line below. That will let Commons logging
# decide automatically of a suitable logging system 
for  you. You can also force
# commons
- logging to use a specific logging system. For more info, see
# http:
// jakarta.apache.org/commons/logging

# Disable logging
#org.apache.commons.logging.Log 
=  org.apache.commons.logging.impl.NoOpLog

# Force to use JDK 
1.4  logging
#org.apache.commons.logging.Log 
=  org.apache.commons.logging.impl.Jdk14Logger

# Force to use Log4J logging
#org.apache.commons.logging.Log 
=  org.apache.commons.logging.impl.Log4JLogger

# Force to use Simple logging
#org.apache.commons.logging.Log 
=  org.apache.commons.logging.impl.SimpleLog

----  JDK  1.4  logging properties

# Following properties are useful 
if  you ' re using the JDK 1.4 logging subsystem
# and wish to output logs to a file. Make sure to comment out the NoOpLog line 
# above.
java.util.logging.config.file 
=  @target.dir@ / logging_client.properties
handlers 
=  java.util.logging.FileHandler
java.util.logging.FileHandler.pattern 
=  @target.dir@ / test_client.log
java.util.logging.FileHandler.formatter 
=  java.util.logging.SimpleFormatter

# If you want to provide finer grained logging, restrict the level 
for  the 
# specific 
package  name. 
# For example: 
# org.apache.cactus.server.level 
=  ALL
# org.apache.commons.httpclient.level 
=  ALL
# .level 
=  ALL
org.apache.cactus.level 
=  ALL

----  Log4J logging properties

# Following properties are useful 
if  you ' re using the Log4J logging subsystem
# and wish to output logs to a file. Make sure to comment out the NoOpLog line 
# above.
log4j.configuration 
=  file: / @target.dir@ / logging_client.properties

log4j.appender.cactus 
=  org.apache.log4j.FileAppender
log4j.appender.cactus.File 
=  @target.dir@ / test_client.log
log4j.appender.cactus.Append 
=   false
log4j.appender.cactus.layout 
=  org.apache.log4j.PatternLayout
log4j.appender.cactus.layout.ConversionPattern 
=   % d {ABSOLUTE}  [ % t]  %- 5p  %- 30 .30c {2}   % -   % % n

# Any application log which uses Log4J will be logged to the Cactus log file
log4j.rootCategory
= DEBUG, cactus

# Debug logs 
for  Cactus
log4j.category.org.apache.cactus 
=  DEBUG, cactus
log4j.additivity.org.apache.cactus 
=   false

# Debug logs 
for  HttpClient
log4j.category.org.apache.commons.httpclient 
=  DEBUG, cactus
log4j.additivity.org.apache.commons.httpclient 
=   false
log4j.category.httpclient 
=  WARN, cactus
log4j.additivity.httpclient 
=   false

----  SimpleLog logging properties

org.apache.commons.logging.simplelog.showlogname 
=   true
org.apache.commons.logging.simplelog.log.org.apache.cactus 
=  trace
org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient 
=  trace
 
Server side configuration sample
Notice that for JDK 1.4 logging and for Log4J logging you have to specify that path to this file as these 2 logging
 systems also use a configuration file to configure themselves. Alternatively you can put configuration data in other files. However, it's convenient to group everything in a single file.
 

Tips

JUnit uses a different classloader to load each test of a TestCase class. Thus, Log4j will reinitialise for each

test, which may lead to overwriting the test_client.log file each time (this is because we have set

log4j.appender.cactus.Append to false. You can set it to true if you wish to keep all the logs but the file

size will grow quickly. In addition logs are really only useful when there is a failure and thus not appending is

usually a good choice.

避坑指南:Winbond W25Q256JV QSPI Flash状态寄存器那些坑(含QE位不可改的解决方案) 本文深度解析Winbond W25Q256JV QSPI Flash状态寄存器的常见问题与解决方案,重点解决QE位不可修改、写保护区域异常等典型问题。通过实战代码示例和寄存器配置技巧,帮助开发者高效完成Flash读写测试与性能优化,避免常见设计陷阱。 阅读详情

相关推荐

xiabibi-cactus:hexo主题 -- 基于cactus主题修改,自用

xiabibi-cactus 本主题 fork 自 cactus 主题,。主题最新版请从原作者处下载,本主题仅做风格上的修改和部分 bug 修复。 fork版本:3.0 说明 主题默认修改为白色,其中所有的修改也是基于白色主题修改的,在其他颜色方案上未做测试。 更新 の 修复部分 bug の 添加搜索页面 の 添加 分类页 和 标签页,可在 主题配置 文件中的 nav 选项中控制 の 修改 bash 命令行样式 の 添加 live2d 控件 增添部分样式 增添danger类警告窗样式 の 解决无法添加文章列表页的 bug 新添标签云页面 の 修改code代码块样式 分离pre代码块样式 添加highlight高亮方案avue.css,样式为 vue 官网风格 ------------------------------------ 我是分割线 -----------------------

Cactus学习历程

项目描述 Cactus是一个对服务器端Java代码(Servlet,EJBs,Tag Libs, Filters,....)进行单元测试的简单的测试框架Cactus的目标是降低编写服务器代码单元测试的成本。它使用并扩展了Junit。 Cactus实现了in-container策略,意味着测试是运行在容器内的。 Cactus系统由一些组件组成: Cactus框架:...

niqinwen520的博客 435

cactus:Hyperledger Cactus是解决区块链互操作性问题的新方法

超级账本仙人掌 该项目是“孵化超级账本”项目。 有关此项目历史的更多信息,请参见。 在可以找到有关Active需要做什么的信息。 Hyperledger Cactus旨在在区块链网络之间提供去中心化,安全和可适应的集成。 Hyperledger Cactus目前正在进行重大的重构工作,以实现所需的未来架构,这将使基于插件的协作开发能够增加用例和Ledgers的支持范围。 项目范围 随着区块链技术的激增,区块链集成将成为更广泛的区块链生态系统中越来越重要的话题。 例如,人们可能想在不同平台上运行的多个不同区块链之间进行交易。 Hyperledger Cactus是一个Web应用程序系统,旨在允许用户安全地集成不同的区块链。 它包括一组库,数据模型和SDK,以加速集成服务应用程序的开发。 我们的目标是提供一个系统,允许我们代码的用户安全地在所有最常用的区块链之间进行交易。 运行示例 供应链

Cactus框架:移动设备上的终极AI推理引擎入门指南

Cactus框架是一款专为边缘设备设计的AI推理引擎,它让移动设备、Mac和Raspberry Pi等ARM芯片也能高效运行人工智能模型。作为移动设备上的终极AI推理引擎,Cactus提供了零拷贝计算图和高效的量化技术,让AI应用在移动设备上也能流畅运行。 ## Cactus框架的核心优势 Cactus框架为移动设备上的AI应用带来了革命性的性能提升。它采用了先进的量化技术,在保持模型精度的同

gitblog_00743的博客 395

【GitHub项目推荐--Cactus:跨平台移动端AI模型部署框架完全指南】

Cactus​ 是一个革命性的跨平台框架,专门用于在智能手机和其他移动设备上本地部署LLM(大语言模型)、VLM(视觉语言模型)和TTS(文本转语音)模型。由Cactus-Compute团队开发,该项目实现了在资源受限的移动设备上高效运行先进的AI模型,打破了云端依赖的局限。🔗 ​GitHub地址⚡ ​核心价值​:移动端本地AI · 跨平台支持 · 生产就绪 · 开源免费​项目背景​:​移动AI需求​:应对移动设备上本地AI推理的快速增长需求​隐私保护​:通过本地部署避免敏感数据上传到云端​。

j8267643的博客 1844

Cactus实例讲解

Cactus简介. 简介 Cactus实现了对JUnit测试框架的无缝扩展,可以方便地测试服务端应用程序。Cactus可以在下面几种情况下使用: 测试Servlet以及任何使用了像HttpServletRequest,HttpServletResponse,……这样的对象的代码。使用ServletTestCase。 测试Filter以及任何使用了像FilterCo

飞鱼软件工作室 1020

服务器端的测试利器--Cactus简介

  Cactus是一套简单,易于使用的服务器端测试框架,可以使开发人员很轻松的测试服务器端的程序。Cactus是Junit的一个扩展,但是它又和Junit有一些不同。Cactus的测试分为三种不同的测试类别,JspTestCase,ServletTestCase, FilterTestCase, 而不是像Junit就一种TestCase。Cactus的测试代码有服务器端和客户端两个部分,他们协

梦想的阶梯——弓心圣的专栏 907

2024最新Astro主题:Astro Theme Cactus安装与配置教程

Astro Theme Cactus是一款简单而强大的Astro主题,专为博客和个人网站设计。本教程将带你快速完成从安装到基础配置的全过程,即使是新手也能轻松上手打造自己的专属网站。 ## 📋 准备工作:环境要求 在开始安装Astro Theme Cactus前,请确保你的开发环境满足以下条件: - Node.js 18.14.1或更高版本 - npm、yarn或pnpm包管理器 - Git

gitblog_01114的博客 705

Missing Cactus property [cactus.contextURL]

Missing Cactus property [cactus.contextURL]后来发现少了一个文件cactus.properties,内容如下:cactus.contextURL=http://localhost:8080/Cactuscactus.servletRedirectorName=ServletRedirector. 

spiritleo的专栏 1016

关于Cactus的两个问题

配置Cactus经常会发生一些奇异的事情。比如今天,首先发现,jakarta-cactus-12-1.7.1包中自带的cactus-1.7.1.jar居然因为缺少org.apache.cactus.server.FilterTestRedirector 而不能正常工作,换成 eclipse带的cactus plugin中cactus-1.7.2.jar 才正常了。(下次研究下这个插件怎么用的)

galois_godel的专栏 1281

cactus java_Cactus入门

这是一个WebProject,有关Cactus用法详见本文测试用例首先是web.xmlxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&...

weixin_39841136的博客 222

ant+cactus+tomcat5.5容器内单元测试简明手册

一、下载并解压缩cactus下载地址为http://apache.freelamp.com/jakarta/cactus/binaries/jakarta-cactus-12-1.7.1.zip。将cactus的lib目录下的c...

cqwf95925的博客 106

cactus的学习笔记(一)

NULL 博文链接:https://whythiszhao.iteye.com/blog/966494

cactus在Junit测试时需要添加的内容

根据apache的start文档做了一个例子,但是发现在Run As Junit时一直出错 Missing Cactus property [cactus.contextURL]后来发现少了一个文件cactus.properties,内容如下:cactus.contextURL=http://localhost:8080/Cactuscactus.servletRedirectorName

wonder的地下室 2192

CACTUs-MAML 开源项目快速入门指南

CACTUs-MAML 开源项目快速入门指南 本指南旨在帮助您深入了解并快速上手 CACTUs-MAML 这一基于元学习的无监督学习项目。我们将依次解析其目录结构、启动文件以及配置文件的关键要素,以便您能够顺畅地进行开发和实验。 1. 项目目录结构及介绍 CACTUs-MAML 的目录结构设计是为了便于理解和维护,以下是关键文件和文件夹的概览: . ├── README.md - 项目...

gitblog_00968的博客 441

cactus测试servlet

为了使得项目的开发正规化,准备在3u的这个项目中使用专门的测试工具,经过多方面的比较,最后选择cactus,使用工具eclipse3.1.1+cactus+junit     1.解压cactus安装文件到某一目录下    2.将lib下的jar拷贝到项目\web-inf

myfuturein的专栏 1209

Cactus项目终极指南:从入门到精通的完整教程

Cactus项目是一个基于Cactus图概念的基因组比对工具,为生物信息学研究者提供了高效的基因组比对解决方案。本指南将带你从零开始,全面掌握Cactus项目的安装、配置和使用方法。 ## 🚀 快速入门概览 Cactus项目采用先进的图论算法来处理基因组比对问题,能够有效处理大规模基因组数据。无论你是生物信息学新手还是经验丰富的开发者,都能通过本指南快速上手。 [![Cactus项目架构示

gitblog_00625的博客 1189

Numpy到Numpy接口详解:ClearerVoice-Studio灵活调用方式的终极指南

ClearerVoice-Studio是一款AI驱动的语音处理工具包,提供了从Numpy数组到Numpy数组的灵活调用方式,支持语音增强、分离和目标说话人提取等多种任务。本文将详细介绍如何使用这一强大的接口,帮助新手和普通用户快速上手。 ## 什么是Numpy到Numpy接口? Numpy到Numpy接口是ClearerVoice-Studio提供的一种高效语音处理方式,它允许用户直接输入Nu

gitblog_00048的博客 421

Cactus使用体验

第一部分一、文件夹内的内容cactus.jar: the main jar, contains the framework classes. You can find this jar in [cactus root]/lib. cactus-ant.jar: a jar which contains some custom Ant tasks to help integrate ea

kaukiyou的专栏 1731

Cactus详细讲解

Cactus建议一年以上有经验的人玩,刚入门MVC,不了解下列组件请先自行学习,切勿好高骛远。 Cactus的组成(基于.net4.5.2):Dapper+MVC4+autofac 前端css框架pure,数据库:sqlite ,mssql,mysql,pgsql。默认是sqlite所以可以直接运行不用安装(目前sqlite最完整,其他的几个数据库不完整,等待他人贡献代码)。 下载好...

weixin_30664539的博客 852

excel数据透视表练习数据

一份可以用来练习excel数据透视表的数据。

上一篇: 服务器端的测试利器--Cactus简介
下一篇: 如何使用MyEclipse完成Cactus测试
berniebd
博客等级 码龄20年 46粉丝 26原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值