小编Mic*_* K.的帖子

独立Spring OAuth2 JWT授权服务器+ CORS

所以我从Dave Syer的这个例子中得到了以下授权服务器

@SpringBootApplication
public class AuthserverApplication {

    public static void main(String[] args) {
            SpringApplication.run(AuthserverApplication.class, args);
    }

    /* added later
    @Configuration
    @Order(Ordered.HIGHEST_PRECEDENCE)
    protected static class MyWebSecurity extends WebSecurityConfigurerAdapter {

        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http //.csrf().disable() 
                .authorizeRequests()
                .antMatchers(HttpMethod.OPTIONS, "/oauth/token").permitAll();
       }
    }*/

    @Configuration
    @EnableAuthorizationServer
    protected static class OAuth2AuthorizationConfig extends
                    AuthorizationServerConfigurerAdapter {

            @Autowired
            private AuthenticationManager authenticationManager;

            @Bean
            public JwtAccessTokenConverter jwtAccessTokenConverter() {
                    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
                    KeyPair keyPair = new KeyStoreKeyFactory(
                                    new ClassPathResource("keystore.jks"), "foobar".toCharArray())
                                    .getKeyPair("test");
                    converter.setKeyPair(keyPair);
                    return converter; …
Run Code Online (Sandbox Code Playgroud)

spring-security cors jwt spring-security-oauth2

24
推荐指数
3
解决办法
4万
查看次数

来自JaCoCo Maven插件的SonarQube集成测试覆盖率显示0%

我们有一个多模块多语言maven java项目,使用jacoco进行覆盖分析.模块的主要部分是带有REST API的后端(Java代码),我们的webapp模块包含前端(AngularJS)和java中的Integration-Tests.我们的Jacoco-IT.exec文件包含大约100Kb的数据,因此我们猜测可以收集集成测试的一些Coverage数据.然而,我们无法在SonarQube中看到任何报道(使用版本5.0和4.5)

我们运行构建项目并运行集成测试

mvn clean install
Run Code Online (Sandbox Code Playgroud)

用数据分析数据

mvn sonar:sonar
Run Code Online (Sandbox Code Playgroud)

项目配置为多语言,但我们只是分析了java代码(我们曾经有过单语言配置,但与覆盖数据相关的结果没有差异)

我们的父母POM:

<properties>
    <hibernate.version>4.2.2.Final</hibernate.version>
    <spring.version>3.2.3.RELEASE</spring.version>
    <resteasy.version>3.0.4.Final</resteasy.version>
    <cucumber.version>1.1.3</cucumber.version>
    <selenium-java.version>2.33.0</selenium-java.version>
    <!-- Sonar -->
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
    <sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath>
    <jacoco.dataFile>${project.basedir}/../target/jacoco-it.exec</jacoco.dataFile>
</properties>
<build>
   <plugins>
       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <debug>true</debug>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>

            <executions>
                <execution>
                    <id>default-prepare-agent</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>default-prepare-agent-integration</id>
                    <goals>
                        <goal>prepare-agent-integration</goal>
                    </goals>
                </execution>
                <execution>
                    <id>default-report</id>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
                <execution>
                    <id>default-report-integration</id>
                    <goals>
                        <goal>report-integration</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.16</version>
        </plugin>
    </plugins>
    <pluginManagement>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.2.201409121644</version>
            </plugin>
    </pluginMangement> …
Run Code Online (Sandbox Code Playgroud)

configuration integration-testing maven sonarqube jacoco-maven-plugin

14
推荐指数
1
解决办法
8482
查看次数

在 Qt Designer 中使用自定义 PySide2 小部件

我正在寻找一种在 Qt Designer 中有效地使用用 Qt for Python (PySide2) 编写的自定义小部件的方法。

我发现,可以使用基本小部件设计 GUI,然后只需将类交换到 UI 文件中的自定义小部件并通知QUiLoader有关子类的信息loader.registerCustomWidget(MyMainWindow),然后在 Qt 设计器中再次打开它不起作用那好。

我在PyQt 的这个类似问题中读到你必须为自定义小部件编写一个插件。PySide2 是否也存在这种可能性?

一些示例代码:

custom_widget.py:

import sys

from PySide2.QtUiTools import QUiLoader
from PySide2.QtWidgets import QApplication, QMainWindow, QAction, QMessageBox, QFileDialog, QTextBrowser
from PySide2.QtCore import QFile


class MyMainWindow(QMainWindow):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setWindowTitle("Demo QtWidget App")

    def closeEvent(self, event):
        msgBox = QMessageBox()
        msgBox.setWindowTitle("Quit?")
        msgBox.setText("Exit application?")
        msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        msgBox.setDefaultButton(QMessageBox.No)
        ret = msgBox.exec_()
        if ret == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()


if …
Run Code Online (Sandbox Code Playgroud)

python qt-designer pyside2

5
推荐指数
1
解决办法
5699
查看次数