org.eclipse.mylyn.wikitext.tests_1.6.1.v20120425-0100

16:47:08.098 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.wikitext.tests_1.6.1.v20120425-0100.jar
package org.eclipse.mylyn.wikitext.ui;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylyn.internal.wikitext.core.WikiTextPlugin;
import org.eclipse.mylyn.internal.wikitext.ui.editor.MarkupEditor;
import org.eclipse.mylyn.wikitext.confluence.core.ConfluenceLanguage;
import org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage;
import org.eclipse.mylyn.wikitext.tests.AbstractTestInWorkspace;
import org.eclipse.mylyn.wikitext.tests.HeadRequired;
import org.eclipse.mylyn.wikitext.textile.core.TextileLanguage;
import org.eclipse.mylyn.wikitext.tracwiki.core.TracWikiLanguage;
import org.eclipse.mylyn.wikitext.twiki.core.TWikiLanguage;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;

@HeadRequired
public class FileTypesTest
  extends AbstractTestInWorkspace
{
  private IProject project;
  
  protected void setUp()
    throws Exception
  {
    super.setUp();
    project = createSimpleProject();
  }
  
  public void testTextileFileType()
    throws CoreException
  {
    IFile file = project.getFile("test.textile");
    file.create(createSimpleTextileContent(), false, new NullProgressMonitor());
    
    editorAsserts(file, TextileLanguage.class);
  }
  
  public void testTextileFileTypeChangeIsSticky()
    throws CoreException
  {
    IFile file = project.getFile("test.textile");
    file.create(createSimpleTextileContent(), false, new NullProgressMonitor());
    
    IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IEditorPart editor = IDE.openEditor(workbenchPage, file);
    assertInstanceOf(MarkupEditor.class, editor);
    MarkupEditor markupEditor = (MarkupEditor)editor;
    assertInstanceOf(TextileLanguage.class, markupEditor.getMarkupLanguage());
    
    markupEditor.setMarkupLanguage(WikiTextPlugin.getDefault().getMarkupLanguage("MediaWiki"), true);
    assertInstanceOf(MediaWikiLanguage.class, markupEditor.getMarkupLanguage());
    
    workbenchPage.closeEditor(editor, false);
    
    editor = IDE.openEditor(workbenchPage, file);
    markupEditor = (MarkupEditor)editor;
    
    assertInstanceOf(MediaWikiLanguage.class, markupEditor.getMarkupLanguage());
  }
  
  public void testMediaWikiFileType()
    throws CoreException
  {
    IFile file = project.getFile("test.mediawiki");
    file.create(createSimpleMediaWikiContent(), false, new NullProgressMonitor());
    
    editorAsserts(file, MediaWikiLanguage.class);
  }
  
  public void testTracWikiFileType()
    throws CoreException
  {
    IFile file = project.getFile("test.tracwiki");
    file.create(createSimpleMediaWikiContent(), false, new NullProgressMonitor());
    
    editorAsserts(file, TracWikiLanguage.class);
  }
  
  public void testTWikiFileType()
    throws CoreException
  {
    IFile file = project.getFile("test.twiki");
    file.create(createSimpleMediaWikiContent(), false, new NullProgressMonitor());
    
    editorAsserts(file, TWikiLanguage.class);
  }
  
  public void testConfluenceFileType()
    throws CoreException
  {
    IFile file = project.getFile("test.confluence");
    file.create(createSimpleMediaWikiContent(), false, new NullProgressMonitor());
    
    editorAsserts(file, ConfluenceLanguage.class);
  }
  
  private void editorAsserts(IFile file, Class<?> markupLanguageClass)
    throws PartInitException
  {
    IEditorPart editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file);
    assertInstanceOf(MarkupEditor.class, editor);
    MarkupEditor markupEditor = (MarkupEditor)editor;
    assertInstanceOf(markupLanguageClass, markupEditor.getMarkupLanguage());
  }
  
  private void assertInstanceOf(Class<?> clazz, Object o)
  {
    if ((o != null) && (clazz.isAssignableFrom(o.getClass()))) {
      return;
    }
    fail("Expected instanceof " + clazz.getName() + " but found " + (o == null ? null : o.getClass().getName()));
  }
  
  private InputStream createSimpleTextileContent()
  {
    return new ByteArrayInputStream("h1. Heading\n\ncontent\n".getBytes());
  }
  
  private InputStream createSimpleMediaWikiContent()
  {
    return new ByteArrayInputStream("= Heading =\n\ncontent\n".getBytes());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.ui.FileTypesTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.ui.annotation;

import junit.framework.TestCase;
import org.eclipse.mylyn.wikitext.tests.HeadRequired;

@HeadRequired
public class AnchorHrefAnnotationTest
  extends TestCase
{
  public void testSimple()
  {
    String href = "http://foo.bar";
    AnchorHrefAnnotation annotation = new AnchorHrefAnnotation(href);
    assertEquals(href, annotation.getAnchorHref());
    assertEquals("org.eclipse.mylyn.wikitext.ui.annotation.anchor", annotation.getType());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.ui.annotation.AnchorHrefAnnotationTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.ui.annotation;

import junit.framework.TestCase;
import org.eclipse.mylyn.wikitext.tests.HeadRequired;

@HeadRequired
public class ClassAnnotationTest
  extends TestCase
{
  public void testSimple()
  {
    ClassAnnotation annotation = new ClassAnnotation("foo");
    assertEquals("foo", annotation.getCssClass());
    assertEquals("org.eclipse.mylyn.wikitext.ui.annotation.class", annotation.getType());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.ui.annotation.ClassAnnotationTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.ui.annotation;

import junit.framework.TestCase;
import org.eclipse.mylyn.wikitext.tests.HeadRequired;

@HeadRequired
public class IdAnnotationTest
  extends TestCase
{
  public void testSimple()
  {
    IdAnnotation annotation = new IdAnnotation("foo");
    assertEquals("foo", annotation.getText());
    assertEquals(annotation.getType(), "org.eclipse.mylyn.wikitext.ui.annotation.id");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.ui.annotation.IdAnnotationTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.ui.annotation;

import junit.framework.TestCase;
import org.eclipse.mylyn.wikitext.tests.HeadRequired;

@HeadRequired
public class TitleAnnotationTest
  extends TestCase
{
  public void testSimple()
  {
    TitleAnnotation annotation = new TitleAnnotation("title", "type");
    assertEquals("title", annotation.getTitle());
    assertEquals("type", annotation.getTitleType());
    assertEquals("org.eclipse.mylyn.wikitext.ui.annotation.title", annotation.getType());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.ui.annotation.TitleAnnotationTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.ui.annotation;

import junit.framework.TestCase;
import org.eclipse.mylyn.wikitext.tests.HeadRequired;

@HeadRequired
public class AnchorNameAnnotationTest
  extends TestCase
{
  public void testSimple()
  {
    AnchorNameAnnotation annotation = new AnchorNameAnnotation("foo");
    assertEquals("foo", annotation.getText());
    assertEquals("org.eclipse.mylyn.wikitext.ui.annotation.anchorName", annotation.getType());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.ui.annotation.AnchorNameAnnotationTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import junit.framework.TestCase;
import org.eclipse.mylyn.wikitext.core.parser.MarkupParser;
import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
import org.eclipse.mylyn.wikitext.tests.NoDiscovery;
import org.eclipse.mylyn.wikitext.tests.TestUtil;

@NoDiscovery
abstract class MarkupFilesTest$AbstractMarkupFileCase
  extends TestCase
{
  protected final MarkupLanguage markupLanguage;
  
  public MarkupFilesTest$AbstractMarkupFileCase(MarkupLanguage markupLanguage)
  {
    this.markupLanguage = markupLanguage.clone();
  }
  
  protected void runTest()
    throws Throwable
  {
    String markupContent = readMarkupContent();
    String expectedContent = readExpectedContent();
    
    MarkupParser parser = new MarkupParser(markupLanguage);
    
    String html = parser.parseToHtml(markupContent);
    
    TestUtil.println("**************\nTesting - " + getName());
    TestUtil.println("Generated:\n" + html);
    TestUtil.println("Expecting:\n" + expectedContent);
    
    assertTrue(html.contains(expectedContent));
  }
  
  protected abstract String readExpectedContent()
    throws IOException;
  
  protected abstract String readMarkupContent()
    throws IOException;
  
  protected String readFully(InputStream in)
    throws IOException
  {
    Reader reader = new InputStreamReader(in);
    try
    {
      StringWriter writer = new StringWriter();
      int i;
      while ((i = reader.read()) != -1)
      {
        int i;
        writer.write(i);
      }
      return writer.toString();
    }
    finally
    {
      reader.close();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.MarkupFilesTest.AbstractMarkupFileCase
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import junit.framework.TestCase;

public class LocationTrackingReaderTest
  extends TestCase
{
  public void testCharOffset()
    throws IOException
  {
    String content = "aaflkjsdf \nas;dfj asl;fj\r\naslfkjasd";
    int count = 0;
    LocationTrackingReader reader = new LocationTrackingReader(new StringReader(content), 16);
    int c;
    while ((c = reader.read()) != -1)
    {
      int c;
      count++;
      assertEquals(content.charAt(count - 1), (char)c);
      assertEquals(count - 1, reader.getOffset());
    }
    assertEquals(content.length(), count);
  }
  
  public void testReadLine()
    throws IOException
  {
    String content = "\rabc\ndef\r\rfoo bar";
    int bufSize = 3;
    int[] lineOffsets = { 0, 1, 5, 9, 10, 17 };
    
    doTest(content, lineOffsets, bufSize);
  }
  
  private void doTest(String content, int[] lineOffsets, int bufSize)
    throws IOException
  {
    LocationTrackingReader reader = new LocationTrackingReader(new StringReader(content), bufSize);
    BufferedReader refReader = new BufferedReader(new StringReader(content));
    
    int lineNumber = 0;
    String testLine = null;
    String refLine = null;
    do
    {
      int expectedOffset = lineOffsets[(lineNumber++)];
      testLine = reader.readLine();
      refLine = refReader.readLine();
      
      assertEquals(refLine, testLine);
      assertEquals(expectedOffset, reader.getLineOffset());
      assertEquals(lineNumber - 1, reader.getLineNumber());
    } while ((testLine != null) && (refLine != null));
    assertTrue(refLine == null);
    assertTrue(testLine == null);
  }
  
  public void testReadLineWithWindowsNewlines()
    throws IOException
  {
    String content = "abc\r\ndef\r\n\r\nfoo bar";
    int bufSize = 3;
    int[] lineOffsets = { 0, 5, 10, 12, 19 };
    
    doTest(content, lineOffsets, bufSize);
  }
  
  public void testReadLineWithTerminatingEOLs()
    throws IOException
  {
    String content = "abc\n";
    int bufSize = 3;
    int[] lineOffsets = { 0, 4 };
    
    doTest(content, lineOffsets, bufSize);
    
    content = "abc\r\n";
    bufSize = 3;
    lineOffsets = new int[] { 0, 5 };
    
    doTest(content, lineOffsets, bufSize);
    
    content = "abc\r";
    bufSize = 3;
    lineOffsets = new int[] { 0, 4 };
    
    doTest(content, lineOffsets, bufSize);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.util.LocationTrackingReaderTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.util.anttask;

import java.io.File;
import java.io.IOException;
import java.util.ResourceBundle;

public class MarkupToXslfoTaskTest
  extends AbstractTestAntTask
{
  private MarkupToXslfoTask task;
  
  protected void setUp()
    throws Exception
  {
    super.setUp();
    task = new MarkupToXslfoTask();
    task.setMarkupLanguage(languageName);
  }
  
  public void testSimpleOutput()
    throws IOException
  {
    File markup = createSimpleTextileMarkup();
    task.setFile(markup);
    task.execute();
    
    listFiles();
    
    File targetFile = new File(markup.getParentFile(), "markup.fo");
    assertTrue((targetFile.exists()) && (targetFile.isFile()));
    
    String content = getContent(targetFile);
    
    assertTrue(content.contains("<root xmlns=\"http://www.w3.org/1999/XSL/Format\""));
    assertTrue(content.contains("</root>"));
    assertTrue(content.contains(">markup</block>"));
    assertTrue(content.contains(" id=\"FirstHeading\">First Heading</block>"));
    assertTrue(content.contains(" id=\"SecondHeading\">Second Heading</block>"));
  }
  
  /* Error */
  protected File createSimpleTextileMarkup()
    throws IOException
  {
    // Byte code:
    //   0: new 79	java/io/File
    //   3: dup
    //   4: aload_0
    //   5: getfield 142	org/eclipse/mylyn/wikitext/core/util/anttask/MarkupToXslfoTaskTest:tempFolder	Ljava/io/File;
    //   8: ldc 10
    //   10: invokespecial 148	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   13: astore_1
    //   14: new 82	java/io/PrintWriter
    //   17: dup
    //   18: new 80	java/io/FileWriter
    //   21: dup
    //   22: aload_1
    //   23: invokespecial 149	java/io/FileWriter:<init>	(Ljava/io/File;)V
    //   26: invokespecial 152	java/io/PrintWriter:<init>	(Ljava/io/Writer;)V
    //   29: astore_2
    //   30: aload_2
    //   31: ldc 7
    //   33: invokevirtual 153	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   36: aload_2
    //   37: invokevirtual 151	java/io/PrintWriter:println	()V
    //   40: aload_2
    //   41: ldc 11
    //   43: invokevirtual 153	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   46: aload_2
    //   47: invokevirtual 151	java/io/PrintWriter:println	()V
    //   50: aload_2
    //   51: ldc 8
    //   53: invokevirtual 153	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   56: aload_2
    //   57: invokevirtual 151	java/io/PrintWriter:println	()V
    //   60: aload_2
    //   61: ldc 12
    //   63: invokevirtual 153	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   66: goto +10 -> 76
    //   69: astore_3
    //   70: aload_2
    //   71: invokevirtual 150	java/io/PrintWriter:close	()V
    //   74: aload_3
    //   75: athrow
    //   76: aload_2
    //   77: invokevirtual 150	java/io/PrintWriter:close	()V
    //   80: aload_1
    //   81: areturn
    // Line number table:
    //   Java source line #52	-> byte code offset #0
    //   Java source line #53	-> byte code offset #14
    //   Java source line #55	-> byte code offset #30
    //   Java source line #56	-> byte code offset #36
    //   Java source line #57	-> byte code offset #40
    //   Java source line #58	-> byte code offset #46
    //   Java source line #59	-> byte code offset #50
    //   Java source line #60	-> byte code offset #56
    //   Java source line #61	-> byte code offset #60
    //   Java source line #62	-> byte code offset #69
    //   Java source line #63	-> byte code offset #70
    //   Java source line #64	-> byte code offset #74
    //   Java source line #63	-> byte code offset #76
    //   Java source line #65	-> byte code offset #80
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	82	0	this	MarkupToXslfoTaskTest
    //   13	68	1	markupFile	File
    //   29	48	2	writer	java.io.PrintWriter
    //   69	6	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   30	69	69	finally
  }
  
  public void testTaskdef()
  {
    ResourceBundle bundle = ResourceBundle.getBundle(MarkupToXslfoTask.class.getPackage().getName() + ".tasks");
    assertEquals(MarkupToXslfoTask.class.getName(), bundle.getString("wikitext-to-xslfo"));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.util.anttask.MarkupToXslfoTaskTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.util.anttask;

import java.io.File;
import java.io.IOException;
import java.util.ResourceBundle;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MarkupToDocbookTaskTest
  extends AbstractTestAntTask
{
  private MarkupToDocbookTask task;
  
  protected void setUp()
    throws Exception
  {
    super.setUp();
    task = new MarkupToDocbookTask();
    task.setMarkupLanguage(languageName);
  }
  
  public void testSimpleOutput()
    throws IOException
  {
    File markup = createSimpleTextileMarkup();
    task.setFile(markup);
    task.execute();
    
    listFiles();
    
    File docbookFile = new File(markup.getParentFile(), "markup.xml");
    assertTrue((docbookFile.exists()) && (docbookFile.isFile()));
    
    String content = getContent(docbookFile);
    
    assertTrue(content.contains("<book"));
    assertTrue(content.contains("</book>"));
    assertTrue(content.contains("<title>markup</title>"));
    assertTrue(Pattern.compile(
      "<chapter id=\"FirstHeading\">\\s*<title>First Heading</title>\\s*<para>some content</para>\\s*</chapter>", 
      8)
      .matcher(content)
      .find());
    assertTrue(Pattern.compile(
      "<chapter id=\"SecondHeading\">\\s*<title>Second Heading</title>\\s*<para>some more content</para>\\s*</chapter>", 
      8)
      .matcher(content)
      .find());
  }
  
  public void testSimpleOutputAlternateTitle()
    throws IOException
  {
    File markup = createSimpleTextileMarkup();
    task.setFile(markup);
    task.setBookTitle("Alternate Title");
    task.execute();
    
    listFiles();
    
    File docbookFile = new File(markup.getParentFile(), "markup.xml");
    assertTrue((docbookFile.exists()) && (docbookFile.isFile()));
    
    String content = getContent(docbookFile);
    
    assertTrue(content.contains("<book"));
    assertTrue(content.contains("</book>"));
    assertTrue(content.contains("<title>Alternate Title</title>"));
    assertTrue(Pattern.compile(
      "<chapter id=\"FirstHeading\">\\s*<title>First Heading</title>\\s*<para>some content</para>\\s*</chapter>", 
      8)
      .matcher(content)
      .find());
    assertTrue(Pattern.compile(
      "<chapter id=\"SecondHeading\">\\s*<title>Second Heading</title>\\s*<para>some more content</para>\\s*</chapter>", 
      8)
      .matcher(content)
      .find());
  }
  
  /* Error */
  protected File createSimpleTextileMarkup()
    throws IOException
  {
    // Byte code:
    //   0: new 90	java/io/File
    //   3: dup
    //   4: aload_0
    //   5: getfield 161	org/eclipse/mylyn/wikitext/core/util/anttask/MarkupToDocbookTaskTest:tempFolder	Ljava/io/File;
    //   8: ldc 11
    //   10: invokespecial 167	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   13: astore_1
    //   14: new 93	java/io/PrintWriter
    //   17: dup
    //   18: new 91	java/io/FileWriter
    //   21: dup
    //   22: aload_1
    //   23: invokespecial 168	java/io/FileWriter:<init>	(Ljava/io/File;)V
    //   26: invokespecial 171	java/io/PrintWriter:<init>	(Ljava/io/Writer;)V
    //   29: astore_2
    //   30: aload_2
    //   31: ldc 9
    //   33: invokevirtual 172	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   36: aload_2
    //   37: invokevirtual 170	java/io/PrintWriter:println	()V
    //   40: aload_2
    //   41: ldc 13
    //   43: invokevirtual 172	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   46: aload_2
    //   47: invokevirtual 170	java/io/PrintWriter:println	()V
    //   50: aload_2
    //   51: ldc 10
    //   53: invokevirtual 172	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   56: aload_2
    //   57: invokevirtual 170	java/io/PrintWriter:println	()V
    //   60: aload_2
    //   61: ldc 14
    //   63: invokevirtual 172	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   66: goto +10 -> 76
    //   69: astore_3
    //   70: aload_2
    //   71: invokevirtual 169	java/io/PrintWriter:close	()V
    //   74: aload_3
    //   75: athrow
    //   76: aload_2
    //   77: invokevirtual 169	java/io/PrintWriter:close	()V
    //   80: aload_1
    //   81: areturn
    // Line number table:
    //   Java source line #92	-> byte code offset #0
    //   Java source line #93	-> byte code offset #14
    //   Java source line #95	-> byte code offset #30
    //   Java source line #96	-> byte code offset #36
    //   Java source line #97	-> byte code offset #40
    //   Java source line #98	-> byte code offset #46
    //   Java source line #99	-> byte code offset #50
    //   Java source line #100	-> byte code offset #56
    //   Java source line #101	-> byte code offset #60
    //   Java source line #102	-> byte code offset #69
    //   Java source line #103	-> byte code offset #70
    //   Java source line #104	-> byte code offset #74
    //   Java source line #103	-> byte code offset #76
    //   Java source line #105	-> byte code offset #80
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	82	0	this	MarkupToDocbookTaskTest
    //   13	68	1	markupFile	File
    //   29	48	2	writer	java.io.PrintWriter
    //   69	6	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   30	69	69	finally
  }
  
  public void testTaskdef()
  {
    ResourceBundle bundle = ResourceBundle.getBundle(MarkupToDocbookTask.class.getPackage().getName() + ".tasks");
    assertEquals(MarkupToDocbookTask.class.getName(), bundle.getString("wikitext-to-docbook"));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.util.anttask.MarkupToDocbookTaskTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.util.anttask;

import java.io.File;
import java.io.IOException;
import java.util.ResourceBundle;
import org.eclipse.mylyn.wikitext.tests.TestUtil;

public class MarkupToEclipseHelpTaskTest
  extends MarkupToHtmlTaskTest
{
  protected MarkupToHtmlTask createTask()
  {
    return new MarkupToEclipseHelpTask();
  }
  
  public void testSimpleOutput()
    throws IOException
  {
    super.testSimpleOutput();
    
    File tocFile = new File(tempFolder, "markup-toc.xml");
    assertTrue(tocFile.exists());
    
    String tocContent = getContent(tocFile);
    TestUtil.println(tocContent);
    
    assertTrue(tocContent.contains("<toc topic=\"markup.html\" label=\"markup\">"));
    assertTrue(tocContent.contains("<topic href=\"markup.html\" label=\"First Heading\""));
    assertTrue(tocContent.contains("<topic href=\"markup.html#SecondHeading\" label=\"Second Heading\""));
  }
  
  public void testMultipleFiles()
    throws IOException
  {
    super.testMultipleFiles();
    
    File tocFile = new File(tempFolder, "markup-toc.xml");
    assertTrue(tocFile.exists());
    
    String tocContent = getContent(tocFile);
    TestUtil.println(tocContent);
    
    assertTrue(tocContent.contains("<toc topic=\"markup.html\" label=\"markup\">"));
    assertTrue(tocContent.contains("<topic href=\"markup.html\" label=\"First Heading\""));
    assertTrue(tocContent.contains("<topic href=\"Second-Heading.html\" label=\"Second Heading\""));
  }
  
  public void testSimpleOutputAlternateTitle()
    throws IOException
  {
    super.testSimpleOutputAlternateTitle();
    
    File tocFile = new File(tempFolder, "markup-toc.xml");
    assertTrue(tocFile.exists());
    
    String tocContent = getContent(tocFile);
    TestUtil.println(tocContent);
    
    assertTrue(tocContent.contains("<toc topic=\"markup.html\" label=\"Alternate Title\">"));
    assertTrue(tocContent.contains("<topic href=\"markup.html\" label=\"First Heading\""));
    assertTrue(tocContent.contains("<topic href=\"markup.html#SecondHeading\" label=\"Second Heading\""));
  }
  
  public void testMultipleFilesWithMultiLevelHeadings()
    throws IOException
  {
    File markup = createSimpleTextileMarkupWithMultiLevelHeadings();
    task.setFile(markup);
    task.setMultipleOutputFiles(true);
    task.execute();
    
    listFiles();
    
    File tocFile = new File(tempFolder, "markup-toc.xml");
    assertTrue(tocFile.exists());
    
    String tocContent = getContent(tocFile);
    TestUtil.println(tocContent);
    
    assertTrue(tocContent.contains("<toc topic=\"markup.html\" label=\"markup\">"));
    assertTrue(tocContent.contains("<topic href=\"markup.html\" label=\"First Heading\""));
    assertTrue(tocContent.contains("<topic href=\"Second-Heading.html\" label=\"Second Heading\""));
    assertTrue(tocContent.contains("<topic href=\"Second-Heading.html#SecondL2\" label=\"Second L2\""));
    assertTrue(tocContent.contains("<topic href=\"Second-Heading.html#SecondL22\" label=\"Second L2 2\""));
  }
  
  /* Error */
  protected File createSimpleTextileMarkupWithMultiLevelHeadings()
    throws IOException
  {
    // Byte code:
    //   0: new 88	java/io/File
    //   3: dup
    //   4: aload_0
    //   5: getfield 152	org/eclipse/mylyn/wikitext/core/util/anttask/MarkupToEclipseHelpTaskTest:tempFolder	Ljava/io/File;
    //   8: ldc 14
    //   10: invokespecial 155	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   13: astore_1
    //   14: new 91	java/io/PrintWriter
    //   17: dup
    //   18: new 89	java/io/FileWriter
    //   21: dup
    //   22: aload_1
    //   23: invokespecial 156	java/io/FileWriter:<init>	(Ljava/io/File;)V
    //   26: invokespecial 159	java/io/PrintWriter:<init>	(Ljava/io/Writer;)V
    //   29: astore_2
    //   30: aload_2
    //   31: ldc 9
    //   33: invokevirtual 160	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   36: aload_2
    //   37: invokevirtual 158	java/io/PrintWriter:println	()V
    //   40: aload_2
    //   41: ldc 15
    //   43: invokevirtual 160	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   46: aload_2
    //   47: invokevirtual 158	java/io/PrintWriter:println	()V
    //   50: aload_2
    //   51: ldc 10
    //   53: invokevirtual 160	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   56: aload_2
    //   57: invokevirtual 158	java/io/PrintWriter:println	()V
    //   60: aload_2
    //   61: ldc 16
    //   63: invokevirtual 160	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   66: aload_2
    //   67: invokevirtual 158	java/io/PrintWriter:println	()V
    //   70: aload_2
    //   71: ldc 11
    //   73: invokevirtual 160	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   76: aload_2
    //   77: invokevirtual 158	java/io/PrintWriter:println	()V
    //   80: aload_2
    //   81: ldc 15
    //   83: invokevirtual 160	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   86: aload_2
    //   87: invokevirtual 158	java/io/PrintWriter:println	()V
    //   90: aload_2
    //   91: ldc 12
    //   93: invokevirtual 160	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   96: aload_2
    //   97: invokevirtual 158	java/io/PrintWriter:println	()V
    //   100: aload_2
    //   101: ldc 15
    //   103: invokevirtual 160	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   106: aload_2
    //   107: invokevirtual 158	java/io/PrintWriter:println	()V
    //   110: goto +10 -> 120
    //   113: astore_3
    //   114: aload_2
    //   115: invokevirtual 157	java/io/PrintWriter:close	()V
    //   118: aload_3
    //   119: athrow
    //   120: aload_2
    //   121: invokevirtual 157	java/io/PrintWriter:close	()V
    //   124: aload_1
    //   125: areturn
    // Line number table:
    //   Java source line #96	-> byte code offset #0
    //   Java source line #97	-> byte code offset #14
    //   Java source line #99	-> byte code offset #30
    //   Java source line #100	-> byte code offset #36
    //   Java source line #101	-> byte code offset #40
    //   Java source line #102	-> byte code offset #46
    //   Java source line #103	-> byte code offset #50
    //   Java source line #104	-> byte code offset #56
    //   Java source line #105	-> byte code offset #60
    //   Java source line #106	-> byte code offset #66
    //   Java source line #107	-> byte code offset #70
    //   Java source line #108	-> byte code offset #76
    //   Java source line #109	-> byte code offset #80
    //   Java source line #110	-> byte code offset #86
    //   Java source line #111	-> byte code offset #90
    //   Java source line #112	-> byte code offset #96
    //   Java source line #113	-> byte code offset #100
    //   Java source line #114	-> byte code offset #106
    //   Java source line #115	-> byte code offset #113
    //   Java source line #116	-> byte code offset #114
    //   Java source line #117	-> byte code offset #118
    //   Java source line #116	-> byte code offset #120
    //   Java source line #118	-> byte code offset #124
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	126	0	this	MarkupToEclipseHelpTaskTest
    //   13	112	1	markupFile	File
    //   29	92	2	writer	java.io.PrintWriter
    //   113	6	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   30	113	113	finally
  }
  
  public void testTaskdef()
  {
    ResourceBundle bundle = ResourceBundle.getBundle(MarkupToEclipseHelpTask.class.getPackage().getName() + 
      ".tasks");
    assertEquals(MarkupToEclipseHelpTask.class.getName(), bundle.getString("wikitext-to-eclipse-help"));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.util.anttask.MarkupToEclipseHelpTaskTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.util.anttask;

import java.io.File;
import java.io.IOException;
import org.eclipse.mylyn.wikitext.tests.TestUtil;

public class HtmlToMarkupTaskTest
  extends AbstractTestAntTask
{
  private HtmlToMarkupTask task;
  
  protected void setUp()
    throws Exception
  {
    super.setUp();
    task = createTask();
    task.setMarkupLanguage(languageName);
  }
  
  private HtmlToMarkupTask createTask()
  {
    return new HtmlToMarkupTask();
  }
  
  public void testSimpleOutput()
    throws IOException
  {
    File markup = createSimpleHtmlMarkup();
    task.setFile(markup);
    task.execute();
    
    listFiles();
    
    File markupFile = new File(markup.getParentFile(), "markup.textile");
    assertTrue("Expecting file: " + markupFile, (markupFile.exists()) && (markupFile.isFile()));
    
    String content = getContent(markupFile);
    TestUtil.println(content);
    
    assertTrue(content.equals("h1. First Heading\n\nsome content\n\nh1. Second Heading\n\nsome more content\n\n"));
  }
  
  /* Error */
  private File createSimpleHtmlMarkup()
    throws IOException
  {
    // Byte code:
    //   0: new 53	java/io/File
    //   3: dup
    //   4: aload_0
    //   5: getfield 106	org/eclipse/mylyn/wikitext/core/util/anttask/HtmlToMarkupTaskTest:tempFolder	Ljava/io/File;
    //   8: ldc 4
    //   10: invokespecial 112	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   13: astore_1
    //   14: new 56	java/io/PrintWriter
    //   17: dup
    //   18: new 54	java/io/FileWriter
    //   21: dup
    //   22: aload_1
    //   23: invokespecial 113	java/io/FileWriter:<init>	(Ljava/io/File;)V
    //   26: invokespecial 115	java/io/PrintWriter:<init>	(Ljava/io/Writer;)V
    //   29: astore_2
    //   30: aload_2
    //   31: ldc 1
    //   33: invokevirtual 116	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   36: goto +10 -> 46
    //   39: astore_3
    //   40: aload_2
    //   41: invokevirtual 114	java/io/PrintWriter:close	()V
    //   44: aload_3
    //   45: athrow
    //   46: aload_2
    //   47: invokevirtual 114	java/io/PrintWriter:close	()V
    //   50: aload_1
    //   51: areturn
    // Line number table:
    //   Java source line #56	-> byte code offset #0
    //   Java source line #57	-> byte code offset #14
    //   Java source line #59	-> byte code offset #30
    //   Java source line #60	-> byte code offset #39
    //   Java source line #61	-> byte code offset #40
    //   Java source line #62	-> byte code offset #44
    //   Java source line #61	-> byte code offset #46
    //   Java source line #63	-> byte code offset #50
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	52	0	this	HtmlToMarkupTaskTest
    //   13	38	1	htmlFile	File
    //   29	18	2	writer	java.io.PrintWriter
    //   39	6	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   30	39	39	finally
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.util.anttask.HtmlToMarkupTaskTest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.util.anttask;

import java.io.File;
import java.io.IOException;
import java.util.ResourceBundle;
import org.eclipse.mylyn.wikitext.tests.TestUtil;

public class MarkupToDitaTaskTest
  extends AbstractTestAntTask
{
  private MarkupToDitaTask ditaTask;
  private File topicsFolder;
  
  protected void setUp()
    throws Exception
  {
    super.setUp();
    
    ditaTask = new MarkupToDitaTask();
    ditaTask.setMarkupLanguage(languageName);
    
    topicsFolder = new File(tempFolder, ditaTask.getTopicFolder());
    topicsFolder.mkdirs();
  }
  
  /* Error */
  private File createSimpleTextileMarkup()
    throws IOException
  {
    // Byte code:
    //   0: new 173	java/io/File
    //   3: dup
    //   4: aload_0
    //   5: getfield 255	org/eclipse/mylyn/wikitext/core/util/anttask/MarkupToDitaTaskTest:tempFolder	Ljava/io/File;
    //   8: ldc 33
    //   10: invokespecial 261	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   13: astore_1
    //   14: new 176	java/io/PrintWriter
    //   17: dup
    //   18: new 174	java/io/FileWriter
    //   21: dup
    //   22: aload_1
    //   23: invokespecial 262	java/io/FileWriter:<init>	(Ljava/io/File;)V
    //   26: invokespecial 265	java/io/PrintWriter:<init>	(Ljava/io/Writer;)V
    //   29: astore_2
    //   30: aload_2
    //   31: ldc 29
    //   33: invokevirtual 266	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   36: aload_2
    //   37: invokevirtual 264	java/io/PrintWriter:println	()V
    //   40: aload_2
    //   41: ldc 34
    //   43: invokevirtual 266	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   46: aload_2
    //   47: invokevirtual 264	java/io/PrintWriter:println	()V
    //   50: aload_2
    //   51: ldc 30
    //   53: invokevirtual 266	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   56: aload_2
    //   57: invokevirtual 264	java/io/PrintWriter:println	()V
    //   60: aload_2
    //   61: ldc 36
    //   63: invokevirtual 266	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   66: goto +10 -> 76
    //   69: astore_3
    //   70: aload_2
    //   71: invokevirtual 263	java/io/PrintWriter:close	()V
    //   74: aload_3
    //   75: athrow
    //   76: aload_2
    //   77: invokevirtual 263	java/io/PrintWriter:close	()V
    //   80: aload_1
    //   81: areturn
    // Line number table:
    //   Java source line #40	-> byte code offset #0
    //   Java source line #41	-> byte code offset #14
    //   Java source line #43	-> byte code offset #30
    //   Java source line #44	-> byte code offset #36
    //   Java source line #45	-> byte code offset #40
    //   Java source line #46	-> byte code offset #46
    //   Java source line #47	-> byte code offset #50
    //   Java source line #48	-> byte code offset #56
    //   Java source line #49	-> byte code offset #60
    //   Java source line #50	-> byte code offset #69
    //   Java source line #51	-> byte code offset #70
    //   Java source line #52	-> byte code offset #74
    //   Java source line #51	-> byte code offset #76
    //   Java source line #53	-> byte code offset #80
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	82	0	this	MarkupToDitaTaskTest
    //   13	68	1	markupFile	File
    //   29	48	2	writer	java.io.PrintWriter
    //   69	6	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   30	69	69	finally
  }
  
  private File createTextileMarkupWithXref()
    throws IOException
  {
    return createTextileMarkupWithXref(1);
  }
  
  /* Error */
  private File createTextileMarkupWithXref(int headingLevel)
    throws IOException
  {
    // Byte code:
    //   0: new 173	java/io/File
    //   3: dup
    //   4: aload_0
    //   5: getfield 255	org/eclipse/mylyn/wikitext/core/util/anttask/MarkupToDitaTaskTest:tempFolder	Ljava/io/File;
    //   8: ldc 33
    //   10: invokespecial 261	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   13: astore_2
    //   14: new 176	java/io/PrintWriter
    //   17: dup
    //   18: new 174	java/io/FileWriter
    //   21: dup
    //   22: aload_2
    //   23: invokespecial 262	java/io/FileWriter:<init>	(Ljava/io/File;)V
    //   26: invokespecial 265	java/io/PrintWriter:<init>	(Ljava/io/Writer;)V
    //   29: astore_3
    //   30: aload_3
    //   31: new 181	java/lang/StringBuilder
    //   34: dup
    //   35: ldc 27
    //   37: invokespecial 273	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   40: iload_1
    //   41: invokevirtual 274	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   44: ldc 2
    //   46: invokevirtual 275	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   49: invokevirtual 272	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   52: invokevirtual 266	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   55: aload_3
    //   56: invokevirtual 264	java/io/PrintWriter:println	()V
    //   59: aload_3
    //   60: ldc 35
    //   62: invokevirtual 266	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   65: aload_3
    //   66: invokevirtual 264	java/io/PrintWriter:println	()V
    //   69: aload_3
    //   70: new 181	java/lang/StringBuilder
    //   73: dup
    //   74: ldc 27
    //   76: invokespecial 273	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   79: iload_1
    //   80: invokevirtual 274	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   83: ldc 3
    //   85: invokevirtual 275	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   88: invokevirtual 272	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   91: invokevirtual 266	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   94: aload_3
    //   95: invokevirtual 264	java/io/PrintWriter:println	()V
    //   98: aload_3
    //   99: ldc 37
    //   101: invokevirtual 266	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   104: goto +12 -> 116
    //   107: astore 4
    //   109: aload_3
    //   110: invokevirtual 263	java/io/PrintWriter:close	()V
    //   113: aload 4
    //   115: athrow
    //   116: aload_3
    //   117: invokevirtual 263	java/io/PrintWriter:close	()V
    //   120: aload_2
    //   121: areturn
    // Line number table:
    //   Java source line #61	-> byte code offset #0
    //   Java source line #62	-> byte code offset #14
1 2 3 4 5 6 7 8 9 10 11 12 13

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd