|
|
@ -16,6 +16,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
package com.alibaba.cloud.nacos.registry;
|
|
|
|
package com.alibaba.cloud.nacos.registry;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.InvocationHandler;
|
|
|
|
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.cloud.nacos.discovery.NacosDiscoveryClientConfiguration;
|
|
|
|
import com.alibaba.cloud.nacos.discovery.NacosDiscoveryClientConfiguration;
|
|
|
|
import com.alibaba.nacos.api.NacosFactory;
|
|
|
|
import com.alibaba.nacos.api.NacosFactory;
|
|
|
|
import org.junit.Assert;
|
|
|
|
import org.junit.Assert;
|
|
|
@ -27,6 +32,7 @@ import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
|
|
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
|
|
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
|
|
|
import org.powermock.modules.junit4.PowerMockRunner;
|
|
|
|
import org.powermock.modules.junit4.PowerMockRunner;
|
|
|
|
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
|
|
|
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
|
|
@ -36,11 +42,6 @@ import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.InvocationHandler;
|
|
|
|
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
|
|
|
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -50,8 +51,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
|
|
|
|
@PowerMockIgnore("javax.management.*")
|
|
|
|
@PowerMockIgnore("javax.management.*")
|
|
|
|
@PowerMockRunnerDelegate(SpringRunner.class)
|
|
|
|
@PowerMockRunnerDelegate(SpringRunner.class)
|
|
|
|
@PrepareForTest({ NacosFactory.class })
|
|
|
|
@PrepareForTest({ NacosFactory.class })
|
|
|
|
@SpringBootTest(
|
|
|
|
@SpringBootTest(classes = NacosRegistrationCustomizerTest.TestConfig.class,
|
|
|
|
classes = NacosRegistrationCustomizerTest.TestConfig.class,
|
|
|
|
|
|
|
|
properties = { "spring.application.name=myTestService1",
|
|
|
|
properties = { "spring.application.name=myTestService1",
|
|
|
|
"spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848" },
|
|
|
|
"spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848" },
|
|
|
|
webEnvironment = RANDOM_PORT)
|
|
|
|
webEnvironment = RANDOM_PORT)
|
|
|
@ -98,6 +98,7 @@ public class NacosRegistrationCustomizerTest {
|
|
|
|
metadata.put("test1", "test1");
|
|
|
|
metadata.put("test1", "test1");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|