package ikube.toolkit;

import static org.junit.Assert.*;

import java.io.File;
import java.util.jar.JarFile;

import ikube.ATest;

import org.junit.Before;
import org.junit.Test;

/**
 * @author Michael Couck
 * @since 27.03.11
 * @version 01.00
 */
public class PropertyConfigurerTest extends ATest {

	private String fileBatchSize = "file.batch.size";
	private PropertyConfigurer propertyConfigurer;

	public PropertyConfigurerTest() {
		super(PropertyConfigurer.class);
	}

	@Before
	public void before() {
		propertyConfigurer = new PropertyConfigurer();
		propertyConfigurer.setFileNamePattern("spring.properties");
	}

	@Test
	public void checkJarFile() {
		File jarFile = FileUtilities.findFileRecursively(new File("."), "ikube-core");
		if (jarFile == null) {
			return;
		}
		propertyConfigurer.checkJar(jarFile);
		Object property = propertyConfigurer.getProperty(fileBatchSize);
		assertNotNull(property);
	}

	@Test
	public void checkJarJarFile() throws Exception {
		File jarFile = FileUtilities.findFileRecursively(new File("."), "ikube-core");
		if (jarFile == null) {
			return;
		}
		propertyConfigurer.checkJar(new JarFile(jarFile));
		Object property = propertyConfigurer.getProperty(fileBatchSize);
		assertNotNull(property);
	}

	@Test
	public void initialize() {
		propertyConfigurer.initialize();
		Object property = propertyConfigurer.get(fileBatchSize);
		assertNotNull(property);
	}

}

@@ -50,17 +50,50 @@
 .Assert.
-*
+assertNotNull;%0D%0Aimport ikube.ATest
 ;%0D%0A%0D%0Aimp
@@ -144,39 +144,16 @@
 ile;%0D%0A%0D%0A
-import ikube.ATest;%0D%0A%0D%0A
 import o
@@ -341,17 +341,20 @@
 e String
- 
+%09%09%09%09
 fileBatc
@@ -358,17 +358,17 @@
 atchSize
- 
+%09
 = %22file.
@@ -408,17 +408,17 @@
 nfigurer
- 
+%09
 property
@@ -705,32 +705,34 @@
 () %7B%0D%0A%09%09File
+%5B%5D
  jarFile
  = FileUtili
@@ -711,32 +711,33 @@
 %09%09File%5B%5D jarFile
+s
  = FileUtilities
@@ -741,35 +741,25 @@
 ies.findFile
-Recursively
+s
 (new File(%22.
@@ -753,32 +753,47 @@
 s(new File(%22.%22),
+ new String%5B%5D %7B
  %22ikube-core%22);%0D
@@ -781,32 +781,34 @@
 %5D %7B %22ikube-core%22
+ %7D
 );%0D%0A%09%09if (jarFil
@@ -804,32 +804,33 @@
 %09if (jarFile
+s
  == null
 ) %7B%0D%0A%09%09%09retu
@@ -817,38 +817,141 @@
  == null
-) %7B%0D%0A%09%09%09return;%0D%0A%09%09%7D%0D%0A
+ %7C%7C jarFiles.length == 0) %7B%0D%0A%09%09%09return;%0D%0A%09%09%7D%0D%0A%09%09for (File jarFile : jarFiles) %7B%0D%0A%09%09%09logger.error(%22Jar file : %22 + jarFile);%0D%0A%09
 %09%09proper
@@ -979,24 +979,29 @@
 (jarFile);%0D%0A
+%09%09%7D%0D%0A
 %09%09Object pro
@@ -1155,24 +1155,26 @@
 %0D%0A%09%09File
+%5B%5D
  jarFile
  = FileU
@@ -1165,16 +1165,17 @@
  jarFile
+s
  = FileU
@@ -1195,19 +1195,9 @@
 File
-Recursively
+s
 (new
@@ -1207,16 +1207,31 @@
 le(%22.%22),
+ new String%5B%5D %7B
  %22ikube-
@@ -1235,16 +1235,18 @@
 be-core%22
+ %7D
 );%0D%0A%09%09if
@@ -1254,24 +1254,25 @@
 (jarFile
+s
  == null
 ) %7B%0D%0A%09%09%09
@@ -1263,38 +1263,141 @@
  == null
-) %7B%0D%0A%09%09%09return;%0D%0A%09%09%7D%0D%0A
+ %7C%7C jarFiles.length == 0) %7B%0D%0A%09%09%09return;%0D%0A%09%09%7D%0D%0A%09%09for (File jarFile : jarFiles) %7B%0D%0A%09%09%09logger.error(%22Jar file : %22 + jarFile);%0D%0A%09
 %09%09proper
@@ -1438,24 +1438,29 @@
 jarFile));%0D%0A
+%09%09%7D%0D%0A
 %09%09Object pro

Updated a test.