我有以下代码:
String dateUTC = "2013-09-08T10:23:54.663-04:00";
org.joda.time.DateTime dateTime = new DateTime(dateUTC);
System.out.println(" Year : " + dateTime.getYear());
System.out.println(" Month : " + dateTime.getMonthOfYear());
System.out.println(" Day : " + dateTime.getDayOfMonth());
The Output of this program is :
Year : 2013
Month : 9 // I want this to be 2 digit if the month is between 1 to 9
Day : 8 // I want this to be 2 digit if the month is between 1 to 9
Run Code Online (Sandbox Code Playgroud)
有没有什么办法可以使用Joda API检索2位数的月份和年份的值.
我有以下 pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<configuration>
<!-- Sets the VM argument line used when unit tests are run. -->
<argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=512m ${jacoco.agent.argLine}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<configuration>
<dataFile>target/jacoco.exec</dataFile>
</configuration>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacoco.agent.argLine</propertyName>
<destFile>target/jacoco.exec</destFile>
</configuration>
</execution>
<execution>
<id>default-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我正在使用 maven-compiler-plugin v2.5.1
当我从 Eclipse 进行干净测试时,它会创建 target/jacoco.exec 文件,一旦它创建,我就运行它jacoco:report并创建报告。但是该报告显示了除一个包之外所有代码覆盖率为 0% 的包。
当我使用 cobertura 为同一组类运行报告时,它正确地向我们显示了代码覆盖率。
这里可能有什么问题?
添加我的 Maven 日志:
[INFO] Scanning for projects...
[INFO]
[INFO] Using …Run Code Online (Sandbox Code Playgroud) 我们使用Websphere MQ 7.5作为消息传递解决方案,使用Spring JMS(v4.0.1)我们编写了一个发送器类来向这个MQ发送一些示例消息.现在当spring上下文被初始化时,它抛出了ClassNotFoundException异常
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsConnectionFactory' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.ibm.mq.jms.MQQueueConnectionFactory]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1021)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) …Run Code Online (Sandbox Code Playgroud) 我创建了一个具有以下版本的 AKS 集群。
Kubernetes version: 1.12.6
Istio version: 1.1.4
Cloud Provider: Azure
Run Code Online (Sandbox Code Playgroud)
我还使用外部 IP 地址成功安装了 Istio 作为我的 Ingress 网关。我还为部署服务的命名空间启用了 istio-injection。我看到 sidecar 注入正在成功进行。它正在显现。
NAME READY STATUS RESTARTS AGE
club-finder-deployment-7dcf4479f7-8jlpc 2/2 Running 0 11h
club-finder-deployment-7dcf4479f7-jzfv7 2/2 Running 0 11h
Run Code Online (Sandbox Code Playgroud)
我的 tls 网关
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: tls-gateway
namespace: istio-system
spec:
selector:
istio: ingressgateway
servers:
- port:
name: https
number: 443
protocol: HTTPS
tls:
mode: SIMPLE
serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
privateKey: /etc/istio/ingressgateway-certs/tls.key
hosts:
- "*"
Run Code Online (Sandbox Code Playgroud)
注意:我使用自签名证书进行测试。
我已经申请了以下虚拟服务
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: …Run Code Online (Sandbox Code Playgroud) java ×3
maven ×2
azure ×1
ibm-mq ×1
istio ×1
jacoco ×1
jodatime ×1
kubernetes ×1
spring-jms ×1