org.springframework.context.event.test.TestEvent Java Examples

The following examples show how to use org.springframework.context.event.test.TestEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnotationDrivenEventListenerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void eventListenerWorksWithCglibProxy() throws Exception {
	load(CglibProxyTestBean.class);

	CglibProxyTestBean proxy = this.context.getBean(CglibProxyTestBean.class);
	assertTrue("bean should be a cglib proxy", AopUtils.isCglibProxy(proxy));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #2
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void conditionDoesNotMatch() {
	long maxLong = Long.MAX_VALUE;
	load(ConditionalEventListener.class);
	TestEvent event = new TestEvent(this, "KO");
	TestEventListener listener = this.context.getBean(ConditionalEventListener.class);
	this.eventCollector.assertNoEventReceived(listener);

	this.context.publishEvent(event);
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);

	this.context.publishEvent("KO");
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);

	this.context.publishEvent(maxLong);
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);
}
 
Example #3
Source File: AnnotationDrivenEventListenerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void exceptionPropagated() {
	load(ExceptionEventListener.class);
	TestEvent event = new TestEvent(this, "fail");
	ExceptionEventListener listener = this.context.getBean(ExceptionEventListener.class);
	this.eventCollector.assertNoEventReceived(listener);
	try {
		this.context.publishEvent(event);
		fail("An exception should have thrown");
	}
	catch (IllegalStateException e) {
		assertEquals("Wrong exception", "Test exception", e.getMessage());
		this.eventCollector.assertEvent(listener, event);
		this.eventCollector.assertTotalEventsCount(1);
	}
}
 
Example #4
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void conditionMatch() {
	long timestamp = System.currentTimeMillis();
	load(ConditionalEventListener.class);
	TestEvent event = new TestEvent(this, "OK");
	TestEventListener listener = this.context.getBean(ConditionalEventListener.class);
	this.eventCollector.assertNoEventReceived(listener);

	this.context.publishEvent(event);
	this.eventCollector.assertEvent(listener, event);
	this.eventCollector.assertTotalEventsCount(1);

	this.context.publishEvent("OK");
	this.eventCollector.assertEvent(listener, event, "OK");
	this.eventCollector.assertTotalEventsCount(2);

	this.context.publishEvent(timestamp);
	this.eventCollector.assertEvent(listener, event, "OK", timestamp);
	this.eventCollector.assertTotalEventsCount(3);
}
 
Example #5
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@EventListener
public Object handle(AnotherTestEvent event) {
	collectEvent(event);
	if (event.content == null) {
		return null;
	}
	else if (event.content instanceof String) {
		String s = (String) event.content;
		if (s.equals("String")) {
			return event.content;
		}
		else {
			return new TestEvent(this, event.getId(), s);
		}
	}
	return event.content;
}
 
Example #6
Source File: AnnotationDrivenEventListenerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void eventListenerWorksWithCglibProxy() throws Exception {
	load(CglibProxyTestBean.class);

	CglibProxyTestBean proxy = this.context.getBean(CglibProxyTestBean.class);
	assertTrue("bean should be a cglib proxy", AopUtils.isCglibProxy(proxy));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #7
Source File: AnnotationDrivenEventListenerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void eventListenerWorksWithAnnotatedInterfaceProxy() throws Exception {
	load(AnnotatedProxyTestBean.class);

	AnnotatedSimpleService proxy = this.context.getBean(AnnotatedSimpleService.class);
	assertTrue("bean should be a proxy", proxy instanceof Advised);
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #8
Source File: AnnotationDrivenEventListenerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void eventListenerWorksWithSimpleInterfaceProxy() throws Exception {
	load(ScopedProxyTestBean.class);

	SimpleService proxy = this.context.getBean(SimpleService.class);
	assertTrue("bean should be a proxy", proxy instanceof Advised);
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #9
Source File: AnnotationDrivenEventListenerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void simpleEventJavaConfig() {
	load(TestEventListener.class);
	TestEvent event = new TestEvent(this, "test");
	TestEventListener listener = this.context.getBean(TestEventListener.class);

	this.eventCollector.assertNoEventReceived(listener);
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(listener, event);
	this.eventCollector.assertTotalEventsCount(1);

	this.eventCollector.clear();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(listener, event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #10
Source File: AnnotationDrivenEventListenerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void conditionDoesNotMatch() {
	long maxLong = Long.MAX_VALUE;
	load(ConditionalEventListener.class);
	TestEvent event = new TestEvent(this, "KO");
	TestEventListener listener = this.context.getBean(ConditionalEventListener.class);
	this.eventCollector.assertNoEventReceived(listener);

	this.context.publishEvent(event);
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);

	this.context.publishEvent("KO");
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);

	this.context.publishEvent(maxLong);
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);

	this.context.publishEvent(24d);
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);
}
 
Example #11
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void exceptionPropagated() {
	load(ExceptionEventListener.class);
	TestEvent event = new TestEvent(this, "fail");
	ExceptionEventListener listener = this.context.getBean(ExceptionEventListener.class);
	this.eventCollector.assertNoEventReceived(listener);
	try {
		this.context.publishEvent(event);
		fail("An exception should have thrown");
	}
	catch (IllegalStateException e) {
		assertEquals("Wrong exception", "Test exception", e.getMessage());
		this.eventCollector.assertEvent(listener, event);
		this.eventCollector.assertTotalEventsCount(1);
	}
}
 
Example #12
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void eventListenerWorksWithCglibProxy() throws Exception {
	load(CglibProxyTestBean.class);

	CglibProxyTestBean proxy = this.context.getBean(CglibProxyTestBean.class);
	assertTrue("bean should be a cglib proxy", AopUtils.isCglibProxy(proxy));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #13
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void eventListenerWorksWithSimpleInterfaceProxy() throws Exception {
	load(ScopedProxyTestBean.class);

	SimpleService proxy = this.context.getBean(SimpleService.class);
	assertTrue("bean should be a proxy", proxy instanceof Advised);
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #14
Source File: AnnotationDrivenEventListenerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@EventListener
public Object handle(AnotherTestEvent event) {
	collectEvent(event);
	if (event.content == null) {
		return null;
	}
	else if (event.content instanceof String) {
		String s = (String) event.content;
		if (s.equals("String")) {
			return event.content;
		}
		else {
			return new TestEvent(this, event.getId(), s);
		}
	}
	return event.content;
}
 
Example #15
Source File: AnnotationDrivenEventListenerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void conditionDoesNotMatch() {
	long maxLong = Long.MAX_VALUE;
	load(ConditionalEventListener.class);
	TestEvent event = new TestEvent(this, "KO");
	TestEventListener listener = this.context.getBean(ConditionalEventListener.class);
	this.eventCollector.assertNoEventReceived(listener);

	this.context.publishEvent(event);
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);

	this.context.publishEvent("KO");
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);

	this.context.publishEvent(maxLong);
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);

	this.context.publishEvent(24d);
	this.eventCollector.assertNoEventReceived(listener);
	this.eventCollector.assertTotalEventsCount(0);
}
 
Example #16
Source File: AnnotationDrivenEventListenerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void simpleEventJavaConfig() {
	load(TestEventListener.class);
	TestEvent event = new TestEvent(this, "test");
	TestEventListener listener = this.context.getBean(TestEventListener.class);

	this.eventCollector.assertNoEventReceived(listener);
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(listener, event);
	this.eventCollector.assertTotalEventsCount(1);

	this.eventCollector.clear();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(listener, event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #17
Source File: AnnotationDrivenEventListenerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void exceptionPropagated() {
	load(ExceptionEventListener.class);
	TestEvent event = new TestEvent(this, "fail");
	ExceptionEventListener listener = this.context.getBean(ExceptionEventListener.class);
	this.eventCollector.assertNoEventReceived(listener);
	try {
		this.context.publishEvent(event);
		fail("An exception should have thrown");
	}
	catch (IllegalStateException e) {
		assertEquals("Wrong exception", "Test exception", e.getMessage());
		this.eventCollector.assertEvent(listener, event);
		this.eventCollector.assertTotalEventsCount(1);
	}
}
 
Example #18
Source File: AnnotationDrivenEventListenerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@EventListener
public Object handle(AnotherTestEvent event) {
	collectEvent(event);
	if (event.content == null) {
		return null;
	}
	else if (event.content instanceof String) {
		String s = (String) event.content;
		if (s.equals("String")) {
			return event.content;
		}
		else {
			return new TestEvent(this, event.getId(), s);
		}
	}
	return event.content;
}
 
Example #19
Source File: AnnotationDrivenEventListenerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void eventListenerWorksWithSimpleInterfaceProxy() throws Exception {
	load(ScopedProxyTestBean.class);

	SimpleService proxy = this.context.getBean(SimpleService.class);
	assertTrue("bean should be a proxy", proxy instanceof Advised);
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #20
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void eventListenerWorksWithAnnotatedInterfaceProxy() throws Exception {
	load(AnnotatedProxyTestBean.class);

	AnnotatedSimpleService proxy = this.context.getBean(AnnotatedSimpleService.class);
	assertTrue("bean should be a proxy", proxy instanceof Advised);
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #21
Source File: AnnotationDrivenEventListenerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void eventListenerWorksWithAnnotatedInterfaceProxy() throws Exception {
	load(AnnotatedProxyTestBean.class);

	AnnotatedSimpleService proxy = this.context.getBean(AnnotatedSimpleService.class);
	assertTrue("bean should be a proxy", proxy instanceof Advised);
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #22
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void simpleEventXmlConfig() {
	this.context = new ClassPathXmlApplicationContext(
			"org/springframework/context/event/simple-event-configuration.xml");
	TestEvent event = new TestEvent(this, "test");
	TestEventListener listener = this.context.getBean(TestEventListener.class);
	this.eventCollector = getEventCollector(this.context);

	this.eventCollector.assertNoEventReceived(listener);
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(listener, event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #23
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void metaAnnotationIsDiscovered() {
	load(MetaAnnotationListenerTestBean.class);

	MetaAnnotationListenerTestBean bean = context.getBean(MetaAnnotationListenerTestBean.class);
	this.eventCollector.assertNoEventReceived(bean);

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(bean, event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #24
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void simpleEventJavaConfig() {
	load(TestEventListener.class);
	TestEvent event = new TestEvent(this, "test");
	TestEventListener listener = this.context.getBean(TestEventListener.class);
	this.eventCollector.assertNoEventReceived(listener);
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(listener, event);
	this.eventCollector.assertTotalEventsCount(1);
}
 
Example #25
Source File: AnnotationDrivenEventListenerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
private void validateConditionMatch(Class<?>... classes) {
	long timestamp = System.currentTimeMillis();
	load(classes);
	TestEvent event = new TestEvent(this, "OK");

	ConditionalEventInterface listener = this.context.getBean(ConditionalEventInterface.class);
	this.eventCollector.assertNoEventReceived(listener);

	this.context.publishEvent(event);
	this.eventCollector.assertEvent(listener, event);
	this.eventCollector.assertTotalEventsCount(1);

	this.context.publishEvent("OK");
	this.eventCollector.assertEvent(listener, event, "OK");
	this.eventCollector.assertTotalEventsCount(2);

	this.context.publishEvent("NOT OK");
	this.eventCollector.assertTotalEventsCount(2);

	this.context.publishEvent(timestamp);
	this.eventCollector.assertEvent(listener, event, "OK", timestamp);
	this.eventCollector.assertTotalEventsCount(3);

	this.context.publishEvent(42d);
	this.eventCollector.assertEvent(listener, event, "OK", timestamp, 42d);
	this.eventCollector.assertTotalEventsCount(4);
}
 
Example #26
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void eventListenerWorksWithCustomScope() throws Exception {
	load(CustomScopeTestBean.class);
	CustomScope customScope = new CustomScope();
	this.context.getBeanFactory().registerScope("custom", customScope);

	CustomScopeTestBean proxy = this.context.getBean(CustomScopeTestBean.class);
	assertTrue("bean should be a cglib proxy", AopUtils.isCglibProxy(proxy));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	customScope.active = false;
	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	customScope.active = true;
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);

	try {
		customScope.active = false;
		this.context.publishEvent(new TestEvent());
		fail("Should have thrown IllegalStateException");
	}
	catch (BeanCreationException ex) {
		// expected
		assertTrue(ex.getCause() instanceof IllegalStateException);
	}
}
 
Example #27
Source File: AnnotationDrivenEventListenerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void eventListenerWorksWithCustomScope() throws Exception {
	load(CustomScopeTestBean.class);
	CustomScope customScope = new CustomScope();
	this.context.getBeanFactory().registerScope("custom", customScope);

	CustomScopeTestBean proxy = this.context.getBean(CustomScopeTestBean.class);
	assertTrue("bean should be a cglib proxy", AopUtils.isCglibProxy(proxy));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	this.eventCollector.assertNoEventReceived(proxy.getId());

	customScope.active = false;
	this.context.publishEvent(new ContextRefreshedEvent(this.context));
	customScope.active = true;
	this.eventCollector.assertNoEventReceived(proxy.getId());

	TestEvent event = new TestEvent();
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(proxy.getId(), event);
	this.eventCollector.assertTotalEventsCount(1);

	try {
		customScope.active = false;
		this.context.publishEvent(new TestEvent());
		fail("Should have thrown IllegalStateException");
	}
	catch (BeanCreationException ex) {
		// expected
		assertTrue(ex.getCause() instanceof IllegalStateException);
	}
}
 
Example #28
Source File: AnnotationDrivenEventListenerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@EventListener
public void handle(TestEvent event) {
	collectEvent(event);
	if ("fail".equals(event.msg)) {
		throw new IllegalStateException("Test exception");
	}
}
 
Example #29
Source File: EventPublicationInterceptorTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testExpectedBehavior() throws Exception {
	TestBean target = new TestBean();
	final TestListener listener = new TestListener();

	class TestContext extends StaticApplicationContext {
		@Override
		protected void onRefresh() throws BeansException {
			addApplicationListener(listener);
		}
	}

	StaticApplicationContext ctx = new TestContext();
	MutablePropertyValues pvs = new MutablePropertyValues();
	pvs.add("applicationEventClass", TestEvent.class.getName());
	// should automatically receive applicationEventPublisher reference
	ctx.registerSingleton("publisher", EventPublicationInterceptor.class, pvs);
	ctx.registerSingleton("otherListener", FactoryBeanTestListener.class);
	ctx.refresh();

	EventPublicationInterceptor interceptor =
			(EventPublicationInterceptor) ctx.getBean("publisher");
	ProxyFactory factory = new ProxyFactory(target);
	factory.addAdvice(0, interceptor);

	ITestBean testBean = (ITestBean) factory.getProxy();

	// invoke any method on the advised proxy to see if the interceptor has been invoked
	testBean.getAge();

	// two events: ContextRefreshedEvent and TestEvent
	assertTrue("Interceptor must have published 2 events", listener.getEventCount() == 2);
	TestListener otherListener = (TestListener) ctx.getBean("&otherListener");
	assertTrue("Interceptor must have published 2 events", otherListener.getEventCount() == 2);
}
 
Example #30
Source File: AnnotationDrivenEventListenerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void simpleEventXmlConfig() {
	this.context = new ClassPathXmlApplicationContext(
			"org/springframework/context/event/simple-event-configuration.xml");

	TestEvent event = new TestEvent(this, "test");
	TestEventListener listener = this.context.getBean(TestEventListener.class);
	this.eventCollector = getEventCollector(this.context);

	this.eventCollector.assertNoEventReceived(listener);
	this.context.publishEvent(event);
	this.eventCollector.assertEvent(listener, event);
	this.eventCollector.assertTotalEventsCount(1);
}