コード例 #1
0
ファイル: UriBuilderTest.java プロジェクト: YaqubGhazi/olat
 @Test
 public void getURIToContext_ContextType_UNKOWN() {
   Publisher publisherUnkown = mock(Publisher.class);
   when(publisherUnkown.getContextType()).thenReturn(ContextType.UNKNOWN);
   String uriToContext = uriBuilderTestObject.getURIToContext(publisherUnkown);
   assertEquals("Wrong URI with unkown type", testContextPathUri + "/url/UNKOWN/0", uriToContext);
 }
コード例 #2
0
ファイル: UriBuilderTest.java プロジェクト: YaqubGhazi/olat
 private void checkUriToContext() {
   when(publisher.getSubcontextId()).thenReturn(subContextId);
   String uriToEventSource = uriBuilderTestObject.getURIToEventSource(publisher);
   assertEquals(
       "Wrong URI with type " + publisher.getSourceType(),
       testContextPathUri + "/url/RepositoryEntry/" + contextId + "/CourseNode/" + subContextId,
       uriToEventSource);
 }
コード例 #3
0
ファイル: UriBuilderTest.java プロジェクト: YaqubGhazi/olat
  @Before
  public void setup() {
    publisher = mock(Publisher.class);
    when(publisher.getContextType()).thenReturn(ContextType.COURSE);
    when(publisher.getContextId()).thenReturn(contextId);

    uriBuilderTestObject = new UriBuilder();
    uriBuilderTestObject.setServerContextPathURI(testContextPathUri);
    Set<PublisherTypeHandler> typeHandler = new HashSet<PublisherTypeHandler>();
    typeHandler.add(new ForumNotificationTypeHandler());
    typeHandler.add(new WikiNotificationTypeHandler());
    PublisherTypeHandlerSelector typeHandlerSelector = new PublisherTypeHandlerSelector();
    typeHandlerSelector.notificationTypeHandler = typeHandler;
    uriBuilderTestObject.typeHandlerSelector = typeHandlerSelector;
  }
コード例 #4
0
ファイル: UriBuilderTest.java プロジェクト: YaqubGhazi/olat
 @Test
 public void getURIToSourceEntry_Forum() {
   when(publisher.getSourceType()).thenReturn(ForumNotificationTypeHandler.FORUM_SOURCE_TYPE);
   when(publisher.getSubcontextId()).thenReturn(subContextId);
   String uriToSourceEntry = uriBuilderTestObject.getURIToSourceEntry(publisher, sourceEntryId);
   assertEquals(
       "Wrong URI with type " + publisher.getSourceType(),
       testContextPathUri
           + "/url/RepositoryEntry/"
           + contextId
           + "/CourseNode/"
           + subContextId
           + "/Message/"
           + sourceEntryId,
       uriToSourceEntry);
 }
コード例 #5
0
ファイル: UriBuilderTest.java プロジェクト: YaqubGhazi/olat
 @Test
 public void getURIToEventSource_Wiki() {
   when(publisher.getSourceType()).thenReturn(WikiNotificationTypeHandler.WIKI_SOURCE_TYPE);
   checkUriToContext();
 }
コード例 #6
0
ファイル: UriBuilderTest.java プロジェクト: YaqubGhazi/olat
 @Test
 public void getURIToEventSource_Forum() {
   when(publisher.getSourceType()).thenReturn(ForumNotificationTypeHandler.FORUM_SOURCE_TYPE);
   checkUriToContext();
 }