• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Builder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中java.util.Calendar.Builder的典型用法代码示例。如果您正苦于以下问题:Java Builder类的具体用法?Java Builder怎么用?Java Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Builder类属于java.util.Calendar包,在下文中一共展示了Builder类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUp

import java.util.Calendar.Builder; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
	super.setUp();
	
	Builder dtBuilder = new Calendar.Builder();
	Calendar cal = dtBuilder.build();
	this.now = cal.getTime();
	
	SyslogMessage syslogMessage = new SyslogMessage();
	syslogMessage.setFacility(SyslogFacility.FTP);
	syslogMessage.setHostname("myweb.com");
	syslogMessage.setLocalAddress("172.16.0.1");
	syslogMessage.setLogMessage("myweb.com not responding to ping");
	syslogMessage.setRemoteAddress("10.10.62.36");
	syslogMessage.setSeverity(SyslogSeverity.EMERG);
	syslogMessage.setTimestamp(cal);
	
	syslogMessageEvent = new SyslogMessageEvent(syslogMessage);

}
 
开发者ID:boundary,项目名称:boundary-event-sdk,代码行数:21,代码来源:ScriptRouteBuilderTest.java


示例2: testParseDateTime_1

import java.util.Calendar.Builder; //导入依赖的package包/类
@Ignore
@Test
public void testParseDateTime_1() throws java.text.ParseException {
	Builder builder = new Calendar.Builder();
	builder.setTimeZone(TimeZone.getTimeZone("GMT"));
	
	builder.setDate(2010, 0, 5);
	builder.setTimeOfDay(22, 22, 22);
	Date expectedISODate = builder.build().getTime();
	
	builder.setDate(2006, 3, 6);
	builder.setTimeOfDay(14, 22, 22);
	Date expectedDate = builder.build().getTime();

	String iso = "2010-01-05T14:22:22";
	Date parsedISODate = cli.parseDateTime(iso);
	assertEquals("check parsed ISO Date Time",expectedISODate,parsedISODate);
	
	String s = "2006-04-06 14:22:22";
	Date parsedDate = cli.parseDateTime(s);
	assertEquals("check parsed Date Time",expectedDate,parsedDate);
}
 
开发者ID:boundary,项目名称:boundary-event-sdk,代码行数:23,代码来源:EventCLITest.java


示例3: testQueryListLoad

import java.util.Calendar.Builder; //导入依赖的package包/类
@Ignore
@Test
public void testQueryListLoad() throws Exception {
	EsperRouteBuilder builder = new EsperRouteBuilder();
	builder.setConfiguration("test-esper-route-query-load.json");
	builder.loadConfiguration();
	QueryList queryList = builder.getQueryList();
	List<Query> qlist = queryList.getQueries();
	assertEquals("test query list count",3,queryList.getQueries().size());
	
	Query query1 = qlist.get(0);
	Builder build = new Calendar.Builder();
	build.setTimeZone(TimeZone.getTimeZone("GMT"));
	build.setDate(2015,0,27);
	build.setTimeOfDay(0, 0, 0, 0);
	Calendar cal = build.build();
	assertEquals("check query 1 name","red",query1.getName());
	assertEquals("check query 1 create",cal.getTime(),query1.getCreated());
	assertEquals("check query 1 enabled",true,query1.isEnabled());
	assertEquals("check query 1 description","Red description",query1.getDescription());
	assertEquals("check query 1 query",
			"select * from Red where name = 'ONE' and property = 2",query1.getQuery());
}
 
开发者ID:boundary,项目名称:boundary-event-sdk,代码行数:24,代码来源:EsperRouteTest.java


示例4: buildTimeOfDay

import java.util.Calendar.Builder; //导入依赖的package包/类
public static Date buildTimeOfDay(int hour, int minute, int seconds) {
    return new Builder().setTimeOfDay(hour, minute, seconds).build().getTime();
}
 
开发者ID:neikeq,项目名称:KicksEmu,代码行数:4,代码来源:DateUtils.java


示例5: testScriptEvent

import java.util.Calendar.Builder; //导入依赖的package包/类
@Test
public void testScriptEvent() throws InterruptedException {
	Builder builder = new Calendar.Builder();
	builder.setDate(2010, 5, 20);
	builder.setTimeOfDay(13, 0, 0,0);
	Calendar cal = builder.build();
	
	out.expectedMessageCount(1);
	ScriptEvent event = new ScriptEvent();
	
	out.getExchanges();
	in.sendBodyAndHeaders(event,setScriptHeader("classpath:META-INF/js/test-script-event.js"));
	out.assertIsSatisfied();
	
	List<Exchange> exchanges = out.getExchanges();
	assertEquals("check exchange count",1,exchanges.size());
	Exchange exchange = exchanges.get(0);
	Message message = exchange.getIn();
	ScriptEvent newEvent = message.getBody(ScriptEvent.class);
	assertNotNull("check for not null",newEvent);
	
	Map<String,Object> map = new HashMap<String,Object>();
	map.put("red", "one");
	map.put("green","two");
	map.put("blue","three");
	
	List<String> list = new ArrayList<String>();
	list.add("alex");
	list.add("geddy");
	list.add("neal");
	
	ScriptEnum enumeration = ScriptEnum.YELLOW;
	
	ScriptObject object = new ScriptObject();
	object.setDate(cal.getTime());
	object.setString("Goodbye");
	object.setList(list);
	object.setMap(map);
	
	assertEquals("check date",cal.getTime(),newEvent.getDate());
	assertEquals("check string","Hello World!",newEvent.getString());
	assertEquals("check int",37,newEvent.getInteger());
	assertEquals("check decimal",9.81,newEvent.getDecimal(),DELTA);
	assertEquals("check map",map,newEvent.getMap());
	assertEquals("check list",list,newEvent.getList());
	assertEquals("check enumeration",enumeration,newEvent.getEnumeration());
	assertEquals("check object",object,newEvent.getObject());

}
 
开发者ID:boundary,项目名称:boundary-event-sdk,代码行数:50,代码来源:ScriptRouteBuilderTest.java


示例6: setUp

import java.util.Calendar.Builder; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	Date now = new Date();
	super.setUp();
   	Builder builder = new Calendar.Builder();
   	builder.setInstant(now);

	syslogMessage = buildSyslogMessage(
			EXPECTED_SYSLOG_FACILITY,
   			EXPECTED_HOST,
   			EXPECTED_LOCAL_ADDRESS,
   			EXPECTED_LOG_MESSAGE,
   			EXPECTED_REMOTE_ADDRESS,
   			EXPECTED_SYSLOG_SEVERITY,
   			builder.build());
	
   	event = new RawEvent();


   	event.addTag(SyslogFacility.DAEMON.toString());
   	event.getSource().setRef(EXPECTED_HOST).setType(EXPECTED_SOURCE_TYPE);
   	event.addTag(EXPECTED_SYSLOG_FACILITY.toString());
   	event.addTag(EXPECTED_HOST);
   	event.setCreatedAt(now);
   	event.addFingerprintField("facility");
   	event.addFingerprintField("hostname");
   	event.addFingerprintField("message");
   	event.setTitle(String.format("Syslog message from: %s",EXPECTED_HOST));
   	event.setMessage(EXPECTED_LOG_MESSAGE);
   	
   	expectedTags = new ArrayList<String>();
   	expectedTags.add(SyslogFacility.DAEMON.toString());
   	expectedTags.add(EXPECTED_HOST);
   	 
   	expectedProperties = new HashMap<String,Object>();
   	expectedProperties.put("facility",SyslogFacility.DAEMON.toString());
   	expectedProperties.put("hostname",EXPECTED_HOST);
   	expectedProperties.put("message",EXPECTED_LOG_MESSAGE);

   	expectedFingerprintFields = new ArrayList<String>();
   	expectedFingerprintFields.add("facility");
   	expectedFingerprintFields.add("hostname");
   	expectedFingerprintFields.add("message");
}
 
开发者ID:boundary,项目名称:boundary-event-sdk,代码行数:45,代码来源:SyslogToEventProcessorTest.java


示例7: test

import java.util.Calendar.Builder; //导入依赖的package包/类
@Test
public void test() {
	Query query1 = queryList.getQueries().get(0);
	Builder build1 = new Calendar.Builder();
	build1.setTimeZone(TimeZone.getTimeZone("GMT"));
	build1.setDate(2015,0,27);
	build1.setTimeOfDay(0, 0, 0, 0);
	Calendar cal1 = build1.build();
	assertEquals("check query 1 name","red",query1.getName());
	assertEquals("check query 1 create",cal1.getTime(),query1.getCreated());
	assertEquals("check query 1 modified",cal1.getTime(),query1.getModified());
	assertEquals("check query 1 enabled",true,query1.isEnabled());
	assertEquals("check query 1 description","Red description",query1.getDescription());
	assertEquals("check query 1 query",
			"select * from Red where name = 'ONE' and property = 2",query1.getQuery());
	
	Query query2 = queryList.getQueries().get(1);
	Builder build2 = new Calendar.Builder();
	build2.setTimeZone(TimeZone.getTimeZone("GMT"));
	build2.setDate(1992,5,20);
	build2.setTimeOfDay(0, 0, 0, 0);
	Calendar cal2 = build2.build();
	assertEquals("check query 2 name","blue",query2.getName());
	assertEquals("check query 2 create",cal2.getTime(),query2.getCreated());
	assertEquals("check query 2 modified",cal2.getTime(),query2.getCreated());
	assertEquals("check query 2 enabled",false,query2.isEnabled());
	assertEquals("check query 2 description","Blue description",query2.getDescription());
	assertEquals("check query 2 query",
			"select * from Blue where name = 'ONE' and property = 2",query2.getQuery());

	Query query3 = queryList.getQueries().get(2);
	Builder build3 = new Calendar.Builder();
	build3.setTimeZone(TimeZone.getTimeZone("GMT"));
	build3.setDate(2000,11,10);
	build3.setTimeOfDay(0, 0, 0, 0);
	Calendar cal3 = build3.build();
	assertEquals("check query 3 name","green",query3.getName());
	assertEquals("check query 3 create",cal3.getTime(),query3.getCreated());
	assertEquals("check query 3 enabled",true,query3.isEnabled());
	assertEquals("check query 3 description","Green description",query3.getDescription());
	assertEquals("check query 3 query",
			"select * from Green where name = 'ONE' and property = 2",query3.getQuery());
	
}
 
开发者ID:boundary,项目名称:boundary-event-sdk,代码行数:45,代码来源:QueryListTest.java


示例8: getInstance

import java.util.Calendar.Builder; //导入依赖的package包/类
/**
 * Returns a new <code>Calendar</code> instance for the
 * specified locale.
 *
 * @param zone the time zone
 * @param locale the desired locale
 * @exception NullPointerException if <code>locale</code> is null
 * @exception IllegalArgumentException if <code>locale</code> isn't
 *     one of the locales returned from
 *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
 *     getAvailableLocales()}.
 * @return a <code>Calendar</code> instance.
 * @see java.util.Calendar#getInstance(java.util.Locale)
 */
@Override
public Calendar getInstance(TimeZone zone, Locale locale) {
    return new Calendar.Builder()
                 .setLocale(locale)
                 .setTimeZone(zone)
                 .setInstant(System.currentTimeMillis())
                 .build();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:CalendarProviderImpl.java



注:本文中的java.util.Calendar.Builder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GetEditLogManifestResponseProto类代码示例发布时间:2022-05-22
下一篇:
Java Count类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap