@@ -57,8 +57,16 @@ public void beforeTest() throws DockerException {
5757
5858 @ AfterTest
5959 public void afterTest () {
60- LOG .info ("======================= AFTERTEST =======================" );
60+ LOG .info ("======================= END OF AFTERTEST =======================" );
61+ }
6162
63+ @ BeforeMethod
64+ public void beforeMethod (Method method ) {
65+ LOG .info (String .format ("################################## STARTING %s ##################################" , method .getName ()));
66+ }
67+
68+ @ AfterMethod
69+ public void afterMethod (ITestResult result ) {
6270 for (String image : tmpImgs ) {
6371 LOG .info ("Cleaning up temporary image " + image );
6472 try {
@@ -72,17 +80,7 @@ public void afterTest() {
7280 dockerClient .removeContainer (container );
7381 } catch (DockerException ignore ) {}
7482 }
75- LOG .info ("======================= END OF AFTERTEST =======================" );
76- }
77-
78- @ BeforeMethod
79- public void beforeMethod (Method method ) {
80- LOG .info (String .format ("################################## STARTING %s ##################################" , method .getName ()));
81- }
82-
83- @ AfterMethod
84- public void afterMethod (ITestResult result ) {
85- LOG .info (String .format ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF %s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n " , result .getName ()));
83+ LOG .info (String .format ("################################## END OF %s ##################################\n " , result .getName ()));
8684 }
8785
8886 /*
@@ -456,9 +454,23 @@ public void testPullImage() throws DockerException, IOException {
456454
457455 LOG .info ("Pulling image " + testImage );
458456
459- String response = dockerClient .pull (testImage );
457+ ClientResponse response = dockerClient .pull (testImage );
458+
459+ StringWriter logwriter = new StringWriter ();
460+
461+ try {
462+ LineIterator itr = IOUtils .lineIterator (response .getEntityInputStream (), "UTF-8" );
463+ while (itr .hasNext ()) {
464+ String line = itr .next ();
465+ logwriter .write (line + "\n " );
466+ LOG .info (line );
467+ }
468+ } finally {
469+ IOUtils .closeQuietly (response .getEntityInputStream ());
470+ }
460471
461- assertThat (response , containsString ("Pulling image e9aa60c60128cad1 () from joffrey/test001" ));
472+ String fullLog = logwriter .toString ();
473+ assertThat (fullLog , containsString ("Pulling repository joffrey/test001" ));
462474
463475 tmpImgs .add (testImage );
464476
@@ -649,7 +661,7 @@ public void testNetCatDockerfileBuilder() throws DockerException, IOException, I
649661
650662 assertThat (containerInspectResponse .id , notNullValue ());
651663 assertThat (containerInspectResponse .networkSettings .portMapping , notNullValue ());
652- int port = Integer .valueOf (containerInspectResponse .networkSettings .portMapping .get ("6900" ));
664+ int port = Integer .valueOf (containerInspectResponse .networkSettings .portMapping .get ("Tcp" ). get ( " 6900" ));
653665
654666
655667 LOG .info ("Checking port {} is open" , port );
0 commit comments