litianpeng created SCB-1388:
-------------------------------

             Summary: test on "handler-loadbalance" project,cannot all success
                 Key: SCB-1388
                 URL: https://issues.apache.org/jira/browse/SCB-1388
             Project: Apache ServiceComb
          Issue Type: Test
          Components: Java-Chassis
    Affects Versions: java-chassis-1.2.1
         Environment: Eclipse Java EE IDE for Web Developers.
Version: Oxygen.1a Release (4.7.1a)
Build id: 20171005-1200
            Reporter: litianpeng


when use junit test on the "handler-loadbalance" project,there will be 
something wrong in TestLoadBalanceHandler2.java.In TestLoadBalanceHandler2.java:

 
{code:java}
//代码占位符
@BeforeClass
public static void beforeClass() {
//prepare for defineEndpointAndHandle
  
ArchaiusUtils.setProperty("servicecomb.loadbalance.userDefinedEndpoint.enabled",
 "true");
// avoid mock
}
{code}
beforeclass,when only test on TestLoadBalanceHandler2.java,the property will 
set to be "true",and in LoadBalanceHandler:

 
{code:java}
//代码占位符
public static final boolean supportDefinedEndpoint =
DynamicPropertyFactory.getInstance()
.getBooleanProperty("servicecomb.loadbalance.userDefinedEndpoint.enabled", 
false).get();
{code}
the "supportDefinedEndpoint" will set to be "true".

 

However, when we test on the whole project,before test on 
"TestLoadBalanceHandler2", if it execute on "TestLoadBalanceHandler", in this 
class,it will init the LoadbalanceHandler, and the "supportDefinedEndpoint" 
will set to be "false" , because this attribute is a final static,after this, 
"supportDefinedEndpoint" will never set to be true, so then test on 
"TestLoadBalanceHandler2.testConfigEndpoint()":
{code:java}
//代码占位符
invocation.addLocalContext("scb-endpoint", 
"rest://127.0.0.1:8080?sslEnabled=true&protocol=http2");
try {
handler.handle(invocation, asyncResp);
} catch (Exception e) {

}
{code}
the "invocation.getEndpoint().getEndpoint()" will not change to 
"rest://127.0.0.1:8080?sslEnabled=true&protocol=http2".

 

And when I use eclipse to execute the junit test,this will happen, and in 
intelj, it will not.But I think this should be update.

 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to