diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/ModelService.java b/service/src/main/java/lcsb/mapviewer/services/impl/ModelService.java index f178102c82c2212396c9c6cd62316ea05b26ebf7..32036ab9eea3e89c36e4fba6f2c73da723671498 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/ModelService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/ModelService.java @@ -12,11 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import lcsb.mapviewer.annotation.data.Article; -import lcsb.mapviewer.annotation.services.MeSHParser; import lcsb.mapviewer.annotation.services.MiriamConnector; import lcsb.mapviewer.annotation.services.PubmedParser; import lcsb.mapviewer.annotation.services.PubmedSearchException; -import lcsb.mapviewer.annotation.services.TaxonomyBackend; import lcsb.mapviewer.commands.CopyCommand; import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.common.Pair; @@ -29,7 +27,6 @@ import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.species.Element; import lcsb.mapviewer.model.user.PrivilegeType; -import lcsb.mapviewer.model.user.User; import lcsb.mapviewer.persist.dao.ProjectDao; import lcsb.mapviewer.persist.dao.map.ModelDao; import lcsb.mapviewer.services.interfaces.ILayoutService; @@ -38,8 +35,6 @@ import lcsb.mapviewer.services.interfaces.IUserService; import lcsb.mapviewer.services.search.data.LightAliasView; import lcsb.mapviewer.services.search.data.LightAliasViewFactory; import lcsb.mapviewer.services.search.data.LightReactionView; -import lcsb.mapviewer.services.view.ModelView; -import lcsb.mapviewer.services.view.ModelViewFactory; /** * Implementation of the service that manages models. @@ -80,12 +75,6 @@ public class ModelService implements IModelService { @Autowired private ProjectDao projectDao; - /** - * Object allowing access to the mesh database. - */ - @Autowired - private MeSHParser meshParser; - /** * Local backend to the pubmed data. */ @@ -104,18 +93,6 @@ public class ModelService implements IModelService { @Autowired private MiriamConnector miriamConnector; - /** - * Factory object used for creation of {@link ModelView} elements. - */ - @Autowired - private ModelViewFactory modelViewFactory; - - /** - * Access point and parser for the online ctd database. - */ - @Autowired - private TaxonomyBackend taxonomyBackend; - @Override public Model getLastModelByProjectId(String projectName, String token) throws lcsb.mapviewer.services.SecurityException { @@ -295,19 +272,6 @@ public class ModelService implements IModelService { } - @Override - public ModelView getModelView(Model model, User user) { - ModelView result = modelViewFactory.create(model); - if (user != null) { - result.setCustomLayouts(layoutService.getCustomLayouts(model, user, true, user)); - for (ModelView view : result.getSubmodels()) { - view.setCustomLayouts( - layoutService.getCustomLayouts(model.getSubmodelById(view.getIdObject()), user, true, user)); - } - } - return result; - } - @Override public void removeModelFromCache(ModelData model) { models.remove(model.getProject().getProjectId()); diff --git a/service/src/main/java/lcsb/mapviewer/services/interfaces/IModelService.java b/service/src/main/java/lcsb/mapviewer/services/interfaces/IModelService.java index b7ad235241bf8dc8bc86681091e0b4f0d4273bd0..b150036d82ea1fcb11e2e0b3c19c3d419f811d73 100644 --- a/service/src/main/java/lcsb/mapviewer/services/interfaces/IModelService.java +++ b/service/src/main/java/lcsb/mapviewer/services/interfaces/IModelService.java @@ -6,11 +6,9 @@ import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelData; -import lcsb.mapviewer.model.user.User; import lcsb.mapviewer.services.SecurityException; import lcsb.mapviewer.services.search.data.LightAliasView; import lcsb.mapviewer.services.search.data.LightReactionView; -import lcsb.mapviewer.services.view.ModelView; /** * Service that manages models (maps). @@ -59,17 +57,6 @@ public interface IModelService { */ void cacheAllMiriamLinks(Model model, IProgressUpdater updater); - /** - * Returns {@link ModelView} for the given model. - * - * @param model - * model for which view is returned. - * @param user - * user for which custom layouts should be added - * @return {@link ModelView} for the given {@link Model} - */ - ModelView getModelView(Model model, User user); - /** * Removes model from application cache. * diff --git a/service/src/main/java/lcsb/mapviewer/services/view/ModelView.java b/service/src/main/java/lcsb/mapviewer/services/view/ModelView.java deleted file mode 100644 index 2780593bd456eb2f2f407d6a645ca4158bcafe00..0000000000000000000000000000000000000000 --- a/service/src/main/java/lcsb/mapviewer/services/view/ModelView.java +++ /dev/null @@ -1,418 +0,0 @@ -package lcsb.mapviewer.services.view; - -import java.io.Serializable; -import java.util.List; - -import lcsb.mapviewer.model.map.model.Model; - -import org.apache.log4j.Logger; -import org.primefaces.model.map.LatLng; - -/** - * View representatin of a model. It's a light structre that present - * {@link Model} data to the client side. - * - * @author Piotr Gawron - * - */ -public class ModelView extends AbstractView<Model> implements Serializable { - /** - * Default class logger. - */ - @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(ModelView.class); - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Version of the model. - */ - private String version; - - /** - * Name of the model. - */ - private String name; - - /** - * {@link lcsb.mapviewer.model.Project#projectId Project identifier}. - */ - private String projectId; - - /** - * Description of the model. - */ - private String description; - /** - * Size in pixels of the single square tile (small image used for graphical - * representation). - */ - private Integer tileSize; - /** - * Size of the whole map. - */ - private Integer pictureSize; - /** - * Minimum zoom level that should be allowed by the Google Maps API. - */ - private Integer minZoom; - /** - * Maximum zoom level that should be allowed by the Google Maps API. - */ - private Integer maxZoom; - /** - * Public layouts available for the model. - */ - private List<LayoutView> layouts; - - /** - * Custom layouts available only for the current user. - */ - private List<LayoutView> customLayouts; - - /** - * List of submodels in the model. - */ - private List<ModelView> submodels; - - /** - * Where is the center of the map in latituted, longiude format. - */ - private LatLng centerLatLng; - - /** - * Top-Left corner of the map (0,0) as a latLng coordinates. - */ - private LatLng topLeftLatLng; - - /** - * Bottom-Right corner of the map (width,height) as a latLng coordinates. - */ - private LatLng bottomRightLatLng; - - /** - * Should the map be automatically fit in the browser window. Bean should - * change this value if the map was already viewed by user and there is - * information about zoom level and coordinates where user is browsing it. - */ - private Boolean fitMapBounds = true; - - /** - * List of overview images attached to this model. - */ - private List<OverviewImageView> overviewImageViews; - - /** - * Top level overview image. - */ - private OverviewImageView topOverviewImage; - - /** - * Default constructor which creates view representation from the orignial - * model. - * - * @param model - * source map model - */ - protected ModelView(Model model) { - super(model); - } - - /** - * Default constructor. Should be used only for deserialization. - */ - protected ModelView() { - } - - /** - * @return the version - * @see #version - */ - public String getVersion() { - return version; - } - - /** - * @param version - * the version to set - * @see #version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return the description - * @see #description - */ - public String getDescription() { - return description; - } - - /** - * @param description - * the description to set - * @see #description - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the tileSize - * @see #tileSize - */ - public Integer getTileSize() { - return tileSize; - } - - /** - * @param tileSize - * the tileSize to set - * @see #tileSize - */ - public void setTileSize(Integer tileSize) { - this.tileSize = tileSize; - } - - /** - * @return the pictureSize - * @see #pictureSize - */ - public Integer getPictureSize() { - return pictureSize; - } - - /** - * @param pictureSize - * the pictureSize to set - * @see #pictureSize - */ - public void setPictureSize(Integer pictureSize) { - this.pictureSize = pictureSize; - } - - /** - * @return the minZoom - * @see #minZoom - */ - public Integer getMinZoom() { - return minZoom; - } - - /** - * @param minZoom - * the minZoom to set - * @see #minZoom - */ - public void setMinZoom(Integer minZoom) { - this.minZoom = minZoom; - } - - /** - * @return the maxZoom - * @see #maxZoom - */ - public Integer getMaxZoom() { - return maxZoom; - } - - /** - * @param maxZoom - * the maxZoom to set - * @see #maxZoom - */ - public void setMaxZoom(Integer maxZoom) { - this.maxZoom = maxZoom; - } - - /** - * @return the layouts - * @see #layouts - */ - public List<LayoutView> getLayouts() { - return layouts; - } - - /** - * @param layouts - * the layouts to set - * @see #layouts - */ - public void setLayouts(List<LayoutView> layouts) { - this.layouts = layouts; - } - - /** - * @return the centerLatLng - * @see #centerLatLng - */ - public LatLng getCenterLatLng() { - return centerLatLng; - } - - /** - * @param centerLatLng - * the centerLatLng to set - * @see #centerLatLng - */ - public void setCenterLatLng(LatLng centerLatLng) { - this.centerLatLng = centerLatLng; - } - - /** - * @return the name - * @see #name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - * @see #name - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the customLayouts - * @see #customLayouts - */ - public List<LayoutView> getCustomLayouts() { - return customLayouts; - } - - /** - * @param customLayouts - * the customLayouts to set - * @see #customLayouts - */ - public void setCustomLayouts(List<LayoutView> customLayouts) { - this.customLayouts = customLayouts; - } - - /** - * @return the submodels - * @see #submodels - */ - public List<ModelView> getSubmodels() { - return submodels; - } - - /** - * @param submodels - * the submodels to set - * @see #submodels - */ - public void setSubmodels(List<ModelView> submodels) { - this.submodels = submodels; - } - - /** - * @return the overviewImageViews - * @see #overviewImageViews - */ - public List<OverviewImageView> getOverviewImageViews() { - return overviewImageViews; - } - - /** - * @param overviewImageViews - * the overviewImageViews to set - * @see #overviewImageViews - */ - public void setOverviewImageViews(List<OverviewImageView> overviewImageViews) { - this.overviewImageViews = overviewImageViews; - } - - /** - * @return the topOverviewImage - * @see #topOverviewImage - */ - public OverviewImageView getTopOverviewImage() { - return topOverviewImage; - } - - /** - * @param topOverviewImage - * the topOverviewImage to set - * @see #topOverviewImage - */ - public void setTopOverviewImage(OverviewImageView topOverviewImage) { - this.topOverviewImage = topOverviewImage; - } - - /** - * @return the topLeftLatLng - * @see #topLeftLatLng - */ - public LatLng getTopLeftLatLng() { - return topLeftLatLng; - } - - /** - * @param topLeftLatLng - * the topLeftLatLng to set - * @see #topLeftLatLng - */ - public void setTopLeftLatLng(LatLng topLeftLatLng) { - this.topLeftLatLng = topLeftLatLng; - } - - /** - * @return the bottomRightLatLng - * @see #bottomRightLatLng - */ - public LatLng getBottomRightLatLng() { - return bottomRightLatLng; - } - - /** - * @param bottomRightLatLng - * the bottomRightLatLng to set - * @see #bottomRightLatLng - */ - public void setBottomRightLatLng(LatLng bottomRightLatLng) { - this.bottomRightLatLng = bottomRightLatLng; - } - - /** - * @return the fitMapBounds - * @see #fitMapBounds - */ - public Boolean getFitMapBounds() { - return fitMapBounds; - } - - /** - * @param fitMapBounds - * the fitMapBounds to set - * @see #fitMapBounds - */ - public void setFitMapBounds(Boolean fitMapBounds) { - this.fitMapBounds = fitMapBounds; - } - - /** - * @return the projectId - * @see #projectId - */ - public String getProjectId() { - return projectId; - } - - /** - * @param projectId - * the projectName to set - * @see #projectId - */ - public void setProjectId(String projectId) { - this.projectId = projectId; - } - -} diff --git a/service/src/main/java/lcsb/mapviewer/services/view/ModelViewFactory.java b/service/src/main/java/lcsb/mapviewer/services/view/ModelViewFactory.java deleted file mode 100644 index 673700f9f80f8d1d5c4286c8225740ab6829c875..0000000000000000000000000000000000000000 --- a/service/src/main/java/lcsb/mapviewer/services/view/ModelViewFactory.java +++ /dev/null @@ -1,99 +0,0 @@ -package lcsb.mapviewer.services.view; - -import java.awt.geom.Point2D; -import java.util.ArrayList; -import java.util.List; - -import lcsb.mapviewer.common.Configuration; -import lcsb.mapviewer.model.map.layout.Layout; -import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; -import lcsb.mapviewer.services.utils.gmap.CoordinationConverter; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -import lcsb.mapviewer.common.exception.NotImplementedException; - -import com.google.gson.Gson; - -/** - * Factory class for {@link ModelView} class. - * - * @author Piotr Gawron - * - */ -@Transactional(value = "txManager") -public class ModelViewFactory extends AbstractViewFactory<Model, ModelView> { - /** - * Default class logger. - */ - private static Logger logger = Logger.getLogger(ModelViewFactory.class); - - /** - * Factory object used for creation of {@link LayoutView} elements. - */ - @Autowired - private LayoutViewFactory layoutViewFactory; - - /** - * Factory object used for creation of {@link OverviewImageView} elements. - */ - @Autowired - private OverviewImageViewFactory overviewImageViewFactory; - - @Override - public ModelView create(Model model) { - ModelView result = new ModelView(model); - if (model == null) { - logger.warn("Empty model..."); - return result; - } - if (model.getProject() != null) { - result.setProjectId(model.getProject().getProjectId()); - result.setOverviewImageViews(overviewImageViewFactory.createList(model.getProject().getOverviewImages())); - if (result.getOverviewImageViews().size() > 0) { - result.setTopOverviewImage(overviewImageViewFactory.create(model.getProject().getTopOverviewImage())); - } - } - result.setLayouts(new ArrayList<LayoutView>()); - result.setCustomLayouts(new ArrayList<LayoutView>()); - result.setName(model.getName()); - - result.setMinZoom(Configuration.MIN_ZOOM_LEVEL); - result.setMaxZoom(result.getMinZoom() + model.getZoomLevels()); - result.setTileSize(model.getTileSize()); - result.setPictureSize((int) Math.max(model.getWidth(), model.getHeight())); - // we have to add copies (originals contain reference to model which - // shouldn't be passed to simple structure) - for (Layout layout : model.getLayouts()) { - if (layout.isPublicLayout()) { - result.getLayouts().add(layoutViewFactory.create(layout)); - } - } - CoordinationConverter cConverter = new CoordinationConverter(model); - result.setCenterLatLng(cConverter.toLatLng(new Point2D.Double(result.getPictureSize() / 2, result.getPictureSize() / 2))); - result.setBottomRightLatLng(cConverter.toLatLng(new Point2D.Double(model.getWidth(), model.getHeight()))); - result.setTopLeftLatLng(cConverter.toLatLng(new Point2D.Double(0, 0))); - - result.setDescription(model.getNotes()); - - List<ModelView> submodels = new ArrayList<ModelView>(); - for (ModelSubmodelConnection connection : model.getSubmodelConnections()) { - submodels.add(create(connection.getSubmodel().getModel())); - } - result.setSubmodels(submodels); - return result; - } - - @Override - public String createGson(ModelView object) { - return new Gson().toJson(object); - } - - @Override - public Model viewToObject(ModelView view) { - throw new NotImplementedException(); - } -} diff --git a/service/src/main/java/lcsb/mapviewer/services/view/PrivilegeView.java b/service/src/main/java/lcsb/mapviewer/services/view/PrivilegeView.java deleted file mode 100644 index c084036ba7982ce9a5bc898f3e0dfce56a7d4d4b..0000000000000000000000000000000000000000 --- a/service/src/main/java/lcsb/mapviewer/services/view/PrivilegeView.java +++ /dev/null @@ -1,206 +0,0 @@ -package lcsb.mapviewer.services.view; - -import java.io.Serializable; - -import lcsb.mapviewer.model.user.BasicPrivilege; -import lcsb.mapviewer.model.user.PrivilegeType; - -/** - * This class repesents single user privilege in the way understandable by the - * client side. - * - * @author Piotr Gawron - * - */ -public class PrivilegeView extends AbstractView<BasicPrivilege> implements Comparable<PrivilegeView>, Serializable { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * What is the name of the privilege. - */ - private String commonName; - - /** - * Does user has this privilege. - */ - private Boolean selected; - - /** - * Type associated with this privilege. - */ - private PrivilegeType type; - - /** - * If privilege is associated with some object (the privilege defines access - * level to this object) then {@link #objectId} points to database identifier - * of this object. - */ - private Integer objectId; - - /** - * Access level for this privilege. Usually it's boolean {0,1} value. However, - * some privileges (the ones that are characterized as {@link #numeric}) - * accept any integer values. - */ - private Integer level; - - /** - * This field describe if privilege is: - * <ul> - * <li>numeric - privileges that takes as an input number of something,</li> - * <li>boolean - only logic value is acceptable.</li> - * </ul> - */ - private Boolean numeric; - - /** - * Default constructor. Creates view representation from existing privilege. - * - * @param privilege - * original privilege - */ - protected PrivilegeView(BasicPrivilege privilege) { - super(privilege); - } - - /** - * Default constructor. Should be used only for deserialization. - */ - protected PrivilegeView() { - } - - /** - * Constructor that creates empty privilege representation for the type given - * in the parameter. - * - * @param type2 - * type of the privilege - */ - protected PrivilegeView(PrivilegeType type2) { - super(null); - this.commonName = type2.getCommonName(); - this.selected = false; - this.type = type2; - this.objectId = null; - this.numeric = type2.isNumeric(); - this.level = 0; - } - - @Override - public int compareTo(PrivilegeView o) { - if (commonName == null) { - return -1; - } - if (o == null) { - return -1; - } - return this.commonName.compareTo(o.getCommonName()); - } - - /** - * @return the commonName - * @see #commonName - */ - public String getCommonName() { - return commonName; - } - - /** - * @param commonName - * the commonName to set - * @see #commonName - */ - public void setCommonName(String commonName) { - this.commonName = commonName; - } - - /** - * @return the selected - * @see #selected - */ - public Boolean getSelected() { - return selected; - } - - /** - * @param selected - * the selected to set - * @see #selected - */ - public void setSelected(Boolean selected) { - this.selected = selected; - } - - /** - * @return the type - * @see #type - */ - public PrivilegeType getType() { - return type; - } - - /** - * @param type - * the type to set - * @see #type - */ - public void setType(PrivilegeType type) { - this.type = type; - } - - /** - * @return the objectId - * @see #objectId - */ - public Integer getObjectId() { - return objectId; - } - - /** - * @param objectId - * the objectId to set - * @see #objectId - */ - public void setObjectId(Integer objectId) { - this.objectId = objectId; - } - - /** - * @return the level - * @see #level - */ - public Integer getLevel() { - return level; - } - - /** - * @param level - * the level to set - * @see #level - */ - public void setLevel(Integer level) { - this.level = level; - } - - /** - * @return the numeric - * @see #numeric - */ - public Boolean getNumeric() { - return numeric; - } - - /** - * @param numeric - * the numeric to set - * @see #numeric - */ - public void setNumeric(Boolean numeric) { - this.numeric = numeric; - } - -} diff --git a/service/src/main/java/lcsb/mapviewer/services/view/PrivilegeViewFactory.java b/service/src/main/java/lcsb/mapviewer/services/view/PrivilegeViewFactory.java deleted file mode 100644 index 2d7cdae3a46c2c2f83345174a88c70e208143af1..0000000000000000000000000000000000000000 --- a/service/src/main/java/lcsb/mapviewer/services/view/PrivilegeViewFactory.java +++ /dev/null @@ -1,69 +0,0 @@ -package lcsb.mapviewer.services.view; - -import lcsb.mapviewer.model.user.BasicPrivilege; -import lcsb.mapviewer.model.user.ObjectPrivilege; -import lcsb.mapviewer.model.user.PrivilegeType; - -import org.apache.log4j.Logger; - -import lcsb.mapviewer.common.exception.NotImplementedException; - -import com.google.gson.Gson; - -/** - * Factory class for {@link PrivilegeView} class. - * - * @author Piotr Gawron - * - */ -public class PrivilegeViewFactory extends AbstractViewFactory<BasicPrivilege, PrivilegeView> { - /** - * Default class logger. - */ - private static Logger logger = Logger.getLogger(PrivilegeViewFactory.class); - - @Override - public PrivilegeView create(BasicPrivilege privilege) { - PrivilegeView result = new PrivilegeView(privilege); - if (privilege == null) { - return result; - } - result.setSelected(privilege.getLevel() > 0); - result.setType(privilege.getType()); - if (privilege.getType() != null) { - result.setCommonName(privilege.getType().getCommonName()); - result.setNumeric(privilege.getType().isNumeric()); - } else { - logger.warn("Privilege without type..."); - } - if (privilege.getClass().equals(ObjectPrivilege.class)) { - result.setObjectId(((ObjectPrivilege) privilege).getId()); - } - result.setLevel(privilege.getLevel()); - return result; - } - - /** - * Creates empty {@link PrivilegeView} element for given {@link PrivilegeType} - * . - * - * - * @param type - * type of empty privilege to create - * @return empty {@link PrivilegeView} element for given {@link PrivilegeType} - * - */ - public PrivilegeView create(PrivilegeType type) { - return new PrivilegeView(type); - } - - @Override - public String createGson(PrivilegeView object) { - return new Gson().toJson(object); - } - - @Override - public BasicPrivilege viewToObject(PrivilegeView view) { - throw new NotImplementedException(); - } -} diff --git a/service/src/main/resources/applicationContext-service.xml b/service/src/main/resources/applicationContext-service.xml index ec3ec8712ac02f1c945688271fe435ddb9ed8953..27a893af0170b657ea88bf5594f885a9ceeb55cb 100644 --- a/service/src/main/resources/applicationContext-service.xml +++ b/service/src/main/resources/applicationContext-service.xml @@ -52,10 +52,8 @@ <bean id="ConfigurationViewFactory" class="lcsb.mapviewer.services.view.ConfigurationViewFactory"/> <bean id="DataMiningViewFactory" class="lcsb.mapviewer.services.view.DataMiningViewFactory"/> <bean id="LayoutViewFactory" class="lcsb.mapviewer.services.view.LayoutViewFactory"/> - <bean id="ModelViewFactory" class="lcsb.mapviewer.services.view.ModelViewFactory"/> <bean id="OverviewImageViewFactory" class="lcsb.mapviewer.services.view.OverviewImageViewFactory"/> <bean id="OverviewLinkViewFactory" class="lcsb.mapviewer.services.view.OverviewLinkViewFactory"/> - <bean id="PrivilegeViewFactory" class="lcsb.mapviewer.services.view.PrivilegeViewFactory"/> <bean id="ReferenceGenomeViewFactory" class="lcsb.mapviewer.services.view.ReferenceGenomeViewFactory"/> <bean id="ReferenceGenomeGeneMappingViewFactory" class="lcsb.mapviewer.services.view.ReferenceGenomeGeneMappingViewFactory"/> diff --git a/service/src/test/java/lcsb/mapviewer/services/view/AllViewTests.java b/service/src/test/java/lcsb/mapviewer/services/view/AllViewTests.java index be2f29b80a9c1fc059038d4bed018bb4a143d32f..43dc9e514125496ddc421f48722349408e0ac6f9 100644 --- a/service/src/test/java/lcsb/mapviewer/services/view/AllViewTests.java +++ b/service/src/test/java/lcsb/mapviewer/services/view/AllViewTests.java @@ -17,14 +17,10 @@ import org.junit.runners.Suite.SuiteClasses; FrameworkVersionViewTest.class, // LayoutViewFactoryTest.class, // LayoutViewTest.class, // - ModelViewFactoryTest.class, // - ModelViewTest.class, // OverviewImageViewFactoryTest.class, // OverviewImageViewTest.class, // OverviewLinkViewFactoryTest.class, // OverviewLinkViewTest.class, // - PrivilegeViewFactoryTest.class, // - PrivilegeViewTest.class, // ReferenceGenomeViewFactoryTest.class, // ReferenceGenomeGeneMappingViewFactoryTest.class, // }) diff --git a/service/src/test/java/lcsb/mapviewer/services/view/ModelViewFactoryTest.java b/service/src/test/java/lcsb/mapviewer/services/view/ModelViewFactoryTest.java deleted file mode 100644 index 32a78c241c5fd296359e71eea7c5afe6211cb508..0000000000000000000000000000000000000000 --- a/service/src/test/java/lcsb/mapviewer/services/view/ModelViewFactoryTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package lcsb.mapviewer.services.view; - -import static org.junit.Assert.assertNotNull; - -import java.util.ArrayList; -import java.util.List; - -import lcsb.mapviewer.services.ServiceTestFunctions; - -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.primefaces.model.map.LatLng; -import org.springframework.beans.factory.annotation.Autowired; - -public class ModelViewFactoryTest extends ServiceTestFunctions{ - @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(ModelViewFactoryTest .class); - - @Autowired - ModelViewFactory modelViewFactory; - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testCreateEmpty() throws Exception { - try { - Object object = modelViewFactory.create(null); - assertNotNull(object); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testCreateJson() throws Exception { - try { - ModelView object = modelViewFactory.create(null); - String json = modelViewFactory.createGson(object); - assertNotNull(json); - - object.setCenterLatLng(new LatLng(1, 2)); - List<String> list = new ArrayList<>(); - list.add("ASS"); - object.setDescription("ASDAS"); - object.setIdObject(2); - List<LayoutView> views = new ArrayList<LayoutView>(); - LayoutView view = new LayoutView(); - view.setCreator("AA"); - view.setDirectory("C:\\test\\directory/"); - views.add(view); - object.setLayouts(views); - object.setMaxZoom(4); - object.setMinZoom(3); - object.setPictureSize(123); - object.setTileSize(234); - object.setVersion("#$#$#"); - json = modelViewFactory.createGson(object); - assertNotNull(json); - - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} diff --git a/service/src/test/java/lcsb/mapviewer/services/view/ModelViewTest.java b/service/src/test/java/lcsb/mapviewer/services/view/ModelViewTest.java deleted file mode 100644 index 36825505843e59d932aef5908f454e1939755901..0000000000000000000000000000000000000000 --- a/service/src/test/java/lcsb/mapviewer/services/view/ModelViewTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package lcsb.mapviewer.services.view; - -import org.apache.commons.lang3.SerializationUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class ModelViewTest { - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testSerialization() { - try { - SerializationUtils.serialize(new ModelView()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } -} diff --git a/service/src/test/java/lcsb/mapviewer/services/view/PrivilegeViewFactoryTest.java b/service/src/test/java/lcsb/mapviewer/services/view/PrivilegeViewFactoryTest.java deleted file mode 100644 index 9dc91d43c02ae25fffd6335d3b9a46aae0474084..0000000000000000000000000000000000000000 --- a/service/src/test/java/lcsb/mapviewer/services/view/PrivilegeViewFactoryTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package lcsb.mapviewer.services.view; - -import static org.junit.Assert.*; -import lcsb.mapviewer.model.user.BasicPrivilege; -import lcsb.mapviewer.services.ServiceTestFunctions; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -public class PrivilegeViewFactoryTest extends ServiceTestFunctions{ - - @Autowired - PrivilegeViewFactory privilegeViewFactory; - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testCreateEmpty() throws Exception { - try { - Object object = privilegeViewFactory.create(new BasicPrivilege()); - assertNotNull(object); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testCreateGson() throws Exception { - try { - PrivilegeView object = privilegeViewFactory.create(new BasicPrivilege()); - assertNotNull(privilegeViewFactory.createGson(object)); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} diff --git a/service/src/test/java/lcsb/mapviewer/services/view/PrivilegeViewTest.java b/service/src/test/java/lcsb/mapviewer/services/view/PrivilegeViewTest.java deleted file mode 100644 index 09521bd38c4b8de7e196e29cfdeb7361626e3d93..0000000000000000000000000000000000000000 --- a/service/src/test/java/lcsb/mapviewer/services/view/PrivilegeViewTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package lcsb.mapviewer.services.view; - -import org.apache.commons.lang3.SerializationUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class PrivilegeViewTest { - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testSerialization() { - try { - SerializationUtils.serialize(new PrivilegeView()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } -}