我有问题设置Selenium使用的Firefox代理.firefox安装是默认的(v 14.0.1,%programfiles%/ mozilla firefox /).我使用默认配置文件启动了firefox并设置了代理(我需要没有代理或手动代理,但有一个例外).可以访问要测试的站点.(使用默认代理设置无法访问该站点)
我启动了默认的selenium节点
java -jar selenium-server-standalone-2.24.1.jar -role node -hub http://localhost:4444/grid/register
Run Code Online (Sandbox Code Playgroud)
如果我开始硒测试ff打开,输入url但现在我收到代理错误.如果我中断测试并检查设置:代理恢复默认.在"about:config"中,我可以看到并非所有设置都是默认设置,似乎WebDriver设置了一些东西(更新等等).
所以我的下一个方法是设置节点:
-firefoxProfileTemplate <my default profile folder>
Run Code Online (Sandbox Code Playgroud)
但没有成功 - 似乎硒忽略是完全的.设置不同的配置文件也不起作用.
那么如何让我的特殊代理设置被firefox使用?(我也试过没有网格,用本地firefox运行测试 - 同样的问题)
从这里我可以看到活跃的配置文件:"anonymous3433195750899294958webdriver-profile"可以让webdriver不使用这个?
更新:似乎唯一有用的是在java中设置代理:
DesiredCapabilities FF = DesiredCapabilities.firefox();
Proxy proxy = new Proxy();
proxy.setProxyType(ProxyType.DIRECT);
FF.setCapability(CapabilityType.PROXY, proxy);
Run Code Online (Sandbox Code Playgroud)
但是这个硬编码的解决方案从长远来看是没有选择的,我需要与环境无关的代码,除此之外我想知道最新情况.
我想根据此模式(即在 zip 中)验证 XML 文件;它导入另外两个 XSD 文件。
<import namespace="http://www.w3.org/2000/09/xmldsig#"
schemaLocation="xmldsig-core-schema.xsd"/>
<import namespace="http://www.w3.org/2001/04/xmlenc#"
schemaLocation="xenc-schema.xsd"/>
Run Code Online (Sandbox Code Playgroud)
这两个文件也可以在这里找到:
在验证时,我收到此错误:
Src-resolve: Cannot Resolve The Name 'xenc:EncryptedData' To A(n) 'element Declaration' Component.
Run Code Online (Sandbox Code Playgroud)
我的验证/解组代码如下所示(使用 moxy 作为 JAXB 提供程序):
jaxbContext = JAXBContext.newInstance(type.getRequestType().getPackage().getName());
Unmarshaller um = jaxbContext.createUnmarshaller();
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new StreamSource(this.getClass().getResourceAsStream("/xsd/" + type.getXsdName())));
um.setSchema(schema);
root = um.unmarshal(new StreamSource(new ByteArrayInputStream(xmlData)), type.getRequestType());
Run Code Online (Sandbox Code Playgroud)
在您询问类型有什么作用之前:我编写了可以从http://www.forum-datenaustausch.ch/导入所有类型发票的代码。但是 4.3 及更高版本使用了两个额外的架构文件。如何验证 XML 文件?
基于原型我创建了一个java ee应用程序.有一个包括arquillian测试运行正常.它只是在@Stateless bean上调用一个持久化实体的方法.
现在我添加了一些实体与一些关系,我为他们写了一个测试.但在坚持任何实体我得到
Transaction is required to perform this operation (either use a transaction or extended persistence context)
Run Code Online (Sandbox Code Playgroud)
我想我需要用@Transactional标记testmethod,但似乎不是在类路径中.在注入的EntityManager上手动调用事务会产生另一个错误.那么如何正确设置这样的测试和依赖.
编辑 Grzesiek D.建议这里有一些细节.这是实体(与其他人联系):
@Entity
public class Booking implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* internal id.
*/
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", updatable = false, nullable = false)
private Long id;
/**
* Used for optimistic locking.
*/
@Version
@Column(name = "version")
private int version;
/**
* A …
Run Code Online (Sandbox Code Playgroud) 我基于Spring Initializr(渐变风味)创建了一个Spring Boot应用程序。
我还加了
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
Run Code Online (Sandbox Code Playgroud)
使用MongoDB进行持久化。我还添加了一个可以正常工作的简单集成测试:
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class TileServiceApplicationTests {
@Autowired
private MockMvc mvc;
@Autowired
private UserSettingRepository userSettingRepository;
@Test
public void contextLoads() throws Exception {
Folder folder = random( Folder.class, "color", "elements" );
EserviceTile eserviceTile1 = random( EserviceTile.class , "color");
EserviceTile eserviceTile2 = random( EserviceTile.class, "color" );
folder.setElements( Arrays.asList(eserviceTile1) );
TileList usersTiles = new TileList( Arrays.asList( folder, eserviceTile2 ) );
userSettingRepository.save( new UserSetting( "user1", usersTiles ));
String string = mvc.perform( get( "/user1" ) ).andExpect( status().isOk() …
Run Code Online (Sandbox Code Playgroud) 我正在尝试为日期选择器设置正确的(基于语言环境的)一周开始。所以我使用了这个和那个问题并实现了我自己的 DateAdapter:
import { NativeDateAdapter } from "@angular/material/core/datetime";
import { Injectable } from "@angular/core";
import { LOCALE_ID, Inject } from "@angular/core";
import { Platform } from "@angular/cdk/platform";
import { getLocaleFirstDayOfWeek } from "@angular/common";
@Injectable()
export class LocaleDateAdapter extends NativeDateAdapter {
constructor(@Inject(LOCALE_ID) public locale: string) {
super(locale, new Platform());
}
getFirstDayOfWeek() {
return getLocaleFirstDayOfWeek(this.locale);
}
}
Run Code Online (Sandbox Code Playgroud)
我也相应地将它放入提供者中:
import { LocaleDateAdapter } from './components/shared-components/locale-date-adapter';
import { DateAdapter } from '@angular/material/core/datetime';
...
providers: [
...
{
provide: DateAdapter,
useClass: …
Run Code Online (Sandbox Code Playgroud) 我尝试在我的应用程序中配置jsbc数据源
-tomcat_home- \的conf \卡塔利娜\本地主机
我的应用程序是"reportExport".war所以我用这个内容创建了reportExport.xml:
<Context>
<Resource name="jdbc/mssql" auth="Container" type="javax.sql.DataSource"
username="user"
password="pass"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:52015;databaseName=rewe;integratedSecurity=false;"
maxActive="20"
maxIdle="10"
validationQuery="select 1" />
</Context>
Run Code Online (Sandbox Code Playgroud)
我在web.xml中添加了这个:
<resource-ref>
<description>
This app requires a ms sql connection.
</description>
<res-ref-name>
jdbc/mssql
</res-ref-name>
<res-type>
javax.sql.DataSource
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>
Run Code Online (Sandbox Code Playgroud)
可能我可以省略我在reportExport.xml中给出的字段?!
在Java中我尝试获得这样的连接:
((DataSource) (new InitialContext()).lookup("java:comp/env/jdbc/mssql")).getConnection()
Run Code Online (Sandbox Code Playgroud)
连接在java中工作fin但有2个问题.
第一个问题是:如果我在部署应用程序之前将reportExport.xml放入正确的路径tomcat抛出异常:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].Sta
ndardContext[/reportExport]]
...
Caused by: java.lang.IllegalArgumentException: The main resource set specified [C:\Users\moritz\entwicklung\apache-tomca
t-8.0.18\webapps\reportExport] is not valid
...
11-Feb-2015 14:15:38.303 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Error de
ploying configuration …
Run Code Online (Sandbox Code Playgroud)