carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [1/2] carbondata-site git commit: Added DI and Test Cases and Code Optimization and Refactoring
Date Thu, 11 May 2017 23:32:43 GMT
Repository: carbondata-site
Updated Branches:
  refs/heads/asf-site 44063974b -> 51c60829c


Added DI and Test Cases and Code Optimization and Refactoring


Project: http://git-wip-us.apache.org/repos/asf/carbondata-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata-site/commit/d0f3baf8
Tree: http://git-wip-us.apache.org/repos/asf/carbondata-site/tree/d0f3baf8
Diff: http://git-wip-us.apache.org/repos/asf/carbondata-site/diff/d0f3baf8

Branch: refs/heads/asf-site
Commit: d0f3baf801c3afea16ee22bb39afa3778e2e6c31
Parents: bc19fe5
Author: jatin <jatin.demla@knoldus.in>
Authored: Wed May 3 16:59:16 2017 +0530
Committer: jatin <jatin.demla@knoldus.in>
Committed: Thu May 11 16:37:50 2017 +0530

----------------------------------------------------------------------
 carbonscript.sh                                 |   2 +
 pom.xml                                         |  56 +++++-
 src/main/resources/application.conf             |   2 +-
 src/main/scala/FileModification.scala           |  75 --------
 src/main/scala/FileOperationMain.scala          |  13 --
 src/main/scala/MDFileConverter.scala            |  53 ++++++
 src/main/scala/MdFileHandler.scala              |  54 ++++++
 src/main/scala/MdFilehandler.scala              |  86 ---------
 src/main/scala/Module.scala                     |  10 +
 src/main/scala/WebsiteLauncher.scala            |  13 ++
 src/main/scala/services/ConfService.scala       |   9 +
 src/main/scala/services/ConfServiceImpl.scala   |  32 ++++
 src/main/scala/services/DataService.scala       |   7 +
 src/main/scala/services/DataServiceImpl.scala   |  51 ++++++
 src/main/scala/services/FileService.scala       |   7 +
 src/main/scala/services/FileServiceImpl.scala   |  43 +++++
 src/main/webapp/configuration-parameters.html   |   3 +
 src/main/webapp/data-management.html            |   3 +
 .../webapp/ddl-operation-on-carbondata.html     |   3 +
 .../webapp/dml-operation-on-carbondata.html     |   3 +
 src/main/webapp/faq.html                        |   3 +
 .../webapp/file-structure-of-carbondata.html    |   3 +
 src/main/webapp/installation-guide.html         |   3 +
 src/main/webapp/quick-start-guide.html          |   3 +
 .../supported-data-types-in-carbondata.html     |   3 +
 src/main/webapp/troubleshooting.html            |   3 +
 src/main/webapp/useful-tips-on-carbondata.html  |   3 +
 src/test/resources/scalastyle_config.xml        | 181 +++++++++++++++++++
 src/test/scala/MDFileConverterSpec.scala        |  36 ++++
 src/test/scala/MdFileHandlerSpec.scala          |  38 ++++
 .../scala/Service/FileServiceImplSpec.scala     |  30 +++
 31 files changed, 652 insertions(+), 179 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/carbonscript.sh
----------------------------------------------------------------------
diff --git a/carbonscript.sh b/carbonscript.sh
index 4e11f33..b1ad576 100755
--- a/carbonscript.sh
+++ b/carbonscript.sh
@@ -1,3 +1,5 @@
+mvn compile
+
 mvn exec:java -Dexec.mainClass=FileOperationMain
 
 mvn install

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 89fb3ac..8b1154e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,7 +46,7 @@
         <groupId>org.scala-tools</groupId>
         <artifactId>maven-scala-plugin</artifactId>
         <version>2.12.1</version>
-        <!--  <executions>
+          <executions>
               <execution>
                   <goals>
                       <goal>add-source</goal>
@@ -54,7 +54,7 @@
                       <goal>testCompile</goal>
                   </goals>
               </execution>
-          </executions>-->
+          </executions>
       </plugin>
 
       <plugin>
@@ -62,7 +62,7 @@
         <artifactId>exec-maven-plugin</artifactId>
         <version>1.2.1</version>
         <configuration>
-          <mainClass>FileOperationMain</mainClass>
+          <mainClass>WebsiteLauncher</mainClass>
         </configuration>
       </plugin>
 
@@ -102,7 +102,29 @@
           </execution>
         </executions>
       </plugin>
-
+        <plugin>
+            <groupId>org.scalastyle</groupId>
+            <artifactId>scalastyle-maven-plugin</artifactId>
+            <version>0.8.0</version>
+            <configuration>
+                <failOnViolation>true</failOnViolation>
+                <failOnWarning>false</failOnWarning>
+                <verbose>false</verbose>
+                <includeTestSourceDirectory>true</includeTestSourceDirectory>
+                <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>
+                <testSourceDirectory>${basedir}/src/test/scala</testSourceDirectory>
+                <configLocation>${basedir}/src/test/resources/scalastyle_config.xml</configLocation>
+                <outputFile>${project.basedir}/target/scalastyle-output.xml</outputFile>
+                <outputEncoding>UTF-8</outputEncoding>
+            </configuration>
+            <executions>
+                <execution>
+                    <goals>
+                        <goal>check</goal>
+                    </goals>
+                </execution>
+            </executions>
+        </plugin>
     </plugins>
   </build>
 
@@ -133,6 +155,32 @@
       <artifactId>config</artifactId>
       <version>1.3.1</version>
     </dependency>
+      <!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
+      <dependency>
+          <groupId>org.mockito</groupId>
+          <artifactId>mockito-all</artifactId>
+          <version>1.9.5</version>
+      </dependency>
+
+      <!-- https://mvnrepository.com/artifact/org.scalatest/scalatest_2.12 -->
+      <dependency>
+          <groupId>org.scalatest</groupId>
+          <artifactId>scalatest_2.12</artifactId>
+          <version>3.0.1</version>
+      </dependency>
+    <!-- https://mvnrepository.com/artifact/org.scalastyle/scalastyle-maven-plugin -->
+    <dependency>
+      <groupId>org.scalastyle</groupId>
+      <artifactId>scalastyle-maven-plugin</artifactId>
+      <version>0.8.0</version>
+    </dependency>
+
+    <!-- https://mvnrepository.com/artifact/com.google.inject/guice -->
+    <dependency>
+      <groupId>com.google.inject</groupId>
+      <artifactId>guice</artifactId>
+      <version>3.0</version>
+    </dependency>
   </dependencies>
 </project>
 

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf
index b321170..b0b9ff6 100644
--- a/src/main/resources/application.conf
+++ b/src/main/resources/application.conf
@@ -15,5 +15,5 @@ fileListToRetain=["quick-start-guide",
 headerPath="src/main/scala/html/header.html"
 footerPath="src/main/scala/html/footer.html"
 outputFileLocation="src/main/webapp/"
-apiUrl="https://raw.githubusercontent.com/apache/incubator-carbondata/master/docs/"
+apiUrl="https://raw.githubusercontent.com/apache/carbondata/master/docs/"
 mdLink="https://api.github.com/markdown/raw"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/FileModification.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/FileModification.scala b/src/main/scala/FileModification.scala
deleted file mode 100644
index 3d8c969..0000000
--- a/src/main/scala/FileModification.scala
+++ /dev/null
@@ -1,75 +0,0 @@
-import java.io.{File, PrintWriter}
-
-import com.typesafe.config.ConfigFactory
-import org.slf4j.LoggerFactory
-
-import scala.collection.JavaConverters._
-
-class FileModification {
-  val logger = LoggerFactory.getLogger(classOf[FileModification])
-  val url = ConfigFactory.load().getString("apiUrl")
-  val inputFileExtension = ".md"
-  val outputFileExtension = ".html"
-
-  import scala.io.Source
-
-  val headerContent: String = Source.fromFile(ConfigFactory.load().getString("headerPath")).mkString
-  val footerContent: String = Source.fromFile(ConfigFactory.load().getString("footerPath")).mkString
-
-  val location = ConfigFactory.load().getString("outputFileLocation")
-  val fileReadObject = new MdFilehandler
-
-  /**
-    * reads list of files , converts file extension to output file extension and writes file to the location
-    *
-    * @return status of each file i.e. success or failure
-    */
-  def convertToHtml(): String = {
-    val listOfFiles = readListOfFiles()
-    val statusList = listOfFiles.map { file =>
-      val fileURLContent = scala.io.Source.fromURL(url + file + inputFileExtension).mkString
-      val getFileData: Option[String] = fileReadObject.getFileContent(fileURLContent)
-      getFileData match {
-        case Some(data: String) => val fileData = fileReadObject.ConvertMdExtension(data)
-          logger.info("Begin writing [" + file + outputFileExtension + "] at " + location)
-          writeToFile(location + file + outputFileExtension, fileData)
-          logger.info("Successfully written [" + file  + outputFileExtension + "] at " + location)
-          "Success"
-        case None => logger.error(s"$file Conversion failed ")
-          "Failure"
-      }
-    }
-
-    fileReadObject.ConvertReadMeExtension()
-    logger.info("Restored back the ReadMe.md file extension in Installation Guide")
-
-    if (statusList.contains("Failure"))
-      "Some Files Failed To Convert"
-    else
-      "All files successfully Converted"
-  }
-
-  /**
-    * Reads list of files from application.conf file
-    *
-    * @return list of string
-    */
-  private def readListOfFiles(): List[String] = {
-    val listOfFiles = ConfigFactory.load().getStringList("fileList").asScala.toList
-    logger.info(s"List of files : $listOfFiles")
-    listOfFiles
-  }
-
-  /**
-    * writes file to the destination provided by path parameter
-    *
-    * @param path storage location of the file
-    * @param data contents of the file
-    */
-  private def writeToFile(path: String, data: String): Unit = {
-    val writer = new PrintWriter(new File(path))
-    writer.write(headerContent + data + footerContent)
-    writer.close()
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/FileOperationMain.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/FileOperationMain.scala b/src/main/scala/FileOperationMain.scala
deleted file mode 100644
index 2dd027e..0000000
--- a/src/main/scala/FileOperationMain.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-import org.slf4j.LoggerFactory
-
-class FileOperationMain
-
-object FileOperationMain {
-  def main(args: Array[String]) {
-    val logger = LoggerFactory.getLogger(classOf[FileOperationMain])
-    val fileObject = new FileModification
-    val status = fileObject.convertToHtml()
-    logger.info(s"File Conversion to html : $status")
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/MDFileConverter.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/MDFileConverter.scala b/src/main/scala/MDFileConverter.scala
new file mode 100644
index 0000000..b4649d2
--- /dev/null
+++ b/src/main/scala/MDFileConverter.scala
@@ -0,0 +1,53 @@
+import com.google.inject.Inject
+import org.slf4j.{Logger, LoggerFactory}
+import services.{ConfService, DataService, FileService}
+
+class MDFileConverter @Inject()(fileService: FileService, confService: ConfService, dataService: DataService) {
+  val logger: Logger = LoggerFactory.getLogger(classOf[MDFileConverter])
+  val url: String = confService.readString("apiUrl")
+  val inputFileExtension: String = ".md"
+  val outputFileExtension: String = ".html"
+  val headerContent: String = fileService.readFromFile(confService.readString("headerPath"))
+  val footerContent: String = fileService.readFromFile(confService.readString("footerPath"))
+  val location: String = confService.readString("outputFileLocation")
+  val fileReadObject: MdFileHandler = new MdFileHandler(confService, fileService)
+  val failMessage: String = "failure"
+
+  /**
+    * reads list of files , converts file extension to output file extension and writes file to the location
+    *
+    * @return status of each file i.e. success or failure
+    */
+  def convertToHtml(): String = {
+    val listOfFiles: List[String] = confService.readListOfString("fileList")
+    val statusList: List[String] = listOfFiles.map { file =>
+      val fileURLContent: String = dataService.dataOnGetRequest(url + file + inputFileExtension)
+      val getFileData: Option[String] = dataService.dataOnPostRequest(fileURLContent)
+      getFileData match {
+        case Some(data: String) => val fileData = fileReadObject.convertMdExtensions(data)
+          logger.info(s"Begin writing [ $file outputFileExtension ] at $location")
+          val statusHtmlFile = fileService.writeToFile(location + file + outputFileExtension, headerContent + fileData + footerContent)
+          if (statusHtmlFile) {
+            logger.info(s"Successfully written [ $file $outputFileExtension ] at $location")
+            "Success"
+          }
+          else {
+            failMessage
+          }
+        case None => logger.error(s"$file Conversion failed !")
+          failMessage
+      }
+    }
+
+    fileReadObject.convertReadMeExtensions()
+    logger.info("Restored back the ReadMe.md file extension in Installation Guide")
+
+    if (statusList.contains("Failure")) {
+      "[ERROR]: Some Files Failed To Convert"
+    }
+    else {
+      "[SUCCESS]: All files converted successfully."
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/MdFileHandler.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/MdFileHandler.scala b/src/main/scala/MdFileHandler.scala
new file mode 100644
index 0000000..6fae74e
--- /dev/null
+++ b/src/main/scala/MdFileHandler.scala
@@ -0,0 +1,54 @@
+import com.google.inject.Inject
+import org.slf4j.{Logger, LoggerFactory}
+import services.{FileService, ConfService}
+
+import scala.util.matching.Regex
+
+class MdFileHandler @Inject()(confService: ConfService, fileService: FileService) {
+
+  val logger: Logger = LoggerFactory.getLogger(classOf[MdFileHandler])
+
+  /**
+    * converts .md extension to .html extension
+    * changes location of image from local to git repository
+    *
+    * @param input
+    * @return contents of file
+    */
+  def convertMdExtensions(input: String): String = {
+    val modifyContentPattern: Regex = new Regex("id=\"user-content-")
+    val modifyMdPattern: Regex = new Regex(".md")
+    val modifyImagePattern: Regex = new Regex("<img src=\"../docs")
+    val modifyHttpsFileLink: Regex ="""(<a href=\"https)://([a-zA-Z0-9-/.]+)(\")""".r
+    val modifyHttpFileLink: Regex ="""(<a href=\"http)://([a-zA-Z0-9-/.]+)(\")""".r
+    val replacingImageContent: String = "<img src=\"https://github.com/apache/carbondata/blob/master/docs"
+    val contentAfterRemovingUserContent: String = modifyContentPattern replaceAllIn(input, "id=\"")
+    val contentAfterReplacingId: String = modifyMdPattern replaceAllIn(contentAfterRemovingUserContent, ".html")
+    val contentAfterReplacingImage: String = modifyImagePattern replaceAllIn(contentAfterReplacingId,replacingImageContent)
+    val contentAfterReplacingHttpsFileLink: String = modifyHttpsFileLink replaceAllIn(contentAfterReplacingImage, "$1://$2$3 target=_blank")
+    val contentAfterReplacingFileLink: String = modifyHttpFileLink replaceAllIn(contentAfterReplacingHttpsFileLink, "$1://$2$3 target=_blank")
+    contentAfterReplacingFileLink
+  }
+
+  /**
+    * This handles the exeception cases for retaining .md extensions in some files
+    *
+    * @return list of files
+    */
+  def convertReadMeExtensions(): List[String] = {
+    val listOfFiles: List[String] = confService.readListOfString("fileListToRetain")
+    logger.info(s"List of files to retain .md extensions : $listOfFiles")
+    val location: String = confService.readString("outputFileLocation")
+    val outputFileExtension: String = ".html"
+    val modifyMdPattern: Regex = new Regex("(README)(.html)")
+    listOfFiles.map { file =>
+      val fileURLContent: String = fileService.readFromFile("src/main/webapp/" + file + outputFileExtension)
+      val fileContent: String = modifyMdPattern replaceAllIn(fileURLContent, "$1.md")
+      fileService.writeToFile(location + file + outputFileExtension, fileContent)
+      fileContent
+    }
+
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/MdFilehandler.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/MdFilehandler.scala b/src/main/scala/MdFilehandler.scala
deleted file mode 100644
index 2d065f9..0000000
--- a/src/main/scala/MdFilehandler.scala
+++ /dev/null
@@ -1,86 +0,0 @@
-import java.io.{File, PrintWriter}
-
-import com.typesafe.config.ConfigFactory
-import org.apache.http.HttpResponse
-import org.apache.http.client.methods.HttpPost
-import org.apache.http.impl.client.DefaultHttpClient
-import org.apache.http.util.EntityUtils
-import org.slf4j.LoggerFactory
-
-import scala.util.matching.Regex
-import scala.collection.JavaConverters._
-
-/**
-  * Created by pallavi on 4/4/17.
-  */
-class MdFilehandler {
-
-  val logger = LoggerFactory.getLogger(classOf[MdFilehandler])
-
-  /**
-    * converts .md extension to .html extension
-    * changes location of image from local to git repository
-    *
-    * @param input
-    * @return contents of file
-    */
-  def ConvertMdExtension(input: String): String = {
-    val modifyContentPattern = new Regex("id=\"user-content-")
-    val modifyMdPattern = new Regex(".md")
-    val modifyImagePattern = new Regex("<img src=\"../docs")
-    val modifyHttpsFileLink ="""(<a href=\"https)://([a-zA-Z0-9-/.]+)(\")""".r
-    val modifyHttpFileLink ="""(<a href=\"http)://([a-zA-Z0-9-/.]+)(\")""".r
-    val contentAfterRemovingUserContent: String = modifyContentPattern replaceAllIn(input, "id=\"")
-    val contentAfterReplacingId: String = modifyMdPattern replaceAllIn(contentAfterRemovingUserContent, ".html")
-    val contentAfterReplacingImage: String = modifyImagePattern replaceAllIn(contentAfterReplacingId, "<img src=\"https://github.com/apache/incubator-carbondata/blob/master/docs")
-    val contentAfterReplacingHttpsFileLink: String = modifyHttpsFileLink replaceAllIn(contentAfterReplacingImage, "$1://$2$3 target=_blank")
-    val contentAfterReplacingFileLink: String = modifyHttpFileLink replaceAllIn(contentAfterReplacingHttpsFileLink, "$1://$2$3 target=_blank")
-    contentAfterReplacingFileLink
-  }
-
-  def ConvertReadMeExtension(): List[String] = {
-    val listOfFiles = ConfigFactory.load().getStringList("fileListToRetain").asScala.toList
-    logger.info(s"List of files to retain .md extensions : $listOfFiles")
-    val location = ConfigFactory.load().getString("outputFileLocation")
-    val outputFileExtension = ".html"
-    val modifyMdPattern = new Regex("(README)(.html)")
-
-    listOfFiles.map { file =>
-      val fileURLContent = scala.io.Source.fromFile("src/main/webapp/" + file + outputFileExtension).mkString
-      val writer = new PrintWriter(new File(location + file + outputFileExtension))
-      val fileContent = modifyMdPattern replaceAllIn(fileURLContent, "$1.md")
-      writer.write(fileContent)
-      writer.close()
-      fileContent
-    }
-
-  }
-
-  /**
-    * gets content of the file through rest call
-    *
-    * @param data file Url
-    * @return contents of the file in responseBody if found else None is returned
-    */
-  def getFileContent(data: String): Option[String] = {
-    val httpClient = new DefaultHttpClient()
-    val httpRequest: HttpPost = new HttpPost(ConfigFactory.load().getString("mdLink"));
-    httpRequest.setHeader("Content-type", "text/plain")
-
-    import org.apache.http.entity.StringEntity;
-    val test = new StringEntity(data)
-    httpRequest.setEntity(test)
-    val httpResponse: HttpResponse = httpClient.execute(httpRequest)
-    val responseBody = EntityUtils.toString(httpResponse.getEntity())
-    logger.info(s"status : {${httpResponse.getStatusLine.toString.contains("OK")}}")
-    if (httpResponse.getStatusLine.toString.contains("OK"))
-      Some(responseBody.toString)
-    else {
-      logger.error(s"Fetching file fails {${httpResponse.getStatusLine}}")
-      None
-    }
-
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/Module.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/Module.scala b/src/main/scala/Module.scala
new file mode 100644
index 0000000..0a6d95f
--- /dev/null
+++ b/src/main/scala/Module.scala
@@ -0,0 +1,10 @@
+import com.google.inject.AbstractModule
+import services.{ConfServiceImpl, FileService, FileServiceImpl, DataServiceImpl, ConfService, DataService}
+
+class Module extends AbstractModule {
+  override def configure(): Unit = {
+    bind(classOf[FileService]).to(classOf[FileServiceImpl])
+    bind(classOf[ConfService]).to(classOf[ConfServiceImpl])
+    bind(classOf[DataService]).to(classOf[DataServiceImpl])
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/WebsiteLauncher.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/WebsiteLauncher.scala b/src/main/scala/WebsiteLauncher.scala
new file mode 100644
index 0000000..7919987
--- /dev/null
+++ b/src/main/scala/WebsiteLauncher.scala
@@ -0,0 +1,13 @@
+import org.slf4j.{Logger, LoggerFactory}
+import services.{ConfServiceImpl, FileServiceImpl, DataServiceImpl}
+
+object WebsiteLauncher  {
+  def main(args: Array[String]):Unit= {
+    val logger: Logger = LoggerFactory.getLogger("FileOperationMain")
+
+    val fileObject: MDFileConverter = new MDFileConverter(new FileServiceImpl,new ConfServiceImpl,new DataServiceImpl)
+
+    val status: String = fileObject.convertToHtml()
+    logger.info(s"File Conversion to html : $status")
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/services/ConfService.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/services/ConfService.scala b/src/main/scala/services/ConfService.scala
new file mode 100644
index 0000000..a245dbf
--- /dev/null
+++ b/src/main/scala/services/ConfService.scala
@@ -0,0 +1,9 @@
+package services
+
+trait ConfService {
+
+  def readString(key: String): String
+
+  def readListOfString(key: String): List[String]
+
+}

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/services/ConfServiceImpl.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/services/ConfServiceImpl.scala b/src/main/scala/services/ConfServiceImpl.scala
new file mode 100644
index 0000000..31ff696
--- /dev/null
+++ b/src/main/scala/services/ConfServiceImpl.scala
@@ -0,0 +1,32 @@
+package services
+
+import com.typesafe.config.ConfigFactory
+import org.slf4j.{Logger, LoggerFactory}
+
+import scala.collection.JavaConverters._
+
+class ConfServiceImpl extends ConfService {
+  val logger: Logger = LoggerFactory.getLogger(classOf[ConfServiceImpl])
+
+  /**
+    * Reads a filename from application.conf file
+    *
+    * @param key key in conf file having String
+    * @return string
+    */
+  def readString(key: String): String = {
+    ConfigFactory.load().getString(key)
+  }
+
+  /**
+    * Reads list of filename from application.conf file
+    *
+    * @param key key in conf file having Array of String
+    * @return list of string
+    */
+  def readListOfString(key: String): List[String] = {
+    val listOfFiles: List[String] = ConfigFactory.load().getStringList(key).asScala.toList
+    logger.info(s"List of files to be processed : $listOfFiles")
+    listOfFiles
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/services/DataService.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/services/DataService.scala b/src/main/scala/services/DataService.scala
new file mode 100644
index 0000000..fbf3156
--- /dev/null
+++ b/src/main/scala/services/DataService.scala
@@ -0,0 +1,7 @@
+package services
+
+trait DataService {
+  def dataOnPostRequest(fileUrl: String): Option[String]
+
+  def dataOnGetRequest(fileUrl: String): String
+}

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/services/DataServiceImpl.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/services/DataServiceImpl.scala b/src/main/scala/services/DataServiceImpl.scala
new file mode 100644
index 0000000..38cf0b1
--- /dev/null
+++ b/src/main/scala/services/DataServiceImpl.scala
@@ -0,0 +1,51 @@
+package services
+
+import com.typesafe.config.ConfigFactory
+import org.apache.http.HttpResponse
+import org.apache.http.client.methods.HttpPost
+import org.apache.http.entity.StringEntity
+import org.apache.http.impl.client.HttpClients
+import org.apache.http.util.EntityUtils
+import org.slf4j.{Logger, LoggerFactory}
+
+class DataServiceImpl extends DataService {
+  val logger: Logger = LoggerFactory.getLogger(classOf[ConfServiceImpl])
+
+  /**
+    * gets content of the file through rest call
+    *
+    * @param fileUrl file Url
+    * @return contents of the file in responseBody if found else None is returned
+    */
+  def dataOnPostRequest(fileUrl: String): Option[String] = {
+    val httpClient = HttpClients.createDefault()
+    val httpRequest: HttpPost = new HttpPost(ConfigFactory.load().getString("mdLink"))
+    httpRequest.setHeader("Content-type", "text/plain")
+
+    val test: StringEntity = new StringEntity(fileUrl)
+    httpRequest.setEntity(test)
+    val httpResponse: HttpResponse = httpClient.execute(httpRequest)
+    val responseBody: String = EntityUtils.toString(httpResponse.getEntity)
+    if (httpResponse.getStatusLine.toString.contains("OK")) {
+      logger.info(s"status : {${httpResponse.getStatusLine.toString.contains("OK")}}")
+      Some(responseBody.toString)
+    }
+    else {
+      logger.error(s"Fetching the file fails with the status {${httpResponse.getStatusLine}}")
+      None
+    }
+
+  }
+
+  /**
+    * get content of file on get request
+    *
+    * @param fileUrl file url
+    * @return contents of the file
+    */
+  def dataOnGetRequest(fileUrl: String): String = {
+    scala.io.Source.fromURL(fileUrl).mkString
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/services/FileService.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/services/FileService.scala b/src/main/scala/services/FileService.scala
new file mode 100644
index 0000000..308e524
--- /dev/null
+++ b/src/main/scala/services/FileService.scala
@@ -0,0 +1,7 @@
+package services
+
+trait FileService {
+  def writeToFile(path: String, data: String): Boolean
+
+  def readFromFile(path: String): String
+}

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/scala/services/FileServiceImpl.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/services/FileServiceImpl.scala b/src/main/scala/services/FileServiceImpl.scala
new file mode 100644
index 0000000..7383414
--- /dev/null
+++ b/src/main/scala/services/FileServiceImpl.scala
@@ -0,0 +1,43 @@
+package services
+
+import java.io.{File, PrintWriter}
+
+import org.slf4j.{Logger, LoggerFactory}
+
+class FileServiceImpl extends FileService {
+
+  val logger: Logger = LoggerFactory.getLogger("FileService")
+
+  /**
+    * writes file to the destination provided by path parameter
+    *
+    * @param path storage location of the file
+    * @param data contents of the file
+    */
+  def writeToFile(path: String, data: String): Boolean = {
+    try {
+      val writer: PrintWriter = new PrintWriter(new File(path))
+      writer.write(data)
+      writer.close()
+      true
+    }
+    catch {
+      case ex: Exception =>
+        logger.error(s"Failed to write the file at path $path, with the following exception $ex")
+        false
+    }
+  }
+
+  def readFromFile(path: String): String = {
+    val fileTest: File = new File(path)
+    if (fileTest.isFile && fileTest.exists()) {
+      scala.io.Source.fromFile(path).mkString
+    }
+    else {
+      logger.error(s"Failed to read file from location $path")
+      logger.info("Returning empty content")
+      ""
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/configuration-parameters.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/configuration-parameters.html b/src/main/webapp/configuration-parameters.html
index 63943eb..26af266 100644
--- a/src/main/webapp/configuration-parameters.html
+++ b/src/main/webapp/configuration-parameters.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/data-management.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/data-management.html b/src/main/webapp/data-management.html
index b3a9c99..b0fc15e 100644
--- a/src/main/webapp/data-management.html
+++ b/src/main/webapp/data-management.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/ddl-operation-on-carbondata.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/ddl-operation-on-carbondata.html b/src/main/webapp/ddl-operation-on-carbondata.html
index 81e8664..ad03f57 100644
--- a/src/main/webapp/ddl-operation-on-carbondata.html
+++ b/src/main/webapp/ddl-operation-on-carbondata.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/dml-operation-on-carbondata.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/dml-operation-on-carbondata.html b/src/main/webapp/dml-operation-on-carbondata.html
index e0c234e..200ddd3 100644
--- a/src/main/webapp/dml-operation-on-carbondata.html
+++ b/src/main/webapp/dml-operation-on-carbondata.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/faq.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/faq.html b/src/main/webapp/faq.html
index 54fcc09..8b9bcc7 100644
--- a/src/main/webapp/faq.html
+++ b/src/main/webapp/faq.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/file-structure-of-carbondata.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/file-structure-of-carbondata.html b/src/main/webapp/file-structure-of-carbondata.html
index 985b116..053ddc3 100644
--- a/src/main/webapp/file-structure-of-carbondata.html
+++ b/src/main/webapp/file-structure-of-carbondata.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/installation-guide.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/installation-guide.html b/src/main/webapp/installation-guide.html
index fd31349..9edae64 100644
--- a/src/main/webapp/installation-guide.html
+++ b/src/main/webapp/installation-guide.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/quick-start-guide.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/quick-start-guide.html b/src/main/webapp/quick-start-guide.html
index 633bc6c..0211362 100644
--- a/src/main/webapp/quick-start-guide.html
+++ b/src/main/webapp/quick-start-guide.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/supported-data-types-in-carbondata.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/supported-data-types-in-carbondata.html b/src/main/webapp/supported-data-types-in-carbondata.html
index 9757fb3..bc455dc 100644
--- a/src/main/webapp/supported-data-types-in-carbondata.html
+++ b/src/main/webapp/supported-data-types-in-carbondata.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/troubleshooting.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/troubleshooting.html b/src/main/webapp/troubleshooting.html
index 7ae7dc7..3d9d711 100644
--- a/src/main/webapp/troubleshooting.html
+++ b/src/main/webapp/troubleshooting.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/main/webapp/useful-tips-on-carbondata.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/useful-tips-on-carbondata.html b/src/main/webapp/useful-tips-on-carbondata.html
index b5ff71c..fbce733 100644
--- a/src/main/webapp/useful-tips-on-carbondata.html
+++ b/src/main/webapp/useful-tips-on-carbondata.html
@@ -76,6 +76,9 @@
                                 <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md"
                                    target="_blank">Contributing to CarbonData</a></li>
                             <li>
+                                <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/release-guide.md"
+                                   target="_blank">Release Guide</a></li>
+                            <li>
                                 <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list"
                                    target="_blank">Project PPMC and Committers</a></li>
                             <li>

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/test/resources/scalastyle_config.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/scalastyle_config.xml b/src/test/resources/scalastyle_config.xml
new file mode 100644
index 0000000..da6ff5a
--- /dev/null
+++ b/src/test/resources/scalastyle_config.xml
@@ -0,0 +1,181 @@
+<scalastyle commentFilter="enabled">
+    <name>Scalastyle standard configuration</name>
+    <check class="org.scalastyle.file.FileTabChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.file.FileLengthChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="maxFileLength"><![CDATA[800]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.file.HeaderMatchesChecker" level="warning" enabled="false">
+        <parameters>
+            <parameter name="header"><![CDATA[ /*
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.SpacesAfterPlusChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.file.WhitespaceEndOfLineChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="ignoreWhitespaceLines"><![CDATA[false]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.SpacesBeforePlusChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.file.FileLineLengthChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="maxLineLength"><![CDATA[160]]></parameter>
+            <parameter name="tabSize"><![CDATA[4]]></parameter>
+            <parameter name="ignoreImports"><![CDATA[false]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.ClassNamesChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="regex"><![CDATA[^[A-Z][A-Za-z]*$]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.ObjectNamesChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="regex"><![CDATA[^[A-Z][A-Za-z]*$]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.PackageObjectNamesChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="regex"><![CDATA[^[a-z][A-Za-z]*$]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.EqualsHashCodeChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.IllegalImportsChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="illegalImports"><![CDATA[sun._,java.awt._]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.ParameterNumberChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="maxParameters"><![CDATA[8]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.MagicNumberChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="ignore"><![CDATA[-1,0,1,2,3]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.ReturnChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.NullChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.NoCloneChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.NoFinalizeChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.CovariantEqualsChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.StructuralTypeChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.file.RegexChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="regex"><![CDATA[println]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.NumberOfTypesChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="maxTypes"><![CDATA[30]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.CyclomaticComplexityChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="maximum"><![CDATA[10]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.UppercaseLChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.SimplifyBooleanExpressionChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.IfBraceChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="singleLineAllowed"><![CDATA[true]]></parameter>
+            <parameter name="doubleLineAllowed"><![CDATA[false]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.MethodLengthChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="maxLength"><![CDATA[50]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.MethodNamesChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9]*(_=)?$]]></parameter>
+            <parameter name="ignoreRegex"><![CDATA[^$]]></parameter>
+            <parameter name="ignoreOverride"><![CDATA[false]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.NumberOfMethodsInTypeChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="maxMethods"><![CDATA[30]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="ignoreOverride"><![CDATA[false]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.file.NewLineAtEofChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.file.NoNewLineAtEofChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.scalariform.WhileChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.scalariform.VarFieldChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.scalariform.VarLocalChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.scalariform.RedundantIfChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.scalariform.TokenChecker" level="warning" enabled="false">
+        <parameters>
+            <parameter name="regex"><![CDATA[println]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.DeprecatedJavaChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.EmptyClassChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.ClassTypeParameterChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="regex"><![CDATA[^[A-Z_]$]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.UnderscoreImportChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.LowercasePatternMatchChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.EmptyInterpolatedStringChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.MultipleStringLiteralsChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="allowed"><![CDATA[2]]></parameter>
+            <parameter name="ignoreRegex"><![CDATA[^""$]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.ImportGroupingChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.NotImplementedErrorUsage" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.BlockImportChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.scalariform.ProcedureDeclarationChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.ForBraceChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.SpaceAfterCommentStartChecker" level="warning" enabled="true"></check>
+    <check class="org.scalastyle.scalariform.ScalaDocChecker" level="warning" enabled="false">
+        <parameters>
+            <parameter name="ignoreRegex"><![CDATA[^$]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.DisallowSpaceAfterTokenChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.scalariform.DisallowSpaceBeforeTokenChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.scalariform.EnsureSingleSpaceAfterTokenChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.scalariform.EnsureSingleSpaceBeforeTokenChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.scalariform.NonASCIICharacterChecker" level="warning" enabled="false"></check>
+    <check class="org.scalastyle.file.IndentationChecker" level="warning" enabled="false">
+        <parameters>
+            <parameter name="tabSize"><![CDATA[2]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.FieldNamesChecker" level="warning" enabled="false">
+        <parameters>
+            <parameter name="regex"><![CDATA[^[a-z][A-Za-z]*$]]></parameter>
+        </parameters>
+    </check>
+    <check class="org.scalastyle.scalariform.TodoCommentChecker" level="warning" enabled="true">
+        <parameters>
+            <parameter name="words"><![CDATA[TODO|FIXME]]></parameter>
+        </parameters>
+    </check>
+</scalastyle>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/test/scala/MDFileConverterSpec.scala
----------------------------------------------------------------------
diff --git a/src/test/scala/MDFileConverterSpec.scala b/src/test/scala/MDFileConverterSpec.scala
new file mode 100644
index 0000000..92d11e6
--- /dev/null
+++ b/src/test/scala/MDFileConverterSpec.scala
@@ -0,0 +1,36 @@
+
+import org.mockito.Mockito.when
+import org.scalatest.FlatSpec
+import org.scalatest.mockito.MockitoSugar
+import org.slf4j.{Logger, LoggerFactory}
+import services.{FileServiceImpl, ConfService, DataService}
+
+class MDFileConverterSpec extends FlatSpec with MockitoSugar {
+  val logger: Logger = LoggerFactory.getLogger("FileModificationSpec")
+  val fileServiceMock: FileServiceImpl = mock[FileServiceImpl]
+  val dataServiceMock: DataService = mock[DataService]
+  val data = "some data"
+  val convertedData = "some converted data"
+  val confServiceMock: ConfService = mock[ConfService]
+  when(confServiceMock.readString("apiUrl")).thenReturn("fake-url/")
+  when(confServiceMock.readString("outputFileLocation")).thenReturn("fake-location/")
+  when(confServiceMock.readString("headerPath")).thenReturn("headerUrl")
+  when(confServiceMock.readString("footerPath")).thenReturn("footerUrl")
+  when(fileServiceMock.readFromFile("headerUrl")).thenReturn("header-content")
+  when(fileServiceMock.readFromFile("footerUrl")).thenReturn("footer-content")
+  val mdFileHandlerMock: MdFileHandler = mock[MdFileHandler]
+  when(confServiceMock.readListOfString("fileList")).thenReturn(List("fake-file"))
+  when(dataServiceMock.dataOnGetRequest("fake-url/fake-file.md")).thenReturn(data)
+  when(dataServiceMock.dataOnPostRequest(data)).thenReturn(Some(convertedData))
+  when(mdFileHandlerMock.convertMdExtensions(convertedData)).thenReturn("data after md conversion")
+  when(fileServiceMock.writeToFile("fake-location/fake-file.html", "header-content" + convertedData + "footer-content")).thenReturn(true)
+  when(fileServiceMock.writeToFile("fake-mdlocation/fake-file.md", data)).thenReturn(true)
+  when(confServiceMock.readListOfString("fileListToRetain")).thenReturn(List("checking-readme-extension"))
+  when(fileServiceMock.readFromFile("src/main/webapp/checking-readme-extension.html"))thenReturn("<a href=\"README.html\"></a>")
+  when(fileServiceMock.writeToFile("fake-location/checking-readme-extension.html","<a href=\"README.md\"></a>")).thenReturn(true)
+  val fileModification = new MDFileConverter(fileServiceMock, confServiceMock, dataServiceMock)
+
+  it should "return successful convert list of files to html files" in {
+    assert(fileModification.convertToHtml() === "[SUCCESS]: All files converted successfully.")
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/test/scala/MdFileHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/src/test/scala/MdFileHandlerSpec.scala b/src/test/scala/MdFileHandlerSpec.scala
new file mode 100644
index 0000000..78beb68
--- /dev/null
+++ b/src/test/scala/MdFileHandlerSpec.scala
@@ -0,0 +1,38 @@
+import org.scalatest.{FlatSpec, FunSpec}
+import org.scalatest.mockito.MockitoSugar
+import org.mockito.Mockito.when
+import services.{ConfService, DataService, FileServiceImpl}
+
+class MdFileHandlerSpec extends FlatSpec with MockitoSugar {
+
+  val fileServiceMock: FileServiceImpl = mock[FileServiceImpl]
+  val dataServiceMock: DataService = mock[DataService]
+  val confServiceMock: ConfService = mock[ConfService]
+
+  val mdFileObject = new MdFileHandler(confServiceMock, fileServiceMock)
+
+  when(confServiceMock.readListOfString("fileListToRetain")).thenReturn(List("fake-file"))
+  when(confServiceMock.readString("outputFileLocation")).thenReturn("/fake-location")
+  when(fileServiceMock.readFromFile("src/main/webapp/fake-file.html")) thenReturn ("<a href=\"README.html\"></a>")
+  when(fileServiceMock.writeToFile("/fake-location/fake-file.html", "")) thenReturn (true)
+  it should "convert list of file content having readme.html extension to readme.md" in {
+    assert(mdFileObject.convertReadMeExtensions() === List("<a href=\"README.md\"></a>"))
+  }
+  it should "convert all md extension to html except readme link" in {
+    assert(mdFileObject.convertMdExtensions("<a href=\"link.md\"></a>") === "<a href=\"link.html\"></a>")
+  }
+  it should "convert all image tag link to github image directory link " in {
+    val expectedOutput = "<img src=\"https://github.com/apache/carbondata/blob/master/docs/img.jpg></img>"
+    assert(mdFileObject.convertMdExtensions("<img src=\"../docs/img.jpg></img>") === expectedOutput)
+  }
+  it should "add target=_blank in all link having http in href " in {
+    assert(mdFileObject.convertMdExtensions("<a href=\"http://github.com/something\"></a>") === "<a href=\"http://github.com/something\" target=_blank></a>")
+  }
+  it should "add target=_blank in all link having https in href " in {
+    assert(mdFileObject.convertMdExtensions("<a href=\"https://github.com/something\"></a>") === "<a href=\"https://github.com/something\" target=_blank></a>")
+  }
+  it should "remove user-content from all the ids in html " in {
+    assert(mdFileObject.convertMdExtensions("<h1 id=\"user-content-#pageid\"> </h1>") === "<h1 id=\"#pageid\"> </h1>")
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/carbondata-site/blob/d0f3baf8/src/test/scala/Service/FileServiceImplSpec.scala
----------------------------------------------------------------------
diff --git a/src/test/scala/Service/FileServiceImplSpec.scala b/src/test/scala/Service/FileServiceImplSpec.scala
new file mode 100644
index 0000000..4278239
--- /dev/null
+++ b/src/test/scala/Service/FileServiceImplSpec.scala
@@ -0,0 +1,30 @@
+package Service
+
+import java.io.File
+
+import org.scalatest.{FlatSpec, FunSuite}
+import services.FileServiceImpl
+
+class FileServiceImplSpec extends FlatSpec {
+
+  val fileServiceObject = new FileServiceImpl
+  val fileContent = "some testing on writing a file"
+  val fileLocation = "src/test/scala/Service/tempread.txt"
+  it should "throw error to write a file on non existing location" in {
+    assert(fileServiceObject.writeToFile("", "") === false)
+  }
+  it should "write a file on temp location " in {
+    assert(fileServiceObject.writeToFile("src/test/scala/Service/temp.txt", fileContent) === true)
+    new File("src/test/scala/Service/temp.txt").delete()
+  }
+
+  it should "throw error to read a file on non existing location" in {
+    assert(fileServiceObject.readFromFile("/fake-Location") === "")
+  }
+
+  it should "read data from a file correctly" in {
+    fileServiceObject.writeToFile(fileLocation, fileContent)
+    assert(fileServiceObject.readFromFile(fileLocation) === fileContent)
+    new File(fileLocation).delete()
+  }
+}


Mime
View raw message