View Javadoc

1   /*
2    * $Id: DefaultModelNames.java 22414 2011-07-14 13:24:46Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.config.spring;
12  
13  import org.mule.api.model.Model;
14  import org.mule.tck.junit4.FunctionalTestCase;
15  
16  import java.util.Collection;
17  import java.util.HashSet;
18  import java.util.Iterator;
19  import java.util.Set;
20  
21  import org.junit.Test;
22  
23  import static org.junit.Assert.assertEquals;
24  
25  public class DefaultModelNames extends FunctionalTestCase
26  {
27  
28      @Override
29      protected String getConfigResources()
30      {
31          return "default-model-names.xml";
32      }
33  
34      @Test
35      public void testNames()
36      {
37          Collection models = muleContext.getRegistry().lookupObjects(Model.class);
38          assertEquals(3, models.size()); // includes system model
39          Set modelNames = new HashSet();
40          for (Iterator each = models.iterator(); each.hasNext();)
41          {
42              modelNames.add(((Model) each.next()).getName());
43          }
44          assertEquals(3, modelNames.size());
45      }
46  
47  }