Issue 191: updated to include chef log and fixed tests

This commit is contained in:
Adrian Cole 2010-07-27 17:24:37 -07:00
parent 56caac57f1
commit aed3bb7e74
3 changed files with 101 additions and 75 deletions

View File

@ -43,6 +43,7 @@ import org.jclouds.encryption.EncryptionService;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.RequiresHttp; import org.jclouds.http.RequiresHttp;
import org.jclouds.http.functions.ParseJson; import org.jclouds.http.functions.ParseJson;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.ReturnTrueIf2xx; import org.jclouds.http.functions.ReturnTrueIf2xx;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.RestClientTest; import org.jclouds.rest.RestClientTest;
@ -294,7 +295,7 @@ public class ChefAsyncClientTest extends RestClientTest<ChefAsyncClient> {
"{\"name\":\"testnode\",\"normal\":{},\"override\":{},\"default\":{},\"automatic\":{},\"run_list\":[\"recipe[java]\"],\"json_class\":\"Chef::Node\",\"chef_type\":\"node\"}", "{\"name\":\"testnode\",\"normal\":{},\"override\":{},\"default\":{},\"automatic\":{},\"run_list\":[\"recipe[java]\"],\"json_class\":\"Chef::Node\",\"chef_type\":\"node\"}",
"application/json", false); "application/json", false);
assertResponseParserClassEquals(method, httpRequest, ParseJson.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertExceptionParserClassEquals(method, null);

View File

@ -35,7 +35,7 @@ import com.google.common.collect.ImmutableSet;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", testName = "chef.CleanupStaleNodesAndClientsImplLiveTest") @Test(groups = "live", testName = "chef.CleanupStaleNodesAndClientsImplLiveTest")
public class CleanupStaleNodesAndClientsImplTest extends BaseChefStrategyLiveTest { public class CleanupStaleNodesAndClientsImplLiveTest extends BaseChefStrategyLiveTest {
private CreateNodeAndPopulateAutomaticAttributesImpl creater; private CreateNodeAndPopulateAutomaticAttributesImpl creater;
private CleanupStaleNodesAndClientsImpl strategy; private CleanupStaleNodesAndClientsImpl strategy;
private ChefClient chef; private ChefClient chef;

View File

@ -1,31 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright (C) 2010 Cloud Conscious, LLC. Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
<info@cloudconscious.com>
==================================================================== ====================================================================
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by http://www.apache.org/licenses/LICENSE-2.0
applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT Unless required by applicable law or agreed to in writing, software
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
and limitations under the License. See the License for the specific language governing permissions and
==================================================================== limitations under the License.
--> ====================================================================
-->
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!-- <!--
For more configuration infromation and examples see the Apache For more configuration infromation and examples see the Apache Log4j
Log4j website: http://logging.apache.org/log4j/ website: http://logging.apache.org/log4j/
--> -->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="false"> debug="false">
<!-- A time/date based rolling appender -->
<appender name="CHEFFILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="target/test-data/jclouds-chef.log" />
<param name="Append" value="true" />
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="Threshold" value="TRACE" />
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
<!--
The full pattern: Date MS Priority [Category]
(Thread:NDC) Message\n <param name="ConversionPattern"
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
-->
</layout>
</appender>
<appender name="ASYNCCHEF" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="CHEFFILE" />
</appender>
<!-- A time/date based rolling appender --> <!-- A time/date based rolling appender -->
<appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender"> <appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
@ -38,64 +65,56 @@
<param name="Threshold" value="TRACE" /> <param name="Threshold" value="TRACE" />
<layout class="org.apache.log4j.PatternLayout"> <layout class="org.apache.log4j.PatternLayout">
<!-- <!-- The default pattern: Date Priority [Category] Message${symbol_escape}n -->
The default pattern: Date Priority [Category]
Message${symbol_escape}n
-->
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" /> <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
<!-- <!--
The full pattern: Date MS Priority [Category] The full pattern: Date MS Priority [Category] (Thread:NDC) Message${symbol_escape}n
(Thread:NDC) Message${symbol_escape}n <param <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)
name="ConversionPattern" value="%d %-5r %-5p [%c] %m%n"/>
(%t:%x) %m%n"/>
--> -->
</layout> </layout>
</appender> </appender>
<!-- A time/date based rolling appender --> <!-- A time/date based rolling appender -->
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender"> <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="target/test-data/jclouds.log" /> <param name="File" value="target/test-data/jclouds.log" />
<param name="Append" value="true" /> <param name="Append" value="true" />
<!-- Rollover at midnight each day --> <!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd" /> <param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="Threshold" value="TRACE" /> <param name="Threshold" value="TRACE" />
<layout class="org.apache.log4j.PatternLayout"> <layout class="org.apache.log4j.PatternLayout">
<!-- <!-- The default pattern: Date Priority [Category] Message${symbol_escape}n -->
The default pattern: Date Priority [Category] <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
Message${symbol_escape}n
--> <!--
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" /> The full pattern: Date MS Priority [Category] (Thread:NDC) Message${symbol_escape}n
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)
<!-- %m%n"/>
The full pattern: Date MS Priority [Category] -->
(Thread:NDC) Message${symbol_escape}n <param </layout>
name="ConversionPattern" value="%d %-5r %-5p [%c] </appender>
(%t:%x) %m%n"/>
--> <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
</layout> <appender-ref ref="FILE" />
</appender> </appender>
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="FILE" />
</appender>
<appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender"> <appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="WIREFILE" /> <appender-ref ref="WIREFILE" />
</appender> </appender>
<!-- ================ --> <!-- ================ -->
<!-- Limit categories --> <!-- Limit categories -->
<!-- ================ --> <!-- ================ -->
<category name="org.jclouds"> <category name="org.jclouds">
<priority value="DEBUG" /> <priority value="DEBUG" />
<appender-ref ref="ASYNC" /> <appender-ref ref="ASYNC" />
</category> </category>
<category name="jclouds.headers"> <category name="jclouds.headers">
<priority value="DEBUG" /> <priority value="DEBUG" />
<appender-ref ref="ASYNCWIRE" /> <appender-ref ref="ASYNCWIRE" />
@ -106,12 +125,18 @@
<appender-ref ref="ASYNCWIRE" /> <appender-ref ref="ASYNCWIRE" />
</category> </category>
<!-- ======================= --> <category name="jclouds.chef">
<!-- Setup the Root category --> <priority value="TRACE" />
<!-- ======================= --> <appender-ref ref="ASYNCCHEF" />
</category>
<root>
<priority value="WARN" /> <!-- ======================= -->
</root> <!-- Setup the Root category -->
<!-- ======================= -->
<root>
<priority value="WARN" />
</root>
</log4j:configuration> </log4j:configuration>