本文整理汇总了Java中org.exoplatform.commons.utils.PropertyManager.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyManager.setProperty方法的具体用法?Java PropertyManager.setProperty怎么用?Java PropertyManager.setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.exoplatform.commons.utils.PropertyManager
的用法示例。
在下文中一共展示了PropertyManager.setProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.exoplatform.commons.utils.PropertyManager; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() {
startEmbeddedES();
// If the test is executed standalone, the properties are not present at the
// beginning
// of the test, so they have to be removed at the end of the test to avoid
// java.lang.AssertionError: System properties invariant violated from
// com.carrotsearch.randomizedtesting
// If another test ran before and set the properties, we must not remove the
// properties
// If we do, we'll get the same exception.
propertiesSet = StringUtils.isBlank(System.getProperty("exo.es.index.server.url"));
PropertyManager.setProperty("exo.es.index.server.url", "http://localhost:" + esPort);
PropertyManager.setProperty("exo.es.search.server.url", "http://localhost:" + esPort);
elasticIndexingClient = new ElasticIndexingClient(new ElasticIndexingAuditTrail());
elasticSearchingClient = new ElasticSearchingClient(new ElasticIndexingAuditTrail());
}
示例2: cleanUrlProperties
import org.exoplatform.commons.utils.PropertyManager; //导入方法依赖的package包/类
@AfterClass
public static void cleanUrlProperties() {
// Close ES Node
if(node != null) {
LOGGER.info("Embedded ES instance - Stopping");
node.close();
LOGGER.info("Embedded ES instance - Stopped");
}
if (propertiesSet) {
System.clearProperty("exo.es.index.server.url");
System.clearProperty("exo.es.indexing.batch.number");
System.clearProperty("exo.es.indexing.replica.number.default");
System.clearProperty("exo.es.indexing.shard.number.default");
System.clearProperty("exo.es.search.server.url");
System.clearProperty("jboss.i18n.generate-proxies");
} else {
//Reset server.url properties to default values
PropertyManager.setProperty("exo.es.index.server.url", "http://127.0.0.1:9200");
PropertyManager.setProperty("exo.es.search.server.url", "http://127.0.0.1:9200");
}
}
示例3: startEmbeddedES
import org.exoplatform.commons.utils.PropertyManager; //导入方法依赖的package包/类
/**
* Start an Elasticsearch instance
*/
private static void startEmbeddedES() {
if(esPort == null) {
try {
esPort = getAvailablePort();
} catch (IOException e) {
fail("Cannot get available port : " + e.getMessage());
}
}
// Init ES
LOGGER.info("Embedded ES instance - Starting on port " + esPort);
Settings.Builder elasticsearchSettings = Settings.settingsBuilder()
.put(Node.HTTP_ENABLED, true)
.put("network.host", "127.0.0.1")
.put("http.port", esPort)
.put("name", "esEmbeddedForTests" + esPort)
.put("path.home", "target/es")
.put("path.data", "target/es")
.put("plugins.load_classpath_plugins", true);
Environment environment = new Environment(elasticsearchSettings.build());
Collection plugins = new ArrayList<>();
Collections.<Class<? extends Plugin>>addAll(plugins, MapperAttachmentsPlugin.class, DeleteByQueryPlugin.class);
node = new EmbeddedNode(environment, Version.CURRENT, plugins);
node.start();
//node = nodeBuilder().local(true).settings(elasticsearchSettings.build()).node();
node.client().admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
assertNotNull(node);
assertFalse(node.isClosed());
LOGGER.info("Embedded ES instance - Started");
// Set URL of server in property
NodesInfoRequest nodesInfoRequest = new NodesInfoRequest().transport(true);
NodesInfoResponse response = node.client().admin().cluster().nodesInfo(nodesInfoRequest).actionGet();
NodeInfo nodeInfo = response.iterator().next();
InetSocketTransportAddress address = (InetSocketTransportAddress) nodeInfo.getHttp().getAddress().publishAddress();
String url = "http://" + address.address().getHostName() + ":" + address.address().getPort();
PropertyManager.setProperty("exo.es.index.server.url", url);
PropertyManager.setProperty("exo.es.search.server.url", url);
}
示例4: initMock
import org.exoplatform.commons.utils.PropertyManager; //导入方法依赖的package包/类
@Before
public void initMock() throws IOException {
MockitoAnnotations.initMocks(this);
PropertyManager.setProperty("exo.es.index.server.url", "http://127.0.0.1:9200");
elasticIndexingClient = new ElasticIndexingClient(auditTrail);
elasticIndexingClient.client = httpClient;
}
示例5: initMock
import org.exoplatform.commons.utils.PropertyManager; //导入方法依赖的package包/类
@Before
public void initMock() throws IOException {
MockitoAnnotations.initMocks(this);
PropertyManager.setProperty("exo.es.search.server.url", "http://127.0.0.1:9200");
elasticSearchingClient = new ElasticSearchingClient(auditTrail);
elasticSearchingClient.client = httpClient;
}